ci_toolkit 1.4.8 → 1.4.12

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: 910885b713c894576eec434ed74390a2515fd052757cbe3f88dd6a2f57b7566d
4
- data.tar.gz: e12d83ad28862c5c3db7598eebfd5d2d15e6154aa240a14517b1b4661c56d604
3
+ metadata.gz: cf57d831af4f6cf35645bf6badfa46e4e5c4a248b71073e913c7b00d916d9e29
4
+ data.tar.gz: '0178662a1ea410b9dd1b653a5da8c7afd9230825e51b3f8da3f57e857d925907'
5
5
  SHA512:
6
- metadata.gz: 1c45cca7b322bc882da4610b9ce9d7aea7a68a9f5ed1d1a1c14576e51bc4e4a75313895d10f2298f03202e00bbd4e2baecb3b65fb73c0441efbea7abc5a2a740
7
- data.tar.gz: 8c9efef28981894104b2bed2608a55a7b8aa446844cff5c6158fb58568c5f4ba9a21f1603d6365a25314d4ab6769d447bbaffe6e08a95101100eb630f606cb70
6
+ metadata.gz: 37b8173921e346aaeb9cf254ed372d239abd5a23b53f0357139ad85876c3f5d9f832d60cde27046a343302e3d1eca766c8a819580af8c2c5cc1235c9d8a68716
7
+ data.tar.gz: 2abe3d539e171cafdea9fce063300ef331e7be7c96fa50c56b437d51588019a8c30ece24c5bb5b4236176814e81481317c9adbf291f9cac18d115c522c5557fb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.4.8)
4
+ ci_toolkit (1.4.12)
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)
@@ -50,9 +50,9 @@ release branch with semantic versioning, eg. release/x.y.z"
50
50
  end
51
51
 
52
52
  def tag_name(build_number = nil)
53
- return "#{version}-build.#{build_number}" if build_number
53
+ return version.to_s if version.include?("-build.") || build_number.nil?
54
54
 
55
- version.to_s
55
+ "#{version}-build.#{build_number}"
56
56
  end
57
57
  end
58
58
  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.8
4
+ version: 1.4.12
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