Method: Gitlab::Client::Pipelines#create_pipeline
- Defined in:
- lib/gitlab/client/pipelines.rb
permalink #create_pipeline(project, ref, variables = {}) ⇒ Gitlab::ObjectifiedHash
Create a pipeline.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gitlab/client/pipelines.rb', line 55 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 |