gitlab_support_readiness 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea6f1d80c924ce2c4c9f4cb929873f6244376d783f507b71f42c2abc39a4943
|
4
|
+
data.tar.gz: 1f1902a265ada7bac8aad9b3183f068fb80cf7e0f841e92b9ef408ccc7cdef30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d8e2f831f94c90507f758dd744c4e8e84f4a7eb0041a763059b7a212d8a2e5a892a5f62ff692312a710c17b018ddc811be533dbdfb1c9a147779210e9327aac
|
7
|
+
data.tar.gz: 893eab1474c5eecdfcf18aa18cf6c6426e05e43e0ed8781f6dcf9107fecbc301277547f7b4aafe2f00bb02fa673135f72e0df0cdcd0df4c6ff03337236ab626d
|
@@ -0,0 +1,189 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module Readiness.
|
4
|
+
module Readiness
|
5
|
+
# Defines the module GitLab
|
6
|
+
module GitLab
|
7
|
+
##
|
8
|
+
# Defines the class Jobs within the module {Readiness::GitLab}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.13
|
12
|
+
# @todo List pipeline trigger jobs
|
13
|
+
# @todo Get job token’s job
|
14
|
+
# @todo Get GitLab agent by CI_JOB_TOKEN
|
15
|
+
# @todo Get a log file
|
16
|
+
# @todo Cancel a job
|
17
|
+
# @todo Retry a job
|
18
|
+
# @todo Erase a job
|
19
|
+
# @todo Run a job
|
20
|
+
class Jobs < Readiness::Client
|
21
|
+
attr_accessor :allow_failure, :archived, :artifacts, :artifacts_expire_at, :commit, :coverage, :created_at, :duration, :erased_at, :failure_reason, :finished_at, :id, :name, :pipeline, :project, :queued_duration, :ref, :runner, :runner_manager, :stage, :started_at, :status, :tag, :tag_list, :user, :web_url
|
22
|
+
|
23
|
+
##
|
24
|
+
# Creates a new {Readiness::GitLab::Jobs} instance
|
25
|
+
#
|
26
|
+
# @author Jason Colyer
|
27
|
+
# @since 1.0.13
|
28
|
+
# @param object [Object] An instance of {Readiness::GitLab::Jobs}
|
29
|
+
# @example
|
30
|
+
# require 'support_readiness'
|
31
|
+
# Readiness::GitLab::Jobs.new
|
32
|
+
def initialize(object = {})
|
33
|
+
@allow_failure = object['allow_failure']
|
34
|
+
@archived = object['archived']
|
35
|
+
@artifacts = object['artifacts']
|
36
|
+
@artifacts_expire_at = object['artifacts_expire_at']
|
37
|
+
@commit = object['commit']
|
38
|
+
@coverage = object['coverage']
|
39
|
+
@created_at = object['created_at']
|
40
|
+
@duration = object['duration']
|
41
|
+
@erased_at = object['erased_at']
|
42
|
+
@failure_reason = object['failure_reason']
|
43
|
+
@finished_at = object['finished_at']
|
44
|
+
@id = object['id']
|
45
|
+
@name = object['name']
|
46
|
+
@pipeline = object['pipeline']
|
47
|
+
@project = object['project']
|
48
|
+
@queued_duration = object['queued_duration']
|
49
|
+
@ref = object['ref']
|
50
|
+
@runner = object['runner']
|
51
|
+
@runner_manager = object['runner_manager']
|
52
|
+
@stage = object['stage']
|
53
|
+
@started_at = object['started_at']
|
54
|
+
@status = object['status']
|
55
|
+
@tag = object['tag']
|
56
|
+
@tag_list = object['tag_list']
|
57
|
+
@user = object['user']
|
58
|
+
@web_url = object['web_url']
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Lists all project jobs. Does not stop until it ends or the page limit is hit.
|
63
|
+
# This method can take a long time to run depending on the parameters used.
|
64
|
+
#
|
65
|
+
# @author Jason Colyer
|
66
|
+
# @since 1.0.13
|
67
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
68
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
69
|
+
# @param limit [Integer] The number of pages to stop at. Using 0 means to list all.
|
70
|
+
# @param filters [Array] An array of filter Strings to use. Should be in the format of key=value
|
71
|
+
# @return [Array]
|
72
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs GitLab API > Jobs > List project jobs
|
73
|
+
# @example
|
74
|
+
# require 'support_readiness'
|
75
|
+
# config = Readiness::GitLab::Configuration.new
|
76
|
+
# config.token = 'test123abc'
|
77
|
+
# client = Readiness::GitLab::Client.new(config)
|
78
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
79
|
+
# jobs = Readiness::GitLab::Jobs.list_project(client, project, 2)
|
80
|
+
# puts jobs.count
|
81
|
+
# # => 200
|
82
|
+
def list_project(client, project, limit = 0, filters = [])
|
83
|
+
array = []
|
84
|
+
page = 1
|
85
|
+
loop do
|
86
|
+
response = client.connection.get "projects/#{project.id}/jobs?per_page=100&page=#{page}&#{to_param_string(filters)}"
|
87
|
+
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
|
88
|
+
body = Oj.load(response.body)
|
89
|
+
array += body.map { |p| Jobs.new(p) }
|
90
|
+
break if body.count < 100
|
91
|
+
break if limit != 0 && array.count >= (limit * 100)
|
92
|
+
|
93
|
+
page += 1
|
94
|
+
end
|
95
|
+
array
|
96
|
+
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# Lists all pipeline jobs. Does not stop until it ends or the page limit is hit.
|
100
|
+
# This method can take a long time to run depending on the parameters used.
|
101
|
+
#
|
102
|
+
# @author Jason Colyer
|
103
|
+
# @since 1.0.13
|
104
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
105
|
+
# @param pipeline [Object] An instance of {Readiness::GitLab::Pipelines}
|
106
|
+
# @param limit [Integer] The number of pages to stop at. Using 0 means to list all.
|
107
|
+
# @param filters [Array] An array of filter Strings to use. Should be in the format of key=value
|
108
|
+
# @return [Array]
|
109
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-jobs GitLab API > Jobs > List pipeline jobs
|
110
|
+
# @example
|
111
|
+
# require 'support_readiness'
|
112
|
+
# config = Readiness::GitLab::Configuration.new
|
113
|
+
# config.token = 'test123abc'
|
114
|
+
# client = Readiness::GitLab::Client.new(config)
|
115
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
116
|
+
# pipelines = Readiness::GitLab::Pipelines.list(client, project, 2, ["name=Check System", "status=failed"])
|
117
|
+
# jobs = Readiness::GitLab::Jobs.list_pipeline(client, pipeline, 1)
|
118
|
+
# puts jobs.count
|
119
|
+
# # => 100
|
120
|
+
def list_pipeline(client, pipeline, limit = 0, filters = [])
|
121
|
+
array = []
|
122
|
+
page = 1
|
123
|
+
loop do
|
124
|
+
response = client.connection.get "projects/#{pipeline.project_id}/pipelines/#{pipeline.iid}/jobs?per_page=100&page=#{page}&#{to_param_string(filters)}"
|
125
|
+
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
|
126
|
+
body = Oj.load(response.body)
|
127
|
+
array += body.map { |p| Jobs.new(p) }
|
128
|
+
break if body.count < 100
|
129
|
+
break if limit != 0 && array.count >= (limit * 100)
|
130
|
+
|
131
|
+
page += 1
|
132
|
+
end
|
133
|
+
array
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# Locates a project job within GitLab. This will not exit on error (except Authentication errors)
|
138
|
+
#
|
139
|
+
# @author Jason Colyer
|
140
|
+
# @since 1.0.13
|
141
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
142
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
143
|
+
# @param jid [Integer] The job IID to find
|
144
|
+
# @return [Hash]
|
145
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html#get-a-single-job GitLab API > Jobs > get a sngle job
|
146
|
+
# @example
|
147
|
+
# require 'support_readiness'
|
148
|
+
# config = Readiness::GitLab::Configuration.new
|
149
|
+
# config.token = 'test123abc'
|
150
|
+
# client = Readiness::GitLab::Client.new(config)
|
151
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
152
|
+
# job = Readiness::GitLab::Jobs.find(client, project, 5)
|
153
|
+
# puts job.status
|
154
|
+
# # => "failed"
|
155
|
+
def self.find(client, project, jid)
|
156
|
+
response = client.connection.get "projects/#{project.id}/jobs/#{jid}"
|
157
|
+
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: jid }) unless response.status == 200
|
158
|
+
return Jobs.new(Oj.load(response.body)) if response.status == 200
|
159
|
+
|
160
|
+
Oj.load(response.body)
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# Locates a project job within GitLab. This will not exit on error (except Authentication errors)
|
165
|
+
#
|
166
|
+
# @author Jason Colyer
|
167
|
+
# @since 1.0.13
|
168
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
169
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
170
|
+
# @param jid [Integer] The job IID to find
|
171
|
+
# @return [Object] An instance of {Readiness::GitLab::Jobs
|
172
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html#get-a-single-job GitLab API > Jobs > get a sngle job
|
173
|
+
# @example
|
174
|
+
# require 'support_readiness'
|
175
|
+
# config = Readiness::GitLab::Configuration.new
|
176
|
+
# config.token = 'test123abc'
|
177
|
+
# client = Readiness::GitLab::Client.new(config)
|
178
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
179
|
+
# job = Readiness::GitLab::Jobs.find!(client, project, 5)
|
180
|
+
# puts job.status
|
181
|
+
# # => "failed"
|
182
|
+
def self.find(client, project, jid)
|
183
|
+
response = client.connection.get "projects/#{project.id}/jobs/#{jid}"
|
184
|
+
handle_request_error(1, 'GitLab', response.status, { action: 'Find job', id: jid }) unless response.status == 200
|
185
|
+
Jobs.new(Oj.load(response.body))
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Defines the module Readiness.
|
4
|
+
module Readiness
|
5
|
+
# Defines the module GitLab
|
6
|
+
module GitLab
|
7
|
+
##
|
8
|
+
# Defines the class Pipelines within the module {Readiness::GitLab}.
|
9
|
+
#
|
10
|
+
# @author Jason Colyer
|
11
|
+
# @since 1.0.13
|
12
|
+
# @todo Get a pipeline’s test report
|
13
|
+
# @todo Get a pipeline’s test report summary
|
14
|
+
# @todo Create a new pipeline
|
15
|
+
# @todo Retry jobs in a pipeline
|
16
|
+
# @todo Cancel a pipeline's jobs
|
17
|
+
# @todo Delete a pipeline
|
18
|
+
# @todo Update pipeline metadata
|
19
|
+
class Pipelines < Readiness::Client
|
20
|
+
attr_accessor :created_at, :id, :iid, :name, :project_id, :ref, :sha, :source, :status, :updated_at, :web_url
|
21
|
+
|
22
|
+
##
|
23
|
+
# Creates a new {Readiness::GitLab::Pipelines} instance
|
24
|
+
#
|
25
|
+
# @author Jason Colyer
|
26
|
+
# @since 1.0.13
|
27
|
+
# @param object [Object] An instance of {Readiness::GitLab::Pipelines}
|
28
|
+
# @example
|
29
|
+
# require 'support_readiness'
|
30
|
+
# Readiness::GitLab::Pipelines.new
|
31
|
+
def initialize(object = {})
|
32
|
+
@created_at = object['created_at']
|
33
|
+
@id = object['id']
|
34
|
+
@iid = object['iid']
|
35
|
+
@name = object['name']
|
36
|
+
@project_id = object['project_id']
|
37
|
+
@ref = object['ref']
|
38
|
+
@sha = object['sha']
|
39
|
+
@source = object['source']
|
40
|
+
@status = object['status']
|
41
|
+
@updated_at = object['updated_at']
|
42
|
+
@web_url = object['web_url']
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Lists all pipelines for an object. Does not stop until it ends or the page limit is hit.
|
47
|
+
# This method can take a long time to run depending on the parameters used.
|
48
|
+
#
|
49
|
+
# @author Jason Colyer
|
50
|
+
# @since 1.0.13
|
51
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
52
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
53
|
+
# @param limit [Integer] The number of pages to stop at. Using 0 means to list all.
|
54
|
+
# @param filters [Array] An array of filter Strings to use. Should be in the format of key=value
|
55
|
+
# @return [Array]
|
56
|
+
# @see https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines GitLab API > Pipelines > List project pipelines
|
57
|
+
# @example
|
58
|
+
# require 'support_readiness'
|
59
|
+
# config = Readiness::GitLab::Configuration.new
|
60
|
+
# config.token = 'test123abc'
|
61
|
+
# client = Readiness::GitLab::Client.new(config)
|
62
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
63
|
+
# pipelines = Readiness::GitLab::Pipelines.list(client, project, 2, ["name=Check System", "status=failed"])
|
64
|
+
# puts pipelines.first.web_url
|
65
|
+
# # => "https://gitlab.com/gitlab-com/support/support-team-meta/-/pipelines/2"
|
66
|
+
def self.list(client, project, limit = 0, filters = [])
|
67
|
+
array = []
|
68
|
+
page = 1
|
69
|
+
loop do
|
70
|
+
response = client.connection.get "projects/#{project.id}/pipelines?per_page=100&page=#{page}&#{to_param_string(filters)}"
|
71
|
+
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
|
72
|
+
body = Oj.load(response.body)
|
73
|
+
array += body.map { |p| Pipelines.new(p) }
|
74
|
+
break if body.count < 100
|
75
|
+
break if limit != 0 && array.count >= (limit * 100)
|
76
|
+
|
77
|
+
page += 1
|
78
|
+
end
|
79
|
+
array
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Locates a project pipeline within GitLab. This will not exit on error (except Authentication errors)
|
84
|
+
#
|
85
|
+
# @author Jason Colyer
|
86
|
+
# @since 1.0.13
|
87
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
88
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
89
|
+
# @param pid [Integer] The pipeline IID to find
|
90
|
+
# @return [Hash]
|
91
|
+
# @see https://docs.gitlab.com/ee/api/pipelines.html#get-a-single-pipeline GitLab API > Pipelines > Get a single pipeline
|
92
|
+
# @example
|
93
|
+
# require 'support_readiness'
|
94
|
+
# config = Readiness::GitLab::Configuration.new
|
95
|
+
# config.token = 'test123abc'
|
96
|
+
# client = Readiness::GitLab::Client.new(config)
|
97
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
98
|
+
# pipeline = Readiness::GitLab::Pipelines.find(client, project, 5)
|
99
|
+
# puts pipeline.web_url
|
100
|
+
# # => "https://gitlab.com/gitlab-com/support/support-team-meta/-/pipelines/5"
|
101
|
+
def self.find(client, project, pid)
|
102
|
+
response = client.connection.get "projects/#{project.id}/pipelines/#{pid}"
|
103
|
+
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: pid }) unless response.status == 200
|
104
|
+
return Pipelines.new(Oj.load(response.body)) if response.status == 200
|
105
|
+
|
106
|
+
Oj.load(response.body)
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# Locates a project pipeline within GitLab. This will exit on error
|
111
|
+
#
|
112
|
+
# @author Jason Colyer
|
113
|
+
# @since 1.0.13
|
114
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
115
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
116
|
+
# @param pid [Integer] The pipeline IID to find
|
117
|
+
# @return [Object] An instance of {Readiness::GitLab::Pipelines}
|
118
|
+
# @see https://docs.gitlab.com/ee/api/pipelines.html#get-a-single-pipeline GitLab API > Pipelines > Get a single pipeline
|
119
|
+
# @example
|
120
|
+
# require 'support_readiness'
|
121
|
+
# config = Readiness::GitLab::Configuration.new
|
122
|
+
# config.token = 'test123abc'
|
123
|
+
# client = Readiness::GitLab::Client.new(config)
|
124
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
125
|
+
# pipeline = Readiness::GitLab::Pipelines.find!(client, project, 5)
|
126
|
+
# puts pipeline.web_url
|
127
|
+
# # => "https://gitlab.com/gitlab-com/support/support-team-meta/-/pipelines/5"
|
128
|
+
def self.find!(client, project, pid)
|
129
|
+
response = client.connection.get "projects/#{project.id}/pipelines/#{pid}"
|
130
|
+
handle_request_error(1, 'GitLab', response.status, { action: 'Find pipeline', id: pid }) unless response.status == 200
|
131
|
+
Pipelines.new(Oj.load(response.body))
|
132
|
+
end
|
133
|
+
|
134
|
+
##
|
135
|
+
# Gets the variables for a pipeline.
|
136
|
+
#
|
137
|
+
# @author Jason Colyer
|
138
|
+
# @since 1.0.13
|
139
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
140
|
+
# @param pipeline [Object] An instance of {Readiness::GitLab::Pipelines}
|
141
|
+
# @return [Hash]
|
142
|
+
# @see https://docs.gitlab.com/ee/api/pipelines.html#get-variables-of-a-pipeline GitLab API > Pipelines > Get variables of a pipeline
|
143
|
+
# @example
|
144
|
+
# require 'support_readiness'
|
145
|
+
# config = Readiness::GitLab::Configuration.new
|
146
|
+
# config.token = 'test123abc'
|
147
|
+
# client = Readiness::GitLab::Client.new(config)
|
148
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
149
|
+
# pipeline = Readiness::GitLab::Pipelines.find!(client, project, 5)
|
150
|
+
# variables = Readiness::GitLab::Pipelines.find!(client, pipeline)
|
151
|
+
# pp variables
|
152
|
+
# # => [
|
153
|
+
# {
|
154
|
+
# "key": "NAME",
|
155
|
+
# "variable_type": "env_var",
|
156
|
+
# "value": "Jason"
|
157
|
+
# }
|
158
|
+
# ]
|
159
|
+
def self.variables(client, pipeline)
|
160
|
+
response = client.connection.get "projects/#{pipeline.project_id}/pipleines/#{pipeline.iid}/variables"
|
161
|
+
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: pid }) unless response.status == 200
|
162
|
+
Oj.load(response.body)
|
163
|
+
end
|
164
|
+
|
165
|
+
##
|
166
|
+
# Lists all pipeline jobs. This is a wrapper of {Jobs#list_pipeline}
|
167
|
+
#
|
168
|
+
# @author Jason Colyer
|
169
|
+
# @since 1.0.13
|
170
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
171
|
+
# @param pipeline [Object] An instance of {Readiness::GitLab::Pieplines}
|
172
|
+
# @param limit [Integer] The number of pages to stop at. Using 0 means to list all.
|
173
|
+
# @param filters [Array] An array of filter Strings to use. Should be in the format of key=value
|
174
|
+
# @return [Array]
|
175
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-jobs GitLab API > Jobs > List pipeline jobs
|
176
|
+
# @example
|
177
|
+
# require 'support_readiness'
|
178
|
+
# config = Readiness::GitLab::Configuration.new
|
179
|
+
# config.token = 'test123abc'
|
180
|
+
# client = Readiness::GitLab::Client.new(config)
|
181
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
182
|
+
# pipeline = Readiness::GitLab::Pipelines.find!(client, project, 2)
|
183
|
+
# jobs = Readiness::GitLab::Pipelines.jobs(client, pipeline, 2)
|
184
|
+
# puts jobs.count
|
185
|
+
# # => 187
|
186
|
+
def self.jobs(client, pipeline, limit = 0, filters = [])
|
187
|
+
Jobs.list_pipeline(client, pipeline, limit, filters)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
@@ -540,6 +540,55 @@ module Readiness
|
|
540
540
|
end
|
541
541
|
array
|
542
542
|
end
|
543
|
+
|
544
|
+
##
|
545
|
+
# Lists all pipelines for an object. This is a wrapper of {Pipelines#list}
|
546
|
+
#
|
547
|
+
# @author Jason Colyer
|
548
|
+
# @since 1.0.13
|
549
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
550
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
551
|
+
# @param limit [Integer] The number of pages to stop at. Using 0 means to list all.
|
552
|
+
# @param filters [Array] An array of filter Strings to use. Should be in the format of key=value
|
553
|
+
# @return [Array]
|
554
|
+
# @see https://docs.gitlab.com/ee/api/pipelines.html#list-project-pipelines GitLab API > Pipelines > List project pipelines
|
555
|
+
# @example
|
556
|
+
# require 'support_readiness'
|
557
|
+
# config = Readiness::GitLab::Configuration.new
|
558
|
+
# config.token = 'test123abc'
|
559
|
+
# client = Readiness::GitLab::Client.new(config)
|
560
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
561
|
+
# pipelines = Readiness::GitLab::Projects.pipelines(client, project, 2, ["name=Check System", "status=failed"])
|
562
|
+
# puts pipelines.first.web_url
|
563
|
+
# # => "https://gitlab.com/gitlab-com/support/support-team-meta/-/pipelines/2"
|
564
|
+
def self.pipelines(client, project, limit = 0, filters = [])
|
565
|
+
Pipelines.list(client, project, limit, filters)
|
566
|
+
end
|
567
|
+
|
568
|
+
##
|
569
|
+
# Lists all project jobs. This is a wrapper of {Jobs#list_project}
|
570
|
+
#
|
571
|
+
# @author Jason Colyer
|
572
|
+
# @since 1.0.13
|
573
|
+
# @param client [Object] An instance of {Readiness::GitLab::Client}
|
574
|
+
# @param project [Object] An instance of {Readiness::GitLab::Projects}
|
575
|
+
# @param limit [Integer] The number of pages to stop at. Using 0 means to list all.
|
576
|
+
# @param filters [Array] An array of filter Strings to use. Should be in the format of key=value
|
577
|
+
# @return [Array]
|
578
|
+
# @see https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs GitLab API > Jobs > List project jobs
|
579
|
+
# @example
|
580
|
+
# require 'support_readiness'
|
581
|
+
# config = Readiness::GitLab::Configuration.new
|
582
|
+
# config.token = 'test123abc'
|
583
|
+
# client = Readiness::GitLab::Client.new(config)
|
584
|
+
# project = Readiness::GitLab::Projects.find!(client, 1083469)
|
585
|
+
# pipeline = Readiness::GitLab::Pipelines.find!(client, project, 2)
|
586
|
+
# jobs = Readiness::GitLab::Pipelines.jobs(client, pipeline, 2)
|
587
|
+
# puts jobs.count
|
588
|
+
# # => 187
|
589
|
+
def self.jobs(client, project, limit = 0, filters = [])
|
590
|
+
Jobs.list_project(client, project, limit, filters)
|
591
|
+
end
|
543
592
|
end
|
544
593
|
end
|
545
594
|
end
|
@@ -11,9 +11,11 @@ module Readiness
|
|
11
11
|
require "#{__dir__}/gitlab/configuration"
|
12
12
|
require "#{__dir__}/gitlab/groups"
|
13
13
|
require "#{__dir__}/gitlab/issues"
|
14
|
+
require "#{__dir__}/gitlab/jobs"
|
14
15
|
require "#{__dir__}/gitlab/markdown"
|
15
16
|
require "#{__dir__}/gitlab/merge_requests"
|
16
17
|
require "#{__dir__}/gitlab/namespaces"
|
18
|
+
require "#{__dir__}/gitlab/pipelines"
|
17
19
|
require "#{__dir__}/gitlab/projects"
|
18
20
|
require "#{__dir__}/gitlab/repositories"
|
19
21
|
require "#{__dir__}/gitlab/users"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab_support_readiness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Colyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -246,9 +246,11 @@ files:
|
|
246
246
|
- lib/support_readiness/gitlab/configuration.rb
|
247
247
|
- lib/support_readiness/gitlab/groups.rb
|
248
248
|
- lib/support_readiness/gitlab/issues.rb
|
249
|
+
- lib/support_readiness/gitlab/jobs.rb
|
249
250
|
- lib/support_readiness/gitlab/markdown.rb
|
250
251
|
- lib/support_readiness/gitlab/merge_requests.rb
|
251
252
|
- lib/support_readiness/gitlab/namespaces.rb
|
253
|
+
- lib/support_readiness/gitlab/pipelines.rb
|
252
254
|
- lib/support_readiness/gitlab/projects.rb
|
253
255
|
- lib/support_readiness/gitlab/repositories.rb
|
254
256
|
- lib/support_readiness/gitlab/users.rb
|