ci_toolkit 1.3.13 → 1.3.17

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: e409eaa7ab86b7af7a1e20cd9808ad0eeb2dcee9ac912296ec0dfe77605760a1
4
- data.tar.gz: d79386299cd1910016581a0569896b8b62ac48ce0106493e39524ecb726d80d7
3
+ metadata.gz: 883207d3f29050dad756ee30f072af4ee6e0d25a2ebb6739c2c7353f0fe3e7e0
4
+ data.tar.gz: 7804a7d066e5b5550d0ef373c2f55753abd62f615a69bfa47ae73607bbdda8ae
5
5
  SHA512:
6
- metadata.gz: 4f377bf2e70d5cb2b73c39aeb2c4960a9be499c0b730727d316e526283659dc2ff0f0583053495d3bce97e9f5f9766a5f0890a643f409076296999481269c0ac
7
- data.tar.gz: 1806fb69f7a1e003118e89498fb09c81d5fe8748d548ab54517ee70ffc564f258caf21f1913453d5a06467566364bb518a78d9b07b9bd93b64684f296d3e1595
6
+ metadata.gz: 0a2d27d94b95f311dc675105790a19ddd81849ebad508875fe69b2a6a37326cc056fda20ebc141e29e9f54e59a099254fc0a6853b84d4d3ff869a0ef42ef3f90
7
+ data.tar.gz: 7217613bbd0774d92857d8db7b34e7e48f70c34c66285efc55c2bdf58a417582f599a7500f41d5ede9e1dba7e9868826b94d251343b1867cc9928cbab7a6d547
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.17)
5
5
  faraday
6
6
  faraday_middleware
7
7
  jwt
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CiToolkit [![Lint & run tests](https://github.com/crvshlab/ci_toolkit/actions/workflows/lint_and_run_tests.yml/badge.svg)](https://github.com/crvshlab/ci_toolkit/actions/workflows/lint_and_run_tests.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=crvshlab_ci_toolkit&metric=alert_status&token=f10d3b754be5144c5acced94b8f2fe8705045db7)](https://sonarcloud.io/dashboard?id=crvshlab_ci_toolkit) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=crvshlab_ci_toolkit&metric=coverage&token=f10d3b754be5144c5acced94b8f2fe8705045db7)](https://sonarcloud.io/dashboard?id=crvshlab_ci_toolkit)
1
+ # CiToolkit [![Lint & run tests](https://github.com/crvshlab/ci_toolkit/actions/workflows/lint_test_and_release.yml/badge.svg)](https://github.com/crvshlab/ci_toolkit/actions/workflows/lint_and_run_tests.yml) [![CodeQL](https://github.com/crvshlab/ci_toolkit/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/crvshlab/ci_toolkit/actions/workflows/codeql-analysis.yml.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=crvshlab_ci_toolkit&metric=alert_status&token=f10d3b754be5144c5acced94b8f2fe8705045db7)](https://sonarcloud.io/dashboard?id=crvshlab_ci_toolkit) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=crvshlab_ci_toolkit&metric=coverage&token=f10d3b754be5144c5acced94b8f2fe8705045db7)](https://sonarcloud.io/dashboard?id=crvshlab_ci_toolkit)
2
2
 
3
3
  A collection of utility classes used to glue information between Github and CI (Bitrise primarily)
4
4
  ## Installation
@@ -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
data/lib/ci_toolkit.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "ci_toolkit/version"
4
-
5
3
  require "ci_toolkit/bitrise_env"
6
4
  require "ci_toolkit/build"
7
5
  require "ci_toolkit/build_status"
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.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gero Keller
@@ -210,7 +210,6 @@ files:
210
210
  - lib/ci_toolkit/jira.rb
211
211
  - lib/ci_toolkit/pr_messenger.rb
212
212
  - lib/ci_toolkit/pr_messenger_text.rb
213
- - lib/ci_toolkit/version.rb
214
213
  - transform_coverage_data.rb
215
214
  homepage: https://github.com/crvshlab/ci_toolkit
216
215
  licenses:
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module CiToolkit
4
- VERSION = "1.3.13"
5
- end