module Gitlab::Client::Pipelines
def create_pipeline(project, ref, variables = {})
-
(Gitlab::ObjectifiedHash)
- The pipelines changes.
Parameters:
-
variables
(Hash
) -- Variables passed to pipelines -
ref
(String
) -- Reference to commit. -
project
(Integer, String
) -- The ID or name of a project.
def create_pipeline(project, ref, variables = {}) body = {} # This mapping is necessary, cause the API expects an array with objects (with `key` and `value` keys) # See: https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline body[:variables] = variables.map { |(key, value)| { key: key, value: value } } if variables.any? post( "/projects/#{url_encode project}/pipeline", query: { ref: ref }, body: body ) end