Class: SupportOps::GitLab::Pipelines
- Defined in:
- lib/support_ops_gitlab/gitlab/pipelines.rb
Overview
Document pipeline_variables
Get a test report for a pipeline => docs.gitlab.com/api/pipelines/#get-a-test-report-for-a-pipeline
Get a test report summary for a pipeline => docs.gitlab.com/api/pipelines/#get-a-test-report-summary-for-a-pipeline
Create a new pipeline => docs.gitlab.com/api/pipelines/#create-a-new-pipeline
Retry jobs in a pipeline => docs.gitlab.com/api/pipelines/#retry-jobs-in-a-pipeline
Cancel all jobs for a pipeline => docs.gitlab.com/api/pipelines/#cancel-all-jobs-for-a-pipeline
Delete a pipeline => docs.gitlab.com/api/pipelines/#delete-a-pipeline
Update pipeline metadata => docs.gitlab.com/api/pipelines/#update-pipeline-metadata
Document latest jobs
Defines the class Pipelines within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#created_at ⇒ String
XXX.
-
#id ⇒ Integer
The ID of the pipeline.
-
#iid ⇒ Integer
The integrated ID of the pipeline.
-
#inputs ⇒ Hash
A hash containing the inputs, as key-value pairs, to use when creating the pipeline.
-
#name ⇒ String
The name of the pipeline.
-
#project_id ⇒ Integer
The project the pipeline is on.
-
#ref ⇒ String
The branch or tag to run the pipeline on.
-
#sha ⇒ String
The SHA of the pipeline.
-
#source ⇒ String
The source of the pipeline.
-
#status ⇒ String
The status of the pipeline.
-
#updated_at ⇒ String
The timestamp of when the pipeline was last updated.
-
#variables ⇒ Array
An array of hashes containing the variables available in the pipeline.
-
#web_url ⇒ String
The URL the pipeline is at.
Class Method Summary collapse
-
.get(object) ⇒ Object
Locates a specific pipeline in a project.
-
.get!(object) ⇒ Object
Locates a specific pipeline in a project.
-
.list(key: value) ⇒ Array
Lists project pipelines.
Methods inherited from Base
#activate!, #approve!, attributes, #badges, #ban!, #block!, client, #client=, #commits, configure, #contributors, #create_support_pin!, #deactivate!, define_attributes, #delete!, #diffs, #disable_2fa!, #discussions, #emails, #encoded_path, #events, #find, #find!, #gpg_keys, #hard_delete!, #impersonations, #initialize, #issues, #jobs, #latest_pipeline, #members, #memberships, #merge_requests, #move!, #notes, #paid?, #pats, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #reject!, #revoke!, #rotate!, #save!, #ssh_keys, #store_original_attributes, #subscribe!, #support_pin, to_hash, #tokens, #unban!, #unblock!, #unsubscribe!, #webhooks
Constructor Details
This class inherits a constructor from SupportOps::GitLab::Base
Instance Attribute Details
#created_at ⇒ String
XXX
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def created_at @created_at end |
#id ⇒ Integer
The ID of the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def id @id end |
#iid ⇒ Integer
The integrated ID of the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def iid @iid end |
#inputs ⇒ Hash
A hash containing the inputs, as key-value pairs, to use when creating the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def inputs @inputs end |
#name ⇒ String
The name of the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def name @name end |
#project_id ⇒ Integer
The project the pipeline is on
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def project_id @project_id end |
#ref ⇒ String
The branch or tag to run the pipeline on
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def ref @ref end |
#sha ⇒ String
The SHA of the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def sha @sha end |
#source ⇒ String
The source of the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def source @source end |
#status ⇒ String
The status of the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def status @status end |
#updated_at ⇒ String
The timestamp of when the pipeline was last updated
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def updated_at @updated_at end |
#variables ⇒ Array
An array of hashes containing the variables available in the pipeline
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def variables @variables end |
#web_url ⇒ String
The URL the pipeline is at
34 35 36 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 34 def web_url @web_url end |
Class Method Details
.get(object) ⇒ Object
Locates a specific pipeline in a project
169 170 171 172 173 174 175 176 177 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 169 def self.get(object) if object.is_a? Pipelines Pipelines.new(id: id, project_id: project_id).find elsif object.is_a? Hash Pipelines.new({ id: object[:id], project_id: object[:project_id] }).find else raise 'You need an id and a project_id attribute' end end |
.get!(object) ⇒ Object
Locates a specific pipeline in a project
203 204 205 206 207 208 209 210 211 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 203 def self.get!(object) if object.is_a? Pipelines Pipelines.new(id: id, project_id: project_id).find! elsif object.is_a? Hash Pipelines.new({ id: object[:id], project_id: object[:project_id] }).find! else raise 'You need an id and a project_id attribute' end end |
.list(key: value) ⇒ Array
Lists project pipelines
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/support_ops_gitlab/gitlab/pipelines.rb', line 96 def self.list(**args) args[:project_id] = nil unless args[:project_id] raise 'You have to provide a project_id' if args[:project_id].nil? args[:created_after] = nil unless args[:created_after] args[:created_before] = nil unless args[:created_before] args[:name] = nil unless args[:name] args[:order_by] = nil unless args[:order_by] args[:ref] = nil unless args[:ref] args[:scope] = nil unless args[:scope] args[:sha] = nil unless args[:sha] args[:sort] = nil unless args[:sort] args[:source] = nil unless args[:source] args[:status] = nil unless args[:status] args[:updated_after] = nil unless args[:updated_after] args[:updated_before] = nil unless args[:updated_before] args[:username] = nil unless args[:username] args[:yaml_errors] = nil unless args[:yaml_errors] args[:limit] = 0 unless args[:limit] params = '' params += "created_after=#{args[:created_after]}&" unless args[:created_after].nil? params += "created_before=#{args[:created_before]}&" unless args[:created_before].nil? params += "name=#{args[:name]}&" unless args[:name].nil? params += "order_by=#{args[:order_by]}&" unless args[:order_by].nil? params += "ref=#{args[:ref]}&" unless args[:ref].nil? params += "scope=#{args[:scope]}&" unless args[:scope].nil? params += "sha=#{args[:sha]}&" unless args[:sha].nil? params += "sort=#{args[:sort]}&" unless args[:sort].nil? params += "source=#{args[:source]}&" unless args[:source].nil? params += "status=#{args[:status]}&" unless args[:status].nil? params += "updated_after=#{args[:updated_after]}&" unless args[:updated_after].nil? params += "updated_before=#{args[:updated_before]}&" unless args[:updated_before].nil? params += "username=#{args[:username]}&" unless args[:username].nil? params += "yaml_errors=#{args[:yaml_errors]}&" unless args[:yaml_errors].nil? array = [] page = 1 loop do response = client.connection.get("projects/#{args[:project_id]}/pipelines?#{params}&page=#{page}&per_page=100") body = Oj.load(response.body) array += body.map { |p| Pipelines.new(p) } break if args[:limit].to_i.positive? && array.count >= args[:limit].to_i break if body.count < 100 page += 1 end return array if args[:limit].to_i.zero? array.first(args[:limit].to_i) end |