Method: Gitlab::Client::Pipelines#create_pipeline
- Defined in:
- lib/gitlab/client/pipelines.rb
permalink #create_pipeline(project, ref, variables = {}) ⇒ Gitlab::ObjectifiedHash
Create a pipeline.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/gitlab/client/pipelines.rb', line 67 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 |