ci_toolkit 1.6.2 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +7 -0
- data/RELEASING.md +7 -0
- data/ci_toolkit.gemspec +1 -1
- data/docker-compose.yml +8 -0
- data/lib/ci_toolkit/build_types.rb +18 -0
- data/lib/ci_toolkit/dvcs_pr.rb +4 -0
- data/lib/ci_toolkit/github_pr.rb +34 -10
- data/lib/ci_toolkit/gitlab_pr.rb +34 -10
- data/lib/ci_toolkit/pr_messenger.rb +9 -0
- data/lib/ci_toolkit/pr_messenger_text.rb +7 -0
- data/lib/ci_toolkit/seetest_bot.rb +5 -1
- data/lib/ci_toolkit.rb +1 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf8748ff0d666c907fac0f8bb328531e6536c49b19cd39fd99662d8aea067d8a
|
4
|
+
data.tar.gz: 79caaeae3543c703d77c8f239c3b7f37e0d86aae44f78a22c542e7694855a11a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88c8227691bc19dac3d5b6c7b79a785067780d1021488035b355dcbd9f02c70250196db31410c6ff245187ab7fa1376dd98f4f07117c8a2aa208eaf60c93a261
|
7
|
+
data.tar.gz: fb4df2fe415536e4a61872a93f507da43e0378b47af051050e35b4b82fc10413c153ad065e87c6f17a3d40b2463a722f2de7a472062115b347b325d497267951
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ci_toolkit (1.6.
|
4
|
+
ci_toolkit (1.6.4)
|
5
5
|
faraday
|
6
6
|
faraday-multipart
|
7
7
|
faraday_middleware
|
@@ -124,6 +124,7 @@ GEM
|
|
124
124
|
unicode-display_width (2.4.2)
|
125
125
|
|
126
126
|
PLATFORMS
|
127
|
+
aarch64-linux
|
127
128
|
universal-darwin-20
|
128
129
|
x86_64-darwin-21
|
129
130
|
x86_64-darwin-22
|
data/README.md
CHANGED
@@ -23,6 +23,13 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
23
23
|
|
24
24
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version in `ci_toolkit.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
25
25
|
|
26
|
+
## Docker Install
|
27
|
+
If you've docker already [installed](https://docs.docker.com/docker-for-mac/install/) you can build and run the image to get started.
|
28
|
+
|
29
|
+
```shell
|
30
|
+
docker-compose run app sh
|
31
|
+
```
|
32
|
+
|
26
33
|
## Contributing
|
27
34
|
|
28
35
|
Bug reports and pull requests are welcome on GitHub at https://github.com/crvshlab/ci_toolkit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ci_toolkit/blob/master/CODE_OF_CONDUCT.md).
|
data/RELEASING.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
### How to make a release
|
2
|
+
|
3
|
+
- Bump the version number in `Gemfile.lock` to the new version.
|
4
|
+
- Bump the version number in `ci_toolkit.gemspec` to the new version.
|
5
|
+
- `git commit -am "Version X.Y.Z."` (where X.Y.Z is the new version).
|
6
|
+
- `git tag -a vX.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version).
|
7
|
+
- `git push && git push --tags`.
|
data/ci_toolkit.gemspec
CHANGED
data/docker-compose.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CiToolkit
|
4
|
+
# util class to get actual valid list of build types
|
5
|
+
class BuildTypes
|
6
|
+
# get actual valid list of build types
|
7
|
+
def get_build_types(build_types_arr, comments, labels)
|
8
|
+
types = []
|
9
|
+
build_types_arr.each do |type|
|
10
|
+
if comments.include?("#{type} build") || labels.include?("#{type} build") ||
|
11
|
+
comments.include?(type) || labels.include?(type)
|
12
|
+
types.push(type)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
types
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/ci_toolkit/dvcs_pr.rb
CHANGED
@@ -98,6 +98,10 @@ module CiToolkit
|
|
98
98
|
CiToolkit::DvcsPr.api_not_implemented(self)
|
99
99
|
end
|
100
100
|
|
101
|
+
def certificate_pinning_logic_modified?
|
102
|
+
CiToolkit::DvcsPr.api_not_implemented(self)
|
103
|
+
end
|
104
|
+
|
101
105
|
def get_status_description(_context)
|
102
106
|
CiToolkit::DvcsPr.api_not_implemented(self)
|
103
107
|
end
|
data/lib/ci_toolkit/github_pr.rb
CHANGED
@@ -18,6 +18,8 @@ module CiToolkit
|
|
18
18
|
@_client = client
|
19
19
|
@build_types = build_types
|
20
20
|
@bot = CiToolkit::GithubBot.new
|
21
|
+
@changes_detector = GithubSpecificFilesChangesDetector.new
|
22
|
+
@build_types_getter = CiToolkit::BuildTypes.new
|
21
23
|
end
|
22
24
|
|
23
25
|
def title
|
@@ -83,14 +85,7 @@ module CiToolkit
|
|
83
85
|
end
|
84
86
|
|
85
87
|
def build_types
|
86
|
-
|
87
|
-
@build_types.each do |type|
|
88
|
-
if comments.include?("#{type} build") || labels.include?("#{type} build") ||
|
89
|
-
comments.include?(type) || labels.include?(type)
|
90
|
-
types.push(type)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
types
|
88
|
+
@build_types_getter.get_build_types(@build_types, comments, labels)
|
94
89
|
end
|
95
90
|
|
96
91
|
def infrastructure_work?
|
@@ -106,8 +101,11 @@ module CiToolkit
|
|
106
101
|
end
|
107
102
|
|
108
103
|
def realm_module_modified?
|
109
|
-
|
110
|
-
|
104
|
+
@changes_detector.realm_module_modified(files)
|
105
|
+
end
|
106
|
+
|
107
|
+
def certificate_pinning_logic_modified?
|
108
|
+
@changes_detector.certificate_pinning_logic_modified(files)
|
111
109
|
end
|
112
110
|
|
113
111
|
def get_status_description(context)
|
@@ -126,4 +124,30 @@ module CiToolkit
|
|
126
124
|
@_client
|
127
125
|
end
|
128
126
|
end
|
127
|
+
|
128
|
+
# util class to verify modifications in app files that may have been broken in the past
|
129
|
+
class GithubSpecificFilesChangesDetector
|
130
|
+
def realm_module_modified(files)
|
131
|
+
modified_files = files.select { |file| file[:filename]&.start_with? "cache/" }
|
132
|
+
modified_files.length.positive?
|
133
|
+
end
|
134
|
+
|
135
|
+
def certificate_pinning_logic_modified(files)
|
136
|
+
modified_files = files.select do |file|
|
137
|
+
contains_substring(file[:filename],
|
138
|
+
%w[HttpClientFactory SecurePreferences CertificatePinningConfiguration SSLPinner
|
139
|
+
CertificateDateChecker])
|
140
|
+
end
|
141
|
+
modified_files.length.positive?
|
142
|
+
end
|
143
|
+
|
144
|
+
private
|
145
|
+
|
146
|
+
def contains_substring(input_string, substrings)
|
147
|
+
return false if input_string.nil?
|
148
|
+
|
149
|
+
regex = Regexp.union(substrings.map { |s| Regexp.new(s, Regexp::IGNORECASE) })
|
150
|
+
!!(input_string =~ regex)
|
151
|
+
end
|
152
|
+
end
|
129
153
|
end
|
data/lib/ci_toolkit/gitlab_pr.rb
CHANGED
@@ -20,6 +20,8 @@ module CiToolkit
|
|
20
20
|
@_client = bot.client
|
21
21
|
@build_types = build_types
|
22
22
|
@bot = bot
|
23
|
+
@changes_detector = GitlabSpecificFilesChangesDetector.new
|
24
|
+
@build_types_getter = CiToolkit::BuildTypes.new
|
23
25
|
end
|
24
26
|
|
25
27
|
def title
|
@@ -86,14 +88,7 @@ module CiToolkit
|
|
86
88
|
end
|
87
89
|
|
88
90
|
def build_types
|
89
|
-
|
90
|
-
@build_types.each do |type|
|
91
|
-
if comments.include?("#{type} build") || labels.include?("#{type} build") ||
|
92
|
-
comments.include?(type) || labels.include?(type)
|
93
|
-
types.push(type)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
types
|
91
|
+
@build_types_getter.get_build_types(@build_types, comments, labels)
|
97
92
|
end
|
98
93
|
|
99
94
|
def infrastructure_work?
|
@@ -109,8 +104,11 @@ module CiToolkit
|
|
109
104
|
end
|
110
105
|
|
111
106
|
def realm_module_modified?
|
112
|
-
|
113
|
-
|
107
|
+
@changes_detector.realm_module_modified(files)
|
108
|
+
end
|
109
|
+
|
110
|
+
def certificate_pinning_logic_modified?
|
111
|
+
@changes_detector.certificate_pinning_logic_modified(files)
|
114
112
|
end
|
115
113
|
|
116
114
|
def get_status_description(context)
|
@@ -127,4 +125,30 @@ module CiToolkit
|
|
127
125
|
@_client
|
128
126
|
end
|
129
127
|
end
|
128
|
+
|
129
|
+
# util class to verify modifications in app files that may have been broken in the past
|
130
|
+
class GitlabSpecificFilesChangesDetector
|
131
|
+
def realm_module_modified(files)
|
132
|
+
modified_files = files.select { |file| file&.old_path&.start_with? "cache/" }
|
133
|
+
modified_files.length.positive?
|
134
|
+
end
|
135
|
+
|
136
|
+
def certificate_pinning_logic_modified(files)
|
137
|
+
modified_files = files.select do |file|
|
138
|
+
contains_substring(file&.old_path,
|
139
|
+
%w[HttpClientFactory SecurePreferences CertificatePinningConfiguration SSLPinner
|
140
|
+
CertificateDateChecker])
|
141
|
+
end
|
142
|
+
modified_files.length.positive?
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def contains_substring(input_string, substrings)
|
148
|
+
return false if input_string.nil?
|
149
|
+
|
150
|
+
regex = Regexp.union(substrings.map { |s| Regexp.new(s, Regexp::IGNORECASE) })
|
151
|
+
!!(input_string =~ regex)
|
152
|
+
end
|
153
|
+
end
|
130
154
|
end
|
@@ -55,6 +55,15 @@ module CiToolkit
|
|
55
55
|
delete(@messenger_text.realm_modified_warning_title)
|
56
56
|
end
|
57
57
|
|
58
|
+
def send_certificate_pinning_modified_android_warning
|
59
|
+
delete_certificate_pinning_modified_android_warning
|
60
|
+
send(@messenger_text.certificate_pinning_logic_modified_android_title)
|
61
|
+
end
|
62
|
+
|
63
|
+
def delete_certificate_pinning_modified_android_warning
|
64
|
+
delete(@messenger_text.certificate_pinning_logic_modified_android_title)
|
65
|
+
end
|
66
|
+
|
58
67
|
def send_big_pr_warning
|
59
68
|
delete_big_pr_warning
|
60
69
|
send(@messenger_text.big_pr_warning_title)
|
@@ -45,6 +45,13 @@ module CiToolkit
|
|
45
45
|
warning_with_message("Realm module modified. Did you remember to add migrations?")
|
46
46
|
end
|
47
47
|
|
48
|
+
def certificate_pinning_logic_modified_android_title
|
49
|
+
warning_with_message("Detected modifications in Certificate pinning related files " \
|
50
|
+
"(HttpClientFactory / SecurePreferences / CertificatePinningConfiguration / " \
|
51
|
+
"SSLPinner / CertificateDateChecker). If you are doing temporary changes " \
|
52
|
+
"to pinning, do not merge this MR until you revert them!")
|
53
|
+
end
|
54
|
+
|
48
55
|
def big_pr_warning_title
|
49
56
|
warning_with_message("Big PR")
|
50
57
|
end
|
@@ -3,10 +3,12 @@
|
|
3
3
|
require "gitlab"
|
4
4
|
|
5
5
|
module CiToolkit
|
6
|
-
# Utility class that provides
|
6
|
+
# Utility class that provides a faraday connection
|
7
7
|
class SeeTestBot
|
8
8
|
attr_reader :faraday_conn
|
9
9
|
|
10
|
+
TIMEOUT = 60
|
11
|
+
|
10
12
|
# Provides a base url, an endpoint and an access token that can be used to
|
11
13
|
# interact with the SeeTest web service
|
12
14
|
class Credentials
|
@@ -24,6 +26,8 @@ module CiToolkit
|
|
24
26
|
def initialize(
|
25
27
|
credentials = CiToolkit::SeeTestBot::Credentials.new,
|
26
28
|
faraday_conn = Faraday.new(url: credentials.base_url) do |f|
|
29
|
+
f.options.timeout = TIMEOUT
|
30
|
+
f.options.open_timeout = TIMEOUT
|
27
31
|
f.request :authorization, "Bearer", credentials.access_token
|
28
32
|
f.request :multipart
|
29
33
|
f.request :url_encoded
|
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.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gero Keller
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -226,16 +226,19 @@ files:
|
|
226
226
|
- Gemfile.lock
|
227
227
|
- LICENSE.txt
|
228
228
|
- README.md
|
229
|
+
- RELEASING.md
|
229
230
|
- Rakefile
|
230
231
|
- bin/console
|
231
232
|
- bin/setup
|
232
233
|
- ci_toolkit.gemspec
|
234
|
+
- docker-compose.yml
|
233
235
|
- duplicate_files_whitelist.txt
|
234
236
|
- lib/ci_toolkit.rb
|
235
237
|
- lib/ci_toolkit/bitrise_client.rb
|
236
238
|
- lib/ci_toolkit/bitrise_env.rb
|
237
239
|
- lib/ci_toolkit/build.rb
|
238
240
|
- lib/ci_toolkit/build_status.rb
|
241
|
+
- lib/ci_toolkit/build_types.rb
|
239
242
|
- lib/ci_toolkit/duplicate_files_finder.rb
|
240
243
|
- lib/ci_toolkit/dvcs_pr.rb
|
241
244
|
- lib/ci_toolkit/dvcs_pr_factory.rb
|
@@ -275,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
278
|
- !ruby/object:Gem::Version
|
276
279
|
version: '0'
|
277
280
|
requirements: []
|
278
|
-
rubygems_version: 3.4.
|
281
|
+
rubygems_version: 3.4.19
|
279
282
|
signing_key:
|
280
283
|
specification_version: 4
|
281
284
|
summary: Set of CI utilities
|