ci_toolkit 1.2.5 → 1.2.9
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ci_toolkit/bitrise_client.rb +14 -13
- data/lib/ci_toolkit/version.rb +1 -1
- 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: b4bfe956c92fad69ac062c30ab70aa5577d63cbdcab7f8e4ffb1d36bae851f2d
|
4
|
+
data.tar.gz: '087c4b667f9c79307132d6c26c34d4e08a3960b4ff9c2c3ab7c5b62477e5fee0'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 163a4bd2abb17fd25a69de5dbc78e32ce032817d5e2d6cca898a7a7c24f60048c49598f5558e06bff0bcfd455cd55813e6cd733a0735584d1f11a9a9cbe3e03e
|
7
|
+
data.tar.gz: 82decc260cc2080262bb2c67ab372fca9a2b79e8be03267039c743beeda9e4070bc5f88a8a37b24be0e09601ac4f41da92d16ccde53f00e97c2d668c8ed74463
|
data/Gemfile.lock
CHANGED
@@ -9,12 +9,18 @@ module CiToolkit
|
|
9
9
|
API_VERSION = "v0.1"
|
10
10
|
attr_reader :connection
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
# noinspection Metrics/ParameterLists
|
13
|
+
def initialize(options = {
|
14
|
+
build_number: ENV["BITRISE_BUILD_NUMBER"],
|
15
|
+
token: ENV["BITRISE_TOKEN"],
|
16
|
+
app_slug: ENV["BITRISE_APP_SLUG"]
|
17
|
+
},
|
18
|
+
faraday = nil)
|
19
|
+
@build_number = options[:build_number].to_i
|
20
|
+
@token = options[:token]
|
21
|
+
@app_slug = options[:app_slug]
|
15
22
|
@connection = faraday
|
16
23
|
configure_connection
|
17
|
-
@connection&.use Faraday::Response::Logger, nil, { headers: true, bodies: true }
|
18
24
|
end
|
19
25
|
|
20
26
|
def configure_connection
|
@@ -26,8 +32,8 @@ module CiToolkit
|
|
26
32
|
)
|
27
33
|
@connection.use Faraday::Request::UrlEncoded
|
28
34
|
@connection.use Faraday::Request::Retry
|
29
|
-
@connection.use FaradayMiddleware::ParseJson
|
30
35
|
@connection.use FaradayMiddleware::EncodeJson
|
36
|
+
@connection.use FaradayMiddleware::ParseJson
|
31
37
|
@connection.use FaradayMiddleware::FollowRedirects
|
32
38
|
end
|
33
39
|
|
@@ -46,7 +52,7 @@ module CiToolkit
|
|
46
52
|
|
47
53
|
def abort_pull_request_builds(pull_request, branch, commit)
|
48
54
|
find_pull_request_builds(pull_request, branch, commit).each do |build|
|
49
|
-
@connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build[
|
55
|
+
@connection&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
|
50
56
|
abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
|
51
57
|
})
|
52
58
|
end
|
@@ -58,17 +64,12 @@ module CiToolkit
|
|
58
64
|
pull_request_id: pull_request.to_i,
|
59
65
|
status: 0 # status: 0 == not finished
|
60
66
|
})
|
61
|
-
|
62
|
-
puts response.inspect
|
63
|
-
|
64
|
-
builds = response.body[:data]
|
67
|
+
builds = response.body["data"]
|
65
68
|
filter_builds_by_commit(builds, commit)
|
66
69
|
end
|
67
70
|
|
68
71
|
def filter_builds_by_commit(builds, commit)
|
69
|
-
|
70
|
-
puts builds.inspect
|
71
|
-
builds&.select! { |build| build[:commit_hash] == commit }
|
72
|
+
builds&.select! { |build| build["commit_hash"] == commit && build["build_number"] != @build_number }
|
72
73
|
builds || []
|
73
74
|
end
|
74
75
|
end
|
data/lib/ci_toolkit/version.rb
CHANGED