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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/ci_toolkit/bitrise_client.rb +28 -29
- data/lib/ci_toolkit/github_pr.rb +4 -2
- data/lib/ci_toolkit.rb +0 -2
- metadata +2 -3
- data/lib/ci_toolkit/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea7a8593d762820a45d70908bf854836da0c0e92218db62207056edfd502fb02
|
4
|
+
data.tar.gz: 86b9fb33e9c477bebc4a9675da7a2cb4aca3b91db06613c5fa1749b9e452fb22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d22b9bfb66965107eedb0f1cd6ff0f6cf6925c313c88d1418b4e02f585409b53d2d4354077c3a20149a38335f52cb19dc7e0fb9fd5650250e8b6a6e55bd495d
|
7
|
+
data.tar.gz: d5f13c3f2d09aa38249a9f7e7e70eef2b9c45f2d8f54a100f6791d9239a5e984bfbec4b84f3b1ea928dfb223d2a4c4474611a2cd391babaaaf38fc5ee24cad12
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# CiToolkit [![Lint & run tests](https://github.com/crvshlab/ci_toolkit/actions/workflows/
|
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
|
27
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
56
|
-
|
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
|
63
|
-
|
64
|
-
|
65
|
-
|
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/github_pr.rb
CHANGED
@@ -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])
|
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
|
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
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.
|
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-
|
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:
|