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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e409eaa7ab86b7af7a1e20cd9808ad0eeb2dcee9ac912296ec0dfe77605760a1
4
- data.tar.gz: d79386299cd1910016581a0569896b8b62ac48ce0106493e39524ecb726d80d7
3
+ metadata.gz: 938a4dcc442b46bc5d98c53185a580047373c8f61db4f810c38b3109a418634c
4
+ data.tar.gz: 8a16209aaa97fc0368e39d6e61f4c645f1195187c6f206e9b3e2c10f0e5323b6
5
5
  SHA512:
6
- metadata.gz: 4f377bf2e70d5cb2b73c39aeb2c4960a9be499c0b730727d316e526283659dc2ff0f0583053495d3bce97e9f5f9766a5f0890a643f409076296999481269c0ac
7
- data.tar.gz: 1806fb69f7a1e003118e89498fb09c81d5fe8748d548ab54517ee70ffc564f258caf21f1913453d5a06467566364bb518a78d9b07b9bd93b64684f296d3e1595
6
+ metadata.gz: 53a7cdf718680bb99a11d3398711c0a4f3df2b2a8d01434d79ef78b99f4a195b63917c10596f9c4874966655fee213cc4ddbfb9adf0001dd941d2456bf41ab92
7
+ data.tar.gz: bb209944bd1979e80be2ce97ff04ac06b94880751ffac8c25eea8715beb8a0c3d6c51d6a39444384546eeaf3dc42b52136ac8a75dfe913b376467e476d611b36
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.3.13)
4
+ ci_toolkit (1.3.14)
5
5
  faraday
6
6
  faraday_middleware
7
7
  jwt
@@ -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 configure_connection
27
- return unless @connection.nil?
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
- @connection.use Faraday::Request::UrlEncoded
34
- @connection.use Faraday::Request::Retry
35
- @connection.use FaradayMiddleware::EncodeJson
36
- @connection.use FaradayMiddleware::ParseJson
37
- @connection.use FaradayMiddleware::FollowRedirects
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&.post("/#{API_VERSION}/apps/#{@app_slug}/builds", {
42
- hook_info: { type: "bitrise" },
43
- build_params: {
44
- branch: branch,
45
- branch_dest: "develop",
46
- pull_request_id: pull_request,
47
- workflow_id: workflow,
48
- commit_hash: commit
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&.post("/#{API_VERSION}/apps/#{@app_slug}/builds/#{build["slug"]}/abort", {
56
- abort_reason: "Aborting due to other build failed for pull request #{pull_request}"
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&.get("/#{API_VERSION}/apps/#{@app_slug}/builds", {
63
- branch: branch,
64
- pull_request_id: pull_request.to_i,
65
- status: 0 # status: 0 == not finished
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CiToolkit
4
- VERSION = "1.3.13"
4
+ VERSION = "1.3.14"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.13
4
+ version: 1.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller