ci_toolkit 1.3.12 → 1.3.16

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: 5b4ada3d3cab678797ffc499c25617305c04a41e5423496b6f1645882b1d5d15
4
- data.tar.gz: d406a380eb7e804a8b78e0ae761c5fdc88403ab9740fa0e22e998a90bc412d65
3
+ metadata.gz: ea7a8593d762820a45d70908bf854836da0c0e92218db62207056edfd502fb02
4
+ data.tar.gz: 86b9fb33e9c477bebc4a9675da7a2cb4aca3b91db06613c5fa1749b9e452fb22
5
5
  SHA512:
6
- metadata.gz: '0388f5795048ef03688856ab6b96f74570403476f04dd3a26889ebc3cb54eddad8921f5af396155a36646dab2febd84a8fa14557c2bf79f9d7c81630ce06958a'
7
- data.tar.gz: c41cdb238c1d9f0e841f106eb47cfcea002507771e577c585836d20f556c421aeaaae00c5533b49b7b63546cf101972b126eb563f4140d91265956e0ac5f7ee9
6
+ metadata.gz: 8d22b9bfb66965107eedb0f1cd6ff0f6cf6925c313c88d1418b4e02f585409b53d2d4354077c3a20149a38335f52cb19dc7e0fb9fd5650250e8b6a6e55bd495d
7
+ data.tar.gz: d5f13c3f2d09aa38249a9f7e7e70eef2b9c45f2d8f54a100f6791d9239a5e984bfbec4b84f3b1ea928dfb223d2a4c4474611a2cd391babaaaf38fc5ee24cad12
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.3.12)
4
+ ci_toolkit (1.3.16)
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
@@ -42,7 +42,7 @@ module CiToolkit
42
42
 
43
43
  def delete_comments_including_text(text)
44
44
  comments = find_comments_including_text(text)
45
- comments.each { |comment| delete_comment(comment[:id]) unless comment.nil? }
45
+ comments.each { |comment| delete_comment(comment[:id]) }
46
46
  end
47
47
 
48
48
  def delete_comment(comment_id)
@@ -78,6 +78,7 @@ module CiToolkit
78
78
  client.statuses(@repo_slug, @commit_sha).each do |status|
79
79
  return status if status[:context] == context
80
80
  end
81
+ nil
81
82
  end
82
83
 
83
84
  def build_types
@@ -101,7 +102,8 @@ module CiToolkit
101
102
  end
102
103
 
103
104
  def realm_module_modified?
104
- files&.select { |file| file[:filename]&.start_with? "cache/" }&.length&.positive?
105
+ modified_files = files.select { |file| file[:filename]&.start_with? "cache/" }
106
+ modified_files.length.positive?
105
107
  end
106
108
 
107
109
  private
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.12
4
+ version: 1.3.16
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-10-28 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -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.12"
5
- end