ci_toolkit 1.4.6 → 1.4.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ci_toolkit/bitrise_client.rb +10 -5
- data/lib/ci_toolkit/build_status.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7371de80b471de673b131fa838cb38cb9c9f6361e5d6fba1d3a6fa3314232e79
|
4
|
+
data.tar.gz: 9c075475b68c153d3c3bc53d98d12b41c7fc85a5873e08e659cb244806ba46d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c289294623da50cf5c2031d8bc3042c99cc288ed257d9e1947d2c7686d95673d264bd292314d951b7c586dfece8a0d56f51d842f184b42851aa7b96466463f9
|
7
|
+
data.tar.gz: 814afb20a770507d932339180d62cbc0dd58ee88d690bf1a5852e4b3679e999de16e272937494949121d496e89cc56f5d31c16e76b66b4c062d7ecf72fcac071
|
data/Gemfile.lock
CHANGED
@@ -13,12 +13,14 @@ module CiToolkit
|
|
13
13
|
def initialize(options = {
|
14
14
|
build_number: ENV["BITRISE_BUILD_NUMBER"],
|
15
15
|
token: ENV["BITRISE_TOKEN"],
|
16
|
-
app_slug: ENV["BITRISE_APP_SLUG"]
|
16
|
+
app_slug: ENV["BITRISE_APP_SLUG"],
|
17
|
+
build_slug: ENV["BITRISE_BUILD_SLUG"]
|
17
18
|
},
|
18
19
|
faraday = nil)
|
19
20
|
@build_number = options[:build_number].to_i
|
20
21
|
@token = options[:token]
|
21
22
|
@app_slug = options[:app_slug]
|
23
|
+
@build_slug = options[:build_slug]
|
22
24
|
@connection = faraday || create_connection
|
23
25
|
end
|
24
26
|
|
@@ -49,22 +51,25 @@ module CiToolkit
|
|
49
51
|
})
|
50
52
|
end
|
51
53
|
|
52
|
-
def abort_pull_request_builds(pull_request, branch, commit)
|
54
|
+
def abort_pull_request_builds(pull_request, branch, commit = nil)
|
53
55
|
find_pull_request_builds(pull_request, branch, commit).each do |build|
|
56
|
+
next if build["slug"] == @build_slug
|
57
|
+
|
54
58
|
@connection.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
|
55
59
|
abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
|
56
60
|
})
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
60
|
-
def find_pull_request_builds(pull_request, branch, commit)
|
64
|
+
def find_pull_request_builds(pull_request, branch, commit = nil)
|
61
65
|
response = @connection.get("/#{API_VERSION}/apps/#{@app_slug}/builds", {
|
62
66
|
branch: branch,
|
63
67
|
pull_request_id: pull_request.to_i,
|
64
68
|
status: 0 # status: 0 == not finished
|
65
69
|
})
|
66
|
-
builds = response.body["data"]
|
67
|
-
filter_builds_by_commit(builds, commit)
|
70
|
+
builds = response.body["data"] || []
|
71
|
+
builds = filter_builds_by_commit(builds, commit) unless commit.nil?
|
72
|
+
builds
|
68
73
|
end
|
69
74
|
|
70
75
|
def filter_builds_by_commit(builds, commit)
|
@@ -36,6 +36,10 @@ module CiToolkit
|
|
36
36
|
@github.create_status(state, @context, @env.app_url, "Finished building #{num_finished}/#{num_total}")
|
37
37
|
end
|
38
38
|
|
39
|
+
def error
|
40
|
+
@github.create_status("error", @context, @env.app_url, "Building failed")
|
41
|
+
end
|
42
|
+
|
39
43
|
private
|
40
44
|
|
41
45
|
def load_counter
|