bard 0.47.0 → 0.48.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/lib/bard/ci/github_actions.rb +191 -0
- data/lib/bard/ci/jenkins.rb +85 -0
- data/lib/bard/ci/local.rb +49 -0
- data/lib/bard/ci.rb +27 -124
- data/lib/bard/version.rb +1 -1
- data/lib/bard.rb +1 -1
- data/spec/bard/ci/github_actions_spec.rb +34 -0
- data/spec/spec_helper.rb +6 -8
- data/spec/support/fixtures/job.json +1 -0
- data/spec/support/fixtures/response_in_progress.json +225 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bb22c1837b63f605c0417e3ce283546623b2a8dfd1b8728f95bda0466f65fa0
|
4
|
+
data.tar.gz: fb674ce15fdf02f6113caa5d553bae0633b5b9873b7fb39a0378716b17a34bb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 877e9bf78d365846fb83dcd5d77b14a2b1bec637a29f95c55b4dd6c121cbb8bdb2e1656907afef3ef798599c8c03e4b68003092a9893c6cda9a0a24aa322734b
|
7
|
+
data.tar.gz: 97a5adca93a34605c47c61d18c9f283e058c9f3342f38df2b59f288d734d7b03e69909f64f1058f0034dea265facc05f21afcc6328e00acc2fde0e99095f24aa
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "time"
|
3
|
+
require "json"
|
4
|
+
require "net/http"
|
5
|
+
|
6
|
+
class Bard::CLI < Thor
|
7
|
+
class CI
|
8
|
+
class GithubActions < Struct.new(:project_name, :branch, :sha)
|
9
|
+
def run
|
10
|
+
api = API.new(project_name)
|
11
|
+
last_time_elapsed = api.last_successful_run.time_elapsed
|
12
|
+
@run = api.create_run!(branch)
|
13
|
+
|
14
|
+
start_time = Time.new.to_i
|
15
|
+
while @run.building?
|
16
|
+
elapsed_time = Time.new.to_i - start_time
|
17
|
+
yield elapsed_time, last_time_elapsed
|
18
|
+
sleep(2)
|
19
|
+
@run = api.find_run(@run.id)
|
20
|
+
end
|
21
|
+
|
22
|
+
@run.success?
|
23
|
+
end
|
24
|
+
|
25
|
+
def exists?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def console
|
30
|
+
@run.console
|
31
|
+
end
|
32
|
+
|
33
|
+
def last_response
|
34
|
+
end
|
35
|
+
|
36
|
+
class API < Struct.new(:project_name)
|
37
|
+
def last_successful_run
|
38
|
+
successful_runs = client.get("runs", status: "success", per_page: 1)
|
39
|
+
json = successful_runs["workflow_runs"][0]
|
40
|
+
Run.new(self, json)
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_run id
|
44
|
+
json = client.get("runs/#{id}")
|
45
|
+
Run.new(self, json)
|
46
|
+
end
|
47
|
+
|
48
|
+
def create_run! branch
|
49
|
+
start_time = Time.now
|
50
|
+
client.post("workflows/ci.yml/dispatches", ref: branch, inputs: { "git-ref": branch })
|
51
|
+
sha = `git rev-parse #{branch}`.chomp
|
52
|
+
|
53
|
+
loop do
|
54
|
+
runs = client.get("runs", head_sha: sha, created: ">#{start_time.iso8601}")
|
55
|
+
if json = runs["workflow_runs"].first
|
56
|
+
return Run.new(self, json)
|
57
|
+
end
|
58
|
+
sleep 1
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def find_job_by_run_id run_id
|
63
|
+
jobs = client.get("runs/#{run_id}/jobs", filter: "latest", per_page: 1)
|
64
|
+
job_json = jobs["jobs"][0]
|
65
|
+
Job.new(self, job_json)
|
66
|
+
end
|
67
|
+
|
68
|
+
def download_logs_by_job_id job_id
|
69
|
+
client.get("jobs/#{job_id}/logs")
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def client
|
75
|
+
@client ||= Client.new(project_name)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class Run < Struct.new(:api, :json)
|
80
|
+
def id
|
81
|
+
json["id"]
|
82
|
+
end
|
83
|
+
|
84
|
+
def time_elapsed
|
85
|
+
job.time_elapsed
|
86
|
+
end
|
87
|
+
|
88
|
+
def building?
|
89
|
+
%w[in_progress queued requested waiting pending]
|
90
|
+
.include?(json["status"])
|
91
|
+
end
|
92
|
+
|
93
|
+
def success?
|
94
|
+
json["status"] == "success"
|
95
|
+
end
|
96
|
+
|
97
|
+
def job
|
98
|
+
@job ||= api.find_job_by_run_id(id)
|
99
|
+
end
|
100
|
+
|
101
|
+
def console
|
102
|
+
job.logs
|
103
|
+
end
|
104
|
+
|
105
|
+
# OTHER STATUSES
|
106
|
+
# completed
|
107
|
+
# action_required
|
108
|
+
# cancelled
|
109
|
+
# failure
|
110
|
+
# neutral
|
111
|
+
# skipped
|
112
|
+
# stale
|
113
|
+
# timed_out
|
114
|
+
end
|
115
|
+
|
116
|
+
class Job < Struct.new(:api, :json)
|
117
|
+
def id
|
118
|
+
json["id"]
|
119
|
+
end
|
120
|
+
|
121
|
+
def time_elapsed
|
122
|
+
Time.parse(json["completed_at"]).to_i -
|
123
|
+
Time.parse(json["started_at"]).to_i
|
124
|
+
end
|
125
|
+
|
126
|
+
def logs
|
127
|
+
@logs ||= api.download_logs_by_job_id(id)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class Client < Struct.new(:project_name)
|
132
|
+
def get path, params={}
|
133
|
+
request(path) do |uri|
|
134
|
+
uri.query = URI.encode_www_form(params)
|
135
|
+
Net::HTTP::Get.new(uri)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def post path, params={}
|
140
|
+
request(path) do |uri|
|
141
|
+
Net::HTTP::Post.new(uri).tap do |r|
|
142
|
+
r.body = JSON.dump(params)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
private
|
148
|
+
|
149
|
+
def github_apikey
|
150
|
+
@github_apikey ||= begin
|
151
|
+
raw = `git ls-remote -t git@github.com:botandrose/bard`
|
152
|
+
raw[/github-apikey\|(.+)$/, 1]
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def request path, &block
|
157
|
+
uri = if path =~ /^http/
|
158
|
+
URI(path)
|
159
|
+
else
|
160
|
+
URI("https://api.github.com/repos/botandrose/#{project_name}/actions/#{path}")
|
161
|
+
end
|
162
|
+
|
163
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
164
|
+
request = block.call(uri)
|
165
|
+
request["Accept"] = "application/vnd.github+json"
|
166
|
+
request["Authorization"] = "Token #{github_apikey}"
|
167
|
+
request["X-GitHub-Api-Version"] = "2022-11-28"
|
168
|
+
http.request(request)
|
169
|
+
end
|
170
|
+
|
171
|
+
case response
|
172
|
+
when Net::HTTPRedirection then
|
173
|
+
url = response["Location"]
|
174
|
+
request(url) do |uri|
|
175
|
+
Net::HTTP::Get.new(uri)
|
176
|
+
end
|
177
|
+
when Net::HTTPSuccess then
|
178
|
+
if response["Content-Type"].to_s.include?("/json")
|
179
|
+
JSON.load(response.body)
|
180
|
+
else
|
181
|
+
response.body
|
182
|
+
end
|
183
|
+
else
|
184
|
+
raise response.inspect
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require "json"
|
2
|
+
|
3
|
+
class Bard::CLI < Thor
|
4
|
+
class CI
|
5
|
+
class Jenkins < Struct.new(:project_name, :branch, :sha)
|
6
|
+
def run
|
7
|
+
last_time_elapsed = get_last_time_elapsed
|
8
|
+
start
|
9
|
+
sleep(2) until started?
|
10
|
+
|
11
|
+
start_time = Time.new.to_i
|
12
|
+
while building?
|
13
|
+
elapsed_time = Time.new.to_i - start_time
|
14
|
+
yield elapsed_time, last_time_elapsed
|
15
|
+
sleep(2)
|
16
|
+
end
|
17
|
+
|
18
|
+
success?
|
19
|
+
end
|
20
|
+
|
21
|
+
def exists?
|
22
|
+
`curl -s -I #{ci_host}/` =~ /\b200 OK\b/
|
23
|
+
end
|
24
|
+
|
25
|
+
def console
|
26
|
+
raw = `curl -s #{ci_host}/lastBuild/console`
|
27
|
+
raw[%r{<pre.*?>(.+)</pre>}m, 1]
|
28
|
+
end
|
29
|
+
|
30
|
+
attr_accessor :last_response
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def get_last_time_elapsed
|
35
|
+
response = `curl -s #{ci_host}/lastStableBuild/api/xml`
|
36
|
+
response.match(/<duration>(\d+)<\/duration>/)
|
37
|
+
$1 ? $1.to_i / 1000 : nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def auth
|
41
|
+
"botandrose:11cc2ba6ef2e43fbfbedc1f466724f6290"
|
42
|
+
end
|
43
|
+
|
44
|
+
def ci_host
|
45
|
+
"http://#{auth}@ci.botandrose.com/job/#{project_name}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def start
|
49
|
+
command = "curl -s -I -X POST -L '#{ci_host}/buildWithParameters?GIT_REF=#{sha}'"
|
50
|
+
output = `#{command}`
|
51
|
+
@queueId = output[%r{Location: .+/queue/item/(\d+)/}, 1].to_i
|
52
|
+
end
|
53
|
+
|
54
|
+
def started?
|
55
|
+
command = "curl -s -g '#{ci_host}/api/json?depth=1&tree=builds[queueId,number]'"
|
56
|
+
output = `#{command}`
|
57
|
+
JSON.parse(output)["builds"][0]["queueId"] == @queueId
|
58
|
+
end
|
59
|
+
|
60
|
+
def job_id
|
61
|
+
@job_id ||= begin
|
62
|
+
output = `curl -s -g '#{ci_host}/api/json?depth=1&tree=builds[queueId,number]'`
|
63
|
+
output[/"number":(\d+),"queueId":#{@queueId}\b/, 1].to_i
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def building?
|
68
|
+
self.last_response = `curl -s #{ci_host}/#{job_id}/api/json?tree=building,result`
|
69
|
+
if last_response.blank?
|
70
|
+
sleep(2) # retry
|
71
|
+
self.last_response = `curl -s #{ci_host}/#{job_id}/api/json?tree=building,result`
|
72
|
+
if last_response.blank?
|
73
|
+
raise "Blank response from CI twice in a row. Aborting!"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
last_response.include? '"building":true'
|
77
|
+
end
|
78
|
+
|
79
|
+
def success?
|
80
|
+
last_response.include? '"result":"SUCCESS"'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "open3"
|
2
|
+
|
3
|
+
class Bard::CLI < Thor
|
4
|
+
class CI
|
5
|
+
class Local < Struct.new(:project_name, :branch, :sha)
|
6
|
+
def run
|
7
|
+
start
|
8
|
+
|
9
|
+
start_time = Time.new.to_i
|
10
|
+
while building?
|
11
|
+
elapsed_time = Time.new.to_i - start_time
|
12
|
+
yield elapsed_time, nil
|
13
|
+
sleep(2)
|
14
|
+
end
|
15
|
+
|
16
|
+
@stdin.close
|
17
|
+
@console = @stdout_and_stderr.read
|
18
|
+
@stdout_and_stderr.close
|
19
|
+
|
20
|
+
success?
|
21
|
+
end
|
22
|
+
|
23
|
+
def exists?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def console
|
28
|
+
@console
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_accessor :last_response
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def start
|
36
|
+
@stdin, @stdout_and_stderr, @wait_thread = Open3.popen2e("bin/rake ci")
|
37
|
+
end
|
38
|
+
|
39
|
+
def building?
|
40
|
+
![nil, false].include?(@wait_thread.status)
|
41
|
+
end
|
42
|
+
|
43
|
+
def success?
|
44
|
+
@wait_thread.value.success?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
data/lib/bard/ci.rb
CHANGED
@@ -1,146 +1,49 @@
|
|
1
|
-
require "json"
|
2
1
|
require "forwardable"
|
3
|
-
require "open3"
|
4
2
|
|
5
3
|
class Bard::CLI < Thor
|
6
4
|
class CI
|
7
|
-
def initialize project_name,
|
5
|
+
def initialize project_name, branch, local: false
|
8
6
|
@project_name = project_name
|
9
|
-
@
|
7
|
+
@branch = branch
|
10
8
|
@local = !!local
|
11
|
-
@runner = @local ? Local.new(project_name, sha) : Remote.new(project_name, sha)
|
12
9
|
end
|
13
10
|
|
14
|
-
attr_reader :project_name, :
|
11
|
+
attr_reader :project_name, :branch, :runner
|
15
12
|
|
16
|
-
def
|
17
|
-
@
|
13
|
+
def sha
|
14
|
+
@sha ||= `git rev-parse #{branch}`.chomp
|
18
15
|
end
|
19
16
|
|
20
|
-
|
17
|
+
def runner
|
18
|
+
@runner ||= choose_runner_class.new(project_name, branch, sha)
|
19
|
+
end
|
21
20
|
|
21
|
+
extend Forwardable
|
22
22
|
delegate [:run, :exists?, :console, :last_response] => :runner
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
success?
|
38
|
-
end
|
39
|
-
|
40
|
-
def exists?
|
41
|
-
`curl -s -I #{ci_host}/` =~ /\b200 OK\b/
|
42
|
-
end
|
43
|
-
|
44
|
-
def console
|
45
|
-
raw = `curl -s #{ci_host}/lastBuild/console`
|
46
|
-
raw[%r{<pre.*?>(.+)</pre>}m, 1]
|
47
|
-
end
|
48
|
-
|
49
|
-
attr_accessor :last_response
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def get_last_time_elapsed
|
54
|
-
response = `curl -s #{ci_host}/lastStableBuild/api/xml`
|
55
|
-
response.match(/<duration>(\d+)<\/duration>/)
|
56
|
-
$1 ? $1.to_i / 1000 : nil
|
57
|
-
end
|
58
|
-
|
59
|
-
def auth
|
60
|
-
"botandrose:11cc2ba6ef2e43fbfbedc1f466724f6290"
|
61
|
-
end
|
62
|
-
|
63
|
-
def ci_host
|
64
|
-
"http://#{auth}@ci.botandrose.com/job/#{project_name}"
|
65
|
-
end
|
66
|
-
|
67
|
-
def start
|
68
|
-
command = "curl -s -I -X POST -L '#{ci_host}/buildWithParameters?GIT_REF=#{sha}'"
|
69
|
-
output = `#{command}`
|
70
|
-
@queueId = output[%r{Location: .+/queue/item/(\d+)/}, 1].to_i
|
71
|
-
end
|
72
|
-
|
73
|
-
def started?
|
74
|
-
command = "curl -s -g '#{ci_host}/api/json?depth=1&tree=builds[queueId,number]'"
|
75
|
-
output = `#{command}`
|
76
|
-
JSON.parse(output)["builds"][0]["queueId"] == @queueId
|
77
|
-
end
|
78
|
-
|
79
|
-
def job_id
|
80
|
-
@job_id ||= begin
|
81
|
-
output = `curl -s -g '#{ci_host}/api/json?depth=1&tree=builds[queueId,number]'`
|
82
|
-
output[/"number":(\d+),"queueId":#{@queueId}\b/, 1].to_i
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def building?
|
87
|
-
self.last_response = `curl -s #{ci_host}/#{job_id}/api/json?tree=building,result`
|
88
|
-
if last_response.blank?
|
89
|
-
sleep(2) # retry
|
90
|
-
self.last_response = `curl -s #{ci_host}/#{job_id}/api/json?tree=building,result`
|
91
|
-
if last_response.blank?
|
92
|
-
raise "Blank response from CI twice in a row. Aborting!"
|
93
|
-
end
|
24
|
+
private
|
25
|
+
|
26
|
+
def choose_runner_class
|
27
|
+
if local?
|
28
|
+
require_relative "./ci/local"
|
29
|
+
Local
|
30
|
+
else
|
31
|
+
if github_actions?
|
32
|
+
require_relative "./ci/github_actions"
|
33
|
+
GithubActions
|
34
|
+
else
|
35
|
+
require_relative "./ci/jenkins"
|
36
|
+
Jenkins
|
94
37
|
end
|
95
|
-
last_response.include? '"building":true'
|
96
|
-
end
|
97
|
-
|
98
|
-
def success?
|
99
|
-
last_response.include? '"result":"SUCCESS"'
|
100
38
|
end
|
101
39
|
end
|
102
40
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
start_time = Time.new.to_i
|
108
|
-
while building?
|
109
|
-
elapsed_time = Time.new.to_i - start_time
|
110
|
-
yield elapsed_time, nil
|
111
|
-
sleep(2)
|
112
|
-
end
|
113
|
-
|
114
|
-
@stdin.close
|
115
|
-
@console = @stdout_and_stderr.read
|
116
|
-
@stdout_and_stderr.close
|
117
|
-
|
118
|
-
success?
|
119
|
-
end
|
120
|
-
|
121
|
-
def exists?
|
122
|
-
true
|
123
|
-
end
|
124
|
-
|
125
|
-
def console
|
126
|
-
@console
|
127
|
-
end
|
128
|
-
|
129
|
-
attr_accessor :last_response
|
130
|
-
|
131
|
-
private
|
132
|
-
|
133
|
-
def start
|
134
|
-
@stdin, @stdout_and_stderr, @wait_thread = Open3.popen2e("bin/rake ci")
|
135
|
-
end
|
136
|
-
|
137
|
-
def building?
|
138
|
-
![nil, false].include?(@wait_thread.status)
|
139
|
-
end
|
41
|
+
def local?
|
42
|
+
@local
|
43
|
+
end
|
140
44
|
|
141
|
-
|
142
|
-
|
143
|
-
end
|
45
|
+
def github_actions?
|
46
|
+
File.exist?(".github/workflows/ci.yml")
|
144
47
|
end
|
145
48
|
end
|
146
49
|
end
|
data/lib/bard/version.rb
CHANGED
data/lib/bard.rb
CHANGED
@@ -87,7 +87,7 @@ class Bard::CLI < Thor
|
|
87
87
|
method_options %w[verbose -v] => :boolean, %w[local-ci -l] => :boolean
|
88
88
|
desc "ci [BRANCH=HEAD]", "runs ci against BRANCH"
|
89
89
|
def ci branch=Git.current_branch
|
90
|
-
ci = CI.new(project_name,
|
90
|
+
ci = CI.new(project_name, branch, local: options["local-ci"])
|
91
91
|
if ci.exists?
|
92
92
|
puts "Continuous integration: starting build on #{branch}..."
|
93
93
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "bard/ci/github_actions"
|
2
|
+
|
3
|
+
describe Bard::CLI::CI::GithubActions do
|
4
|
+
subject { described_class.new("metrc", "master", "0966308e204b256fdcc11457eb53306d84884c60") }
|
5
|
+
|
6
|
+
xit "works" do
|
7
|
+
subject.run
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Bard::CLI::CI::GithubActions::API do
|
12
|
+
subject { described_class.new("metrc") }
|
13
|
+
|
14
|
+
describe "#last_successful_run" do
|
15
|
+
xit "has #time_elapsed" do
|
16
|
+
subject.last_successful_run.time_elapsed
|
17
|
+
end
|
18
|
+
|
19
|
+
xit "has #console" do
|
20
|
+
subject.last_successful_run.console
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#create_run!" do
|
25
|
+
xit "returns a run" do
|
26
|
+
subject.create_run! "master"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe Bard::CLI::CI::GithubActions::Client do
|
32
|
+
subject { described_class.new("metrc") }
|
33
|
+
end
|
34
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
$LOAD_PATH.unshift
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bard'
|
5
|
-
require 'spec'
|
6
|
-
require 'spec/autorun'
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require "byebug"
|
7
3
|
|
8
|
-
|
9
|
-
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.filter_run focus: true
|
6
|
+
config.run_all_when_everything_filtered = true
|
10
7
|
end
|
8
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":11609506957,"run_id":4276761325,"workflow_name":"ci","head_branch":"master","run_url":"https://api.github.com/repos/botandrose/metrc/actions/runs/4276761325","run_attempt":1,"node_id":"CR_kwDOJCdDdM8AAAACs_sEjQ","head_sha":"0966308e204b256fdcc11457eb53306d84884c60","url":"https://api.github.com/repos/botandrose/metrc/actions/jobs/11609506957","html_url":"https://github.com/botandrose/metrc/actions/runs/4276761325/jobs/7445090560","status":"completed","conclusion":"success","created_at":"2023-02-26T20:18:24Z","started_at":"2023-02-26T20:18:30Z","completed_at":"2023-02-26T20:21:59Z","name":"test","steps":[{"name":"Set up job","status":"completed","conclusion":"success","number":1,"started_at":"2023-02-26T14:18:30.000-06:00","completed_at":"2023-02-26T14:18:31.000-06:00"},{"name":"Set up MySQL","status":"completed","conclusion":"success","number":2,"started_at":"2023-02-26T14:18:31.000-06:00","completed_at":"2023-02-26T14:18:33.000-06:00"},{"name":"Checkout code","status":"completed","conclusion":"success","number":3,"started_at":"2023-02-26T14:18:33.000-06:00","completed_at":"2023-02-26T14:18:34.000-06:00"},{"name":"Install Ruby and gems","status":"completed","conclusion":"success","number":4,"started_at":"2023-02-26T14:18:34.000-06:00","completed_at":"2023-02-26T14:18:42.000-06:00"},{"name":"Dependencies","status":"completed","conclusion":"success","number":5,"started_at":"2023-02-26T14:18:43.000-06:00","completed_at":"2023-02-26T14:18:54.000-06:00"},{"name":"Setup","status":"completed","conclusion":"success","number":6,"started_at":"2023-02-26T14:18:54.000-06:00","completed_at":"2023-02-26T14:19:06.000-06:00"},{"name":"Run tests","status":"completed","conclusion":"success","number":7,"started_at":"2023-02-26T14:19:06.000-06:00","completed_at":"2023-02-26T14:21:58.000-06:00"},{"name":"Post Checkout code","status":"completed","conclusion":"success","number":14,"started_at":"2023-02-26T14:21:58.000-06:00","completed_at":"2023-02-26T14:21:58.000-06:00"},{"name":"Complete job","status":"completed","conclusion":"success","number":15,"started_at":"2023-02-26T14:21:58.000-06:00","completed_at":"2023-02-26T14:21:58.000-06:00"}],"check_run_url":"https://api.github.com/repos/botandrose/metrc/check-runs/11609506957","labels":["ubuntu-20.04"],"runner_id":2,"runner_name":"GitHub Actions 2","runner_group_id":2,"runner_group_name":"GitHub Actions"}
|
@@ -0,0 +1,225 @@
|
|
1
|
+
{
|
2
|
+
"total_count" : 1,
|
3
|
+
"workflow_runs" : [
|
4
|
+
{
|
5
|
+
"actor" : {
|
6
|
+
"avatar_url" : "https://avatars.githubusercontent.com/u/123604709?v=4",
|
7
|
+
"events_url" : "https://api.github.com/users/botandrose-machine/events{/privacy}",
|
8
|
+
"followers_url" : "https://api.github.com/users/botandrose-machine/followers",
|
9
|
+
"following_url" : "https://api.github.com/users/botandrose-machine/following{/other_user}",
|
10
|
+
"gists_url" : "https://api.github.com/users/botandrose-machine/gists{/gist_id}",
|
11
|
+
"gravatar_id" : "",
|
12
|
+
"html_url" : "https://github.com/botandrose-machine",
|
13
|
+
"id" : 123604709,
|
14
|
+
"login" : "botandrose-machine",
|
15
|
+
"node_id" : "U_kgDOB14O5Q",
|
16
|
+
"organizations_url" : "https://api.github.com/users/botandrose-machine/orgs",
|
17
|
+
"received_events_url" : "https://api.github.com/users/botandrose-machine/received_events",
|
18
|
+
"repos_url" : "https://api.github.com/users/botandrose-machine/repos",
|
19
|
+
"site_admin" : false,
|
20
|
+
"starred_url" : "https://api.github.com/users/botandrose-machine/starred{/owner}{/repo}",
|
21
|
+
"subscriptions_url" : "https://api.github.com/users/botandrose-machine/subscriptions",
|
22
|
+
"type" : "User",
|
23
|
+
"url" : "https://api.github.com/users/botandrose-machine"
|
24
|
+
},
|
25
|
+
"artifacts_url" : "https://api.github.com/repos/botandrose/metrc/actions/runs/4276716879/artifacts",
|
26
|
+
"cancel_url" : "https://api.github.com/repos/botandrose/metrc/actions/runs/4276716879/cancel",
|
27
|
+
"check_suite_id" : 11212996078,
|
28
|
+
"check_suite_node_id" : "CS_kwDOJCdDdM8AAAACnFi97g",
|
29
|
+
"check_suite_url" : "https://api.github.com/repos/botandrose/metrc/check-suites/11212996078",
|
30
|
+
"conclusion" : null,
|
31
|
+
"created_at" : "2023-02-26T20:07:23Z",
|
32
|
+
"display_title" : "ci",
|
33
|
+
"event" : "workflow_dispatch",
|
34
|
+
"head_branch" : "master",
|
35
|
+
"head_commit" : {
|
36
|
+
"author" : {
|
37
|
+
"email" : "micah@botandrose.com",
|
38
|
+
"name" : "Micah Geisel"
|
39
|
+
},
|
40
|
+
"committer" : {
|
41
|
+
"email" : "micah@botandrose.com",
|
42
|
+
"name" : "Micah Geisel"
|
43
|
+
},
|
44
|
+
"id" : "0966308e204b256fdcc11457eb53306d84884c60",
|
45
|
+
"message" : "rename action.",
|
46
|
+
"timestamp" : "2023-02-25T21:48:15Z",
|
47
|
+
"tree_id" : "1bc3e4e847c2e582821b10ad705a6d2595efc5db"
|
48
|
+
},
|
49
|
+
"head_repository" : {
|
50
|
+
"archive_url" : "https://api.github.com/repos/botandrose/metrc/{archive_format}{/ref}",
|
51
|
+
"assignees_url" : "https://api.github.com/repos/botandrose/metrc/assignees{/user}",
|
52
|
+
"blobs_url" : "https://api.github.com/repos/botandrose/metrc/git/blobs{/sha}",
|
53
|
+
"branches_url" : "https://api.github.com/repos/botandrose/metrc/branches{/branch}",
|
54
|
+
"collaborators_url" : "https://api.github.com/repos/botandrose/metrc/collaborators{/collaborator}",
|
55
|
+
"comments_url" : "https://api.github.com/repos/botandrose/metrc/comments{/number}",
|
56
|
+
"commits_url" : "https://api.github.com/repos/botandrose/metrc/commits{/sha}",
|
57
|
+
"compare_url" : "https://api.github.com/repos/botandrose/metrc/compare/{base}...{head}",
|
58
|
+
"contents_url" : "https://api.github.com/repos/botandrose/metrc/contents/{+path}",
|
59
|
+
"contributors_url" : "https://api.github.com/repos/botandrose/metrc/contributors",
|
60
|
+
"deployments_url" : "https://api.github.com/repos/botandrose/metrc/deployments",
|
61
|
+
"description" : null,
|
62
|
+
"downloads_url" : "https://api.github.com/repos/botandrose/metrc/downloads",
|
63
|
+
"events_url" : "https://api.github.com/repos/botandrose/metrc/events",
|
64
|
+
"fork" : false,
|
65
|
+
"forks_url" : "https://api.github.com/repos/botandrose/metrc/forks",
|
66
|
+
"full_name" : "botandrose/metrc",
|
67
|
+
"git_commits_url" : "https://api.github.com/repos/botandrose/metrc/git/commits{/sha}",
|
68
|
+
"git_refs_url" : "https://api.github.com/repos/botandrose/metrc/git/refs{/sha}",
|
69
|
+
"git_tags_url" : "https://api.github.com/repos/botandrose/metrc/git/tags{/sha}",
|
70
|
+
"hooks_url" : "https://api.github.com/repos/botandrose/metrc/hooks",
|
71
|
+
"html_url" : "https://github.com/botandrose/metrc",
|
72
|
+
"id" : 606552948,
|
73
|
+
"issue_comment_url" : "https://api.github.com/repos/botandrose/metrc/issues/comments{/number}",
|
74
|
+
"issue_events_url" : "https://api.github.com/repos/botandrose/metrc/issues/events{/number}",
|
75
|
+
"issues_url" : "https://api.github.com/repos/botandrose/metrc/issues{/number}",
|
76
|
+
"keys_url" : "https://api.github.com/repos/botandrose/metrc/keys{/key_id}",
|
77
|
+
"labels_url" : "https://api.github.com/repos/botandrose/metrc/labels{/name}",
|
78
|
+
"languages_url" : "https://api.github.com/repos/botandrose/metrc/languages",
|
79
|
+
"merges_url" : "https://api.github.com/repos/botandrose/metrc/merges",
|
80
|
+
"milestones_url" : "https://api.github.com/repos/botandrose/metrc/milestones{/number}",
|
81
|
+
"name" : "metrc",
|
82
|
+
"node_id" : "R_kgDOJCdDdA",
|
83
|
+
"notifications_url" : "https://api.github.com/repos/botandrose/metrc/notifications{?since,all,participating}",
|
84
|
+
"owner" : {
|
85
|
+
"avatar_url" : "https://avatars.githubusercontent.com/u/17391?v=4",
|
86
|
+
"events_url" : "https://api.github.com/users/botandrose/events{/privacy}",
|
87
|
+
"followers_url" : "https://api.github.com/users/botandrose/followers",
|
88
|
+
"following_url" : "https://api.github.com/users/botandrose/following{/other_user}",
|
89
|
+
"gists_url" : "https://api.github.com/users/botandrose/gists{/gist_id}",
|
90
|
+
"gravatar_id" : "",
|
91
|
+
"html_url" : "https://github.com/botandrose",
|
92
|
+
"id" : 17391,
|
93
|
+
"login" : "botandrose",
|
94
|
+
"node_id" : "MDQ6VXNlcjE3Mzkx",
|
95
|
+
"organizations_url" : "https://api.github.com/users/botandrose/orgs",
|
96
|
+
"received_events_url" : "https://api.github.com/users/botandrose/received_events",
|
97
|
+
"repos_url" : "https://api.github.com/users/botandrose/repos",
|
98
|
+
"site_admin" : false,
|
99
|
+
"starred_url" : "https://api.github.com/users/botandrose/starred{/owner}{/repo}",
|
100
|
+
"subscriptions_url" : "https://api.github.com/users/botandrose/subscriptions",
|
101
|
+
"type" : "User",
|
102
|
+
"url" : "https://api.github.com/users/botandrose"
|
103
|
+
},
|
104
|
+
"private" : true,
|
105
|
+
"pulls_url" : "https://api.github.com/repos/botandrose/metrc/pulls{/number}",
|
106
|
+
"releases_url" : "https://api.github.com/repos/botandrose/metrc/releases{/id}",
|
107
|
+
"stargazers_url" : "https://api.github.com/repos/botandrose/metrc/stargazers",
|
108
|
+
"statuses_url" : "https://api.github.com/repos/botandrose/metrc/statuses/{sha}",
|
109
|
+
"subscribers_url" : "https://api.github.com/repos/botandrose/metrc/subscribers",
|
110
|
+
"subscription_url" : "https://api.github.com/repos/botandrose/metrc/subscription",
|
111
|
+
"tags_url" : "https://api.github.com/repos/botandrose/metrc/tags",
|
112
|
+
"teams_url" : "https://api.github.com/repos/botandrose/metrc/teams",
|
113
|
+
"trees_url" : "https://api.github.com/repos/botandrose/metrc/git/trees{/sha}",
|
114
|
+
"url" : "https://api.github.com/repos/botandrose/metrc"
|
115
|
+
},
|
116
|
+
"head_sha" : "0966308e204b256fdcc11457eb53306d84884c60",
|
117
|
+
"html_url" : "https://github.com/botandrose/metrc/actions/runs/4276716879",
|
118
|
+
"id" : 4276716879,
|
119
|
+
"jobs_url" : "https://api.github.com/repos/botandrose/metrc/actions/runs/4276716879/jobs",
|
120
|
+
"logs_url" : "https://api.github.com/repos/botandrose/metrc/actions/runs/4276716879/logs",
|
121
|
+
"name" : "ci",
|
122
|
+
"node_id" : "WFR_kwLOJCdDdM7-6YVP",
|
123
|
+
"path" : ".github/workflows/ci.yml",
|
124
|
+
"previous_attempt_url" : null,
|
125
|
+
"pull_requests" : [],
|
126
|
+
"referenced_workflows" : [],
|
127
|
+
"repository" : {
|
128
|
+
"archive_url" : "https://api.github.com/repos/botandrose/metrc/{archive_format}{/ref}",
|
129
|
+
"assignees_url" : "https://api.github.com/repos/botandrose/metrc/assignees{/user}",
|
130
|
+
"blobs_url" : "https://api.github.com/repos/botandrose/metrc/git/blobs{/sha}",
|
131
|
+
"branches_url" : "https://api.github.com/repos/botandrose/metrc/branches{/branch}",
|
132
|
+
"collaborators_url" : "https://api.github.com/repos/botandrose/metrc/collaborators{/collaborator}",
|
133
|
+
"comments_url" : "https://api.github.com/repos/botandrose/metrc/comments{/number}",
|
134
|
+
"commits_url" : "https://api.github.com/repos/botandrose/metrc/commits{/sha}",
|
135
|
+
"compare_url" : "https://api.github.com/repos/botandrose/metrc/compare/{base}...{head}",
|
136
|
+
"contents_url" : "https://api.github.com/repos/botandrose/metrc/contents/{+path}",
|
137
|
+
"contributors_url" : "https://api.github.com/repos/botandrose/metrc/contributors",
|
138
|
+
"deployments_url" : "https://api.github.com/repos/botandrose/metrc/deployments",
|
139
|
+
"description" : null,
|
140
|
+
"downloads_url" : "https://api.github.com/repos/botandrose/metrc/downloads",
|
141
|
+
"events_url" : "https://api.github.com/repos/botandrose/metrc/events",
|
142
|
+
"fork" : false,
|
143
|
+
"forks_url" : "https://api.github.com/repos/botandrose/metrc/forks",
|
144
|
+
"full_name" : "botandrose/metrc",
|
145
|
+
"git_commits_url" : "https://api.github.com/repos/botandrose/metrc/git/commits{/sha}",
|
146
|
+
"git_refs_url" : "https://api.github.com/repos/botandrose/metrc/git/refs{/sha}",
|
147
|
+
"git_tags_url" : "https://api.github.com/repos/botandrose/metrc/git/tags{/sha}",
|
148
|
+
"hooks_url" : "https://api.github.com/repos/botandrose/metrc/hooks",
|
149
|
+
"html_url" : "https://github.com/botandrose/metrc",
|
150
|
+
"id" : 606552948,
|
151
|
+
"issue_comment_url" : "https://api.github.com/repos/botandrose/metrc/issues/comments{/number}",
|
152
|
+
"issue_events_url" : "https://api.github.com/repos/botandrose/metrc/issues/events{/number}",
|
153
|
+
"issues_url" : "https://api.github.com/repos/botandrose/metrc/issues{/number}",
|
154
|
+
"keys_url" : "https://api.github.com/repos/botandrose/metrc/keys{/key_id}",
|
155
|
+
"labels_url" : "https://api.github.com/repos/botandrose/metrc/labels{/name}",
|
156
|
+
"languages_url" : "https://api.github.com/repos/botandrose/metrc/languages",
|
157
|
+
"merges_url" : "https://api.github.com/repos/botandrose/metrc/merges",
|
158
|
+
"milestones_url" : "https://api.github.com/repos/botandrose/metrc/milestones{/number}",
|
159
|
+
"name" : "metrc",
|
160
|
+
"node_id" : "R_kgDOJCdDdA",
|
161
|
+
"notifications_url" : "https://api.github.com/repos/botandrose/metrc/notifications{?since,all,participating}",
|
162
|
+
"owner" : {
|
163
|
+
"avatar_url" : "https://avatars.githubusercontent.com/u/17391?v=4",
|
164
|
+
"events_url" : "https://api.github.com/users/botandrose/events{/privacy}",
|
165
|
+
"followers_url" : "https://api.github.com/users/botandrose/followers",
|
166
|
+
"following_url" : "https://api.github.com/users/botandrose/following{/other_user}",
|
167
|
+
"gists_url" : "https://api.github.com/users/botandrose/gists{/gist_id}",
|
168
|
+
"gravatar_id" : "",
|
169
|
+
"html_url" : "https://github.com/botandrose",
|
170
|
+
"id" : 17391,
|
171
|
+
"login" : "botandrose",
|
172
|
+
"node_id" : "MDQ6VXNlcjE3Mzkx",
|
173
|
+
"organizations_url" : "https://api.github.com/users/botandrose/orgs",
|
174
|
+
"received_events_url" : "https://api.github.com/users/botandrose/received_events",
|
175
|
+
"repos_url" : "https://api.github.com/users/botandrose/repos",
|
176
|
+
"site_admin" : false,
|
177
|
+
"starred_url" : "https://api.github.com/users/botandrose/starred{/owner}{/repo}",
|
178
|
+
"subscriptions_url" : "https://api.github.com/users/botandrose/subscriptions",
|
179
|
+
"type" : "User",
|
180
|
+
"url" : "https://api.github.com/users/botandrose"
|
181
|
+
},
|
182
|
+
"private" : true,
|
183
|
+
"pulls_url" : "https://api.github.com/repos/botandrose/metrc/pulls{/number}",
|
184
|
+
"releases_url" : "https://api.github.com/repos/botandrose/metrc/releases{/id}",
|
185
|
+
"stargazers_url" : "https://api.github.com/repos/botandrose/metrc/stargazers",
|
186
|
+
"statuses_url" : "https://api.github.com/repos/botandrose/metrc/statuses/{sha}",
|
187
|
+
"subscribers_url" : "https://api.github.com/repos/botandrose/metrc/subscribers",
|
188
|
+
"subscription_url" : "https://api.github.com/repos/botandrose/metrc/subscription",
|
189
|
+
"tags_url" : "https://api.github.com/repos/botandrose/metrc/tags",
|
190
|
+
"teams_url" : "https://api.github.com/repos/botandrose/metrc/teams",
|
191
|
+
"trees_url" : "https://api.github.com/repos/botandrose/metrc/git/trees{/sha}",
|
192
|
+
"url" : "https://api.github.com/repos/botandrose/metrc"
|
193
|
+
},
|
194
|
+
"rerun_url" : "https://api.github.com/repos/botandrose/metrc/actions/runs/4276716879/rerun",
|
195
|
+
"run_attempt" : 1,
|
196
|
+
"run_number" : 11,
|
197
|
+
"run_started_at" : "2023-02-26T20:07:23Z",
|
198
|
+
"status" : "in_progress",
|
199
|
+
"triggering_actor" : {
|
200
|
+
"avatar_url" : "https://avatars.githubusercontent.com/u/123604709?v=4",
|
201
|
+
"events_url" : "https://api.github.com/users/botandrose-machine/events{/privacy}",
|
202
|
+
"followers_url" : "https://api.github.com/users/botandrose-machine/followers",
|
203
|
+
"following_url" : "https://api.github.com/users/botandrose-machine/following{/other_user}",
|
204
|
+
"gists_url" : "https://api.github.com/users/botandrose-machine/gists{/gist_id}",
|
205
|
+
"gravatar_id" : "",
|
206
|
+
"html_url" : "https://github.com/botandrose-machine",
|
207
|
+
"id" : 123604709,
|
208
|
+
"login" : "botandrose-machine",
|
209
|
+
"node_id" : "U_kgDOB14O5Q",
|
210
|
+
"organizations_url" : "https://api.github.com/users/botandrose-machine/orgs",
|
211
|
+
"received_events_url" : "https://api.github.com/users/botandrose-machine/received_events",
|
212
|
+
"repos_url" : "https://api.github.com/users/botandrose-machine/repos",
|
213
|
+
"site_admin" : false,
|
214
|
+
"starred_url" : "https://api.github.com/users/botandrose-machine/starred{/owner}{/repo}",
|
215
|
+
"subscriptions_url" : "https://api.github.com/users/botandrose-machine/subscriptions",
|
216
|
+
"type" : "User",
|
217
|
+
"url" : "https://api.github.com/users/botandrose-machine"
|
218
|
+
},
|
219
|
+
"updated_at" : "2023-02-26T20:07:31Z",
|
220
|
+
"url" : "https://api.github.com/repos/botandrose/metrc/actions/runs/4276716879",
|
221
|
+
"workflow_id" : 49490118,
|
222
|
+
"workflow_url" : "https://api.github.com/repos/botandrose/metrc/actions/workflows/49490118"
|
223
|
+
}
|
224
|
+
]
|
225
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.48.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -118,6 +118,7 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- ".gitignore"
|
120
120
|
- ".gitmodules"
|
121
|
+
- ".rspec"
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE
|
123
124
|
- README.rdoc
|
@@ -147,12 +148,18 @@ files:
|
|
147
148
|
- lib/bard.rb
|
148
149
|
- lib/bard/base.rb
|
149
150
|
- lib/bard/ci.rb
|
151
|
+
- lib/bard/ci/github_actions.rb
|
152
|
+
- lib/bard/ci/jenkins.rb
|
153
|
+
- lib/bard/ci/local.rb
|
150
154
|
- lib/bard/config.rb
|
151
155
|
- lib/bard/data.rb
|
152
156
|
- lib/bard/git.rb
|
153
157
|
- lib/bard/version.rb
|
158
|
+
- spec/bard/ci/github_actions_spec.rb
|
154
159
|
- spec/bard_spec.rb
|
155
160
|
- spec/spec_helper.rb
|
161
|
+
- spec/support/fixtures/job.json
|
162
|
+
- spec/support/fixtures/response_in_progress.json
|
156
163
|
homepage: http://github.com/botandrose/bard
|
157
164
|
licenses:
|
158
165
|
- MIT
|
@@ -189,5 +196,8 @@ test_files:
|
|
189
196
|
- features/support/env.rb
|
190
197
|
- features/support/grit_ext.rb
|
191
198
|
- features/support/io.rb
|
199
|
+
- spec/bard/ci/github_actions_spec.rb
|
192
200
|
- spec/bard_spec.rb
|
193
201
|
- spec/spec_helper.rb
|
202
|
+
- spec/support/fixtures/job.json
|
203
|
+
- spec/support/fixtures/response_in_progress.json
|