ci_toolkit 1.4.7 → 1.4.11

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: 6199cf52e7358b43cedcaff8b1e7791d4b63c8f16053f0573966a662c7f9de45
4
- data.tar.gz: 109591a5daa0fc7c04c7cac5a18fe7a38afc1377f458b4b1f110c8b4a884f1b0
3
+ metadata.gz: ee76db372a182e446e5eded76144c48168dd732698ceadf6aed9786a4170f7df
4
+ data.tar.gz: eabd9e5d140b76dee0d8e09e53932bec6ef78d453521b5202028b9192b4f5f00
5
5
  SHA512:
6
- metadata.gz: 0fae6e88e169e051ce3ebf6a54a1a72935eb0775b51ef9fe5e3e9319febb9bbe42e60e4bea6ba88c4c676cf3235bca16a036ab2496985c60a6ce97ebbf64f769
7
- data.tar.gz: a2f2cf45f97253c56070d484adf1ad3f27cabf7bf44f10c4923b26a27373fd96f0c8e0b5d7e33d2762c954b18198a3349d09e84b8d3f0455247db59a52c17614
6
+ metadata.gz: 99d30cd39b55b0ab6f08a726d233a9d5e9edbedf35f2807191bac3b77c131b2214f3f393acd714ec5c38f578e38f7e05defefb4ec41cc4dd783ada9bd4bae6f4
7
+ data.tar.gz: 719c0db775f877d3fb72a728a63b7bd9fe7eb9beb227b9816198aed4a0e9a75832c1038bbe07aa5cab9aba9d3c7eb8845023ea2b984aec41c25ed07858824547
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.4.7)
4
+ ci_toolkit (1.4.11)
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
@@ -46,9 +50,5 @@ module CiToolkit
46
50
  build_counter = description[%r{(\d/\d)}] || "0/0"
47
51
  { num_finished: build_counter.split("/")[0].to_i, num_total: build_counter.split("/")[1].to_i }
48
52
  end
49
-
50
- def error
51
- @github.create_status("error", @context, @env.app_url, "Building failed")
52
- end
53
53
  end
54
54
  end
@@ -9,7 +9,7 @@ module CiToolkit
9
9
  end
10
10
 
11
11
  def latest_tag
12
- describe = "git describe --abbrev=0"
12
+ describe = "git describe --tags --abbrev=0"
13
13
  return `#{describe}`.gsub("\n", "") unless @dir
14
14
 
15
15
  `cd #{@dir} && #{describe}`.gsub("\n", "")
@@ -12,9 +12,9 @@ module CiToolkit
12
12
  end
13
13
 
14
14
  def for_new_build(name, version_name, tag)
15
- "#### New `#{name}` build deployed 🚀\nVersion **#{version_name}** with
16
- build number **#{@build.number}** on tag **#{tag}** deployed
17
- from [this](#{@build.url}) build"
15
+ "#### New `#{name}` build deployed 🚀\nVersion **#{version_name}** with\
16
+ build number **#{@build.number}** on tag **#{tag}** deployed\
17
+ from [this](#{@build.url}) build"
18
18
  end
19
19
 
20
20
  def for_build_failure(reason)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2021-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday