ci_toolkit 1.3.13 → 1.3.14
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 +28 -29
- 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: 938a4dcc442b46bc5d98c53185a580047373c8f61db4f810c38b3109a418634c
|
4
|
+
data.tar.gz: 8a16209aaa97fc0368e39d6e61f4c645f1195187c6f206e9b3e2c10f0e5323b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53a7cdf718680bb99a11d3398711c0a4f3df2b2a8d01434d79ef78b99f4a195b63917c10596f9c4874966655fee213cc4ddbfb9adf0001dd941d2456bf41ab92
|
7
|
+
data.tar.gz: bb209944bd1979e80be2ce97ff04ac06b94880751ffac8c25eea8715beb8a0c3d6c51d6a39444384546eeaf3dc42b52136ac8a75dfe913b376467e476d611b36
|
data/Gemfile.lock
CHANGED
@@ -19,51 +19,50 @@ module CiToolkit
|
|
19
19
|
@build_number = options[:build_number].to_i
|
20
20
|
@token = options[:token]
|
21
21
|
@app_slug = options[:app_slug]
|
22
|
-
@connection = faraday
|
23
|
-
configure_connection
|
22
|
+
@connection = faraday || create_connection
|
24
23
|
end
|
25
24
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
@connection = Faraday.new(
|
25
|
+
def create_connection
|
26
|
+
connection = Faraday.new(
|
30
27
|
url: "https://api.bitrise.io",
|
31
28
|
headers: { "Content-Type" => "application/json", "Authorization" => @token }
|
32
29
|
)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
connection.use Faraday::Request::UrlEncoded
|
31
|
+
connection.use Faraday::Request::Retry
|
32
|
+
connection.use FaradayMiddleware::EncodeJson
|
33
|
+
connection.use FaradayMiddleware::ParseJson
|
34
|
+
connection.use FaradayMiddleware::FollowRedirects
|
35
|
+
|
36
|
+
connection
|
38
37
|
end
|
39
38
|
|
40
39
|
def create_pull_request_build(pull_request, branch, commit, workflow)
|
41
|
-
@connection
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
@connection.post("/#{API_VERSION}/apps/#{@app_slug}/builds", {
|
41
|
+
hook_info: { type: "bitrise" },
|
42
|
+
build_params: {
|
43
|
+
branch: branch,
|
44
|
+
branch_dest: "develop",
|
45
|
+
pull_request_id: pull_request,
|
46
|
+
workflow_id: workflow,
|
47
|
+
commit_hash: commit
|
48
|
+
}
|
49
|
+
})
|
51
50
|
end
|
52
51
|
|
53
52
|
def abort_pull_request_builds(pull_request, branch, commit)
|
54
53
|
find_pull_request_builds(pull_request, branch, commit).each do |build|
|
55
|
-
@connection
|
56
|
-
|
57
|
-
|
54
|
+
@connection.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
|
55
|
+
abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
|
56
|
+
})
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
60
|
def find_pull_request_builds(pull_request, branch, commit)
|
62
|
-
response = @connection
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
response = @connection.get("/#{API_VERSION}/apps/#{@app_slug}/builds", {
|
62
|
+
branch: branch,
|
63
|
+
pull_request_id: pull_request.to_i,
|
64
|
+
status: 0 # status: 0 == not finished
|
65
|
+
})
|
67
66
|
builds = response.body["data"]
|
68
67
|
filter_builds_by_commit(builds, commit)
|
69
68
|
end
|
data/lib/ci_toolkit/version.rb
CHANGED