ci_toolkit 1.3.10 → 1.3.15

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: a635decd61187e106471817383acbefcd33365907c68399f5af36168cdef562f
4
- data.tar.gz: d872b10fa6a00d5d689ef5830e0981a7a1874876f13b339a242e459721e07354
3
+ metadata.gz: d1e3e58805fc937eeb361100fb7593ca8f91b0188a17e88191db6007f958048a
4
+ data.tar.gz: e4ae0e924d73db4b8b11888e735478baea0ebaaac07a6a99f656f1a5a8ce0fcf
5
5
  SHA512:
6
- metadata.gz: 7a10bbb2fe34c842167adddc19023e8600ded473673e9fefe6d75591e8577316c4cc816c276642af856f3e7591cef4350bda4ffdcfd87b9537eb1723b268198a
7
- data.tar.gz: db1b2e6a9779c4d435ece25c8790cb807378edf23f44cada785e813c8174246993c0b48d5e08a68320e109f81fa4996ad2a400ff2f4358ee96561adf7149e218
6
+ metadata.gz: 1a93b855597611ee72ac21811a4989cda55f935ee61860a49dcb00e0a656bc510e2b13faf456799654a00a147233246af8b2d67ad214139dac43f8ff6a5eaf68
7
+ data.tar.gz: 9da26b3bcdd14d1c16a98f96705b7e5c190562a929cffe9181c09ac8ccdfe3f0e49dcebfa762492f6e776a83acb850be9fbf54c3de831357c34c5be576195449
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ci_toolkit (1.3.10)
4
+ ci_toolkit (1.3.15)
5
5
  faraday
6
6
  faraday_middleware
7
7
  jwt
@@ -15,6 +15,7 @@ GEM
15
15
  addressable (2.8.0)
16
16
  public_suffix (>= 2.0.2, < 5.0)
17
17
  ast (2.4.2)
18
+ date (3.2.0)
18
19
  diff-lcs (1.4.4)
19
20
  docile (1.4.0)
20
21
  faraday (1.8.0)
@@ -36,15 +37,17 @@ GEM
36
37
  faraday-net_http_persistent (1.2.0)
37
38
  faraday-patron (1.0.0)
38
39
  faraday-rack (1.0.0)
39
- faraday_middleware (1.1.0)
40
+ faraday_middleware (1.2.0)
40
41
  faraday (~> 1.0)
42
+ ipaddr (1.2.3)
41
43
  json (2.5.1)
42
44
  jwt (2.3.0)
43
45
  multipart-post (2.1.1)
44
46
  octokit (4.21.0)
45
47
  faraday (>= 0.9)
46
48
  sawyer (~> 0.8.0, >= 0.5.3)
47
- openssl (2.2.0)
49
+ openssl (2.2.1)
50
+ ipaddr
48
51
  parallel (1.21.0)
49
52
  parser (3.0.2.0)
50
53
  ast (~> 2.4.1)
@@ -95,11 +98,13 @@ GEM
95
98
  json
96
99
  simplecov
97
100
  simplecov_json_formatter (0.1.3)
98
- time (0.1.0)
101
+ time (0.2.0)
102
+ date
99
103
  unicode-display_width (2.1.0)
100
104
 
101
105
  PLATFORMS
102
106
  universal-darwin-20
107
+ x86_64-darwin-21
103
108
  x86_64-linux
104
109
 
105
110
  DEPENDENCIES
@@ -113,4 +118,4 @@ DEPENDENCIES
113
118
  simplecov-json
114
119
 
115
120
  BUNDLED WITH
116
- 2.2.27
121
+ 2.2.30
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CiToolkit
4
- VERSION = "1.3.10"
4
+ VERSION = "1.3.15"
5
5
  end
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.10
4
+ version: 1.3.15
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-11 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