Module: Gitlab::Client::Pipelines
- Included in:
- Gitlab::Client
- Defined in:
- lib/gitlab/client/pipelines.rb
Overview
Defines methods related to pipelines.
Instance Method Summary collapse
-
#cancel_pipeline(project, id) ⇒ Gitlab::ObjectifiedHash
Cancels a pipeline.
-
#create_pipeline(project, ref, variables = {}) ⇒ Gitlab::ObjectifiedHash
Create a pipeline.
-
#delete_pipeline(project, id) ⇒ void
Delete a pipeline.
-
#pipeline(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single pipeline.
-
#pipeline_test_report(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single pipeline’s test report.
-
#pipeline_variables(project, id) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a single pipeline’s variables.
-
#pipelines(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project pipelines.
-
#retry_pipeline(project, id) ⇒ Array<Gitlab::ObjectifiedHash>
Retry a pipeline.
-
#update_pipeline_metadata(project, id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update a pipeline metadata.
Instance Method Details
#cancel_pipeline(project, id) ⇒ Gitlab::ObjectifiedHash
Cancels a pipeline.
89 90 91 |
# File 'lib/gitlab/client/pipelines.rb', line 89 def cancel_pipeline(project, id) post("/projects/#{url_encode project}/pipelines/#{id}/cancel") end |
#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 |
#delete_pipeline(project, id) ⇒ void
This method returns an undefined value.
Delete a pipeline
113 114 115 |
# File 'lib/gitlab/client/pipelines.rb', line 113 def delete_pipeline(project, id) delete("/projects/#{url_encode project}/pipelines/#{id}") end |
#pipeline(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single pipeline.
30 31 32 |
# File 'lib/gitlab/client/pipelines.rb', line 30 def pipeline(project, id) get("/projects/#{url_encode project}/pipelines/#{id}") end |
#pipeline_test_report(project, id) ⇒ Gitlab::ObjectifiedHash
Gets a single pipeline’s test report.
42 43 44 |
# File 'lib/gitlab/client/pipelines.rb', line 42 def pipeline_test_report(project, id) get("/projects/#{url_encode project}/pipelines/#{id}/test_report") end |
#pipeline_variables(project, id) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a single pipeline’s variables.
54 55 56 |
# File 'lib/gitlab/client/pipelines.rb', line 54 def pipeline_variables(project, id) get("/projects/#{url_encode project}/pipelines/#{id}/variables") end |
#pipelines(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>
Gets a list of project pipelines.
18 19 20 |
# File 'lib/gitlab/client/pipelines.rb', line 18 def pipelines(project, = {}) get("/projects/#{url_encode project}/pipelines", query: ) end |
#retry_pipeline(project, id) ⇒ Array<Gitlab::ObjectifiedHash>
Retry a pipeline.
101 102 103 |
# File 'lib/gitlab/client/pipelines.rb', line 101 def retry_pipeline(project, id) post("/projects/#{url_encode project}/pipelines/#{id}/retry") end |
#update_pipeline_metadata(project, id, options = {}) ⇒ Gitlab::ObjectifiedHash
Update a pipeline metadata
126 127 128 |
# File 'lib/gitlab/client/pipelines.rb', line 126 def (project, id, = {}) put("/projects/#{url_encode project}/pipelines/#{id}/metadata", body: ) end |