ci_toolkit 1.4.6 → 1.4.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1320423167926b24a3e18e6169e0a935d3792b4c21c078d0c9280c9fae64867a
4
- data.tar.gz: fd6ea1bd10b7bb08a6f392ad98160c936720714b52a7f42ffbb6e2286bd0375d
3
+ metadata.gz: 7371de80b471de673b131fa838cb38cb9c9f6361e5d6fba1d3a6fa3314232e79
4
+ data.tar.gz: 9c075475b68c153d3c3bc53d98d12b41c7fc85a5873e08e659cb244806ba46d7
5
5
  SHA512:
6
- metadata.gz: 31cb072083356b8b54e2e88fa89de03f4dfb59436460dae4f47eea6c956e5926b2047194b9fef5b7ee674228f8cb9a849af3b05ab44c0ed6388b1fe1966e4d8f
7
- data.tar.gz: b63cf0c00f21a0662fb68150137d5ec127a047bb257b4bf7ae9ff47fbe717323eb5f482f81dc3599559db1dbdb1a48ca23651e192418ac49bb19d826307d8a64
6
+ metadata.gz: 2c289294623da50cf5c2031d8bc3042c99cc288ed257d9e1947d2c7686d95673d264bd292314d951b7c586dfece8a0d56f51d842f184b42851aa7b96466463f9
7
+ data.tar.gz: 814afb20a770507d932339180d62cbc0dd58ee88d690bf1a5852e4b3679e999de16e272937494949121d496e89cc56f5d31c16e76b66b4c062d7ecf72fcac071
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.4.6)
4
+ ci_toolkit (1.4.10)
5
5
  faraday
6
6
  faraday_middleware
7
7
  jwt
@@ -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
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.4.6
4
+ version: 1.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller