knapsack_pro 1.1.0 → 1.2.0
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +28 -2
- data/lib/knapsack_pro/config/ci/gitlab_ci.rb +5 -2
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +16 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71348dc37d5dee552caf5ccb37c7cedb48dd3f51e5f45ba00e96ccc63e894a87
|
4
|
+
data.tar.gz: 1bba20bcf45f0baf139f6aa4e0f0454bbf92dce045ce2285491717a8f2e395c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03100f82dcd86e6f352b452d7a99aa5834e8880325512e7d3fb6644d0d7d9077266188e5d10b86117a3516b2979e127873f5b06dab98b4c9cd793665bc93de95
|
7
|
+
data.tar.gz: 94972e32887092d86ee031726c510fb0382fc6ba8da23edf131b8539d827e9c5b57cb6814d3024814816bd82f1738770ee88a7ce46c15c189a88b0ff6508f52c
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
* TODO
|
4
4
|
|
5
|
+
### 1.2.0
|
6
|
+
|
7
|
+
* Add support for GitLab CI env vars CI_NODE_TOTAL and CI_NODE_INDEX.
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/73
|
10
|
+
|
11
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v1.1.0...v1.2.0
|
12
|
+
|
5
13
|
### 1.1.0
|
6
14
|
|
7
15
|
* Add test file exclude pattern.
|
data/README.md
CHANGED
@@ -103,6 +103,8 @@ The knapsack_pro has also [queue mode](#queue-mode) to get an optimal test suite
|
|
103
103
|
- [Info for semaphoreapp.com users](#info-for-semaphoreappcom-users)
|
104
104
|
- [Info for buildkite.com users](#info-for-buildkitecom-users)
|
105
105
|
- [Info for Gitlab CI users](#info-for-gitlab-ci-users)
|
106
|
+
- [GitLab CI `>= 11.5`](#gitlab-ci--115)
|
107
|
+
- [GitLab CI `< 11.5` (old GitLab CI)](#gitlab-ci--115-old-gitlab-ci)
|
106
108
|
- [Info for codeship.com users](#info-for-codeshipcom-users)
|
107
109
|
- [Info for Heroku CI users](#info-for-heroku-ci-users)
|
108
110
|
- [Info for Solano CI users](#info-for-solano-ci-users)
|
@@ -885,6 +887,32 @@ If you want to use Buildkite retry single agent feature to retry just failed tes
|
|
885
887
|
|
886
888
|
#### Info for Gitlab CI users
|
887
889
|
|
890
|
+
Remember to add API tokens like `KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER` and `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` to [Secret Variables](https://gitlab.com/help/ci/variables/README.md#secret-variables) in `Gitlab CI Settings -> CI/CD Pipelines -> Secret Variables`.
|
891
|
+
|
892
|
+
##### GitLab CI `>= 11.5`
|
893
|
+
|
894
|
+
```yaml
|
895
|
+
test:
|
896
|
+
parallel: 2
|
897
|
+
|
898
|
+
# RSpec tests in Knapsack Pro Queue Mode (dynamic test suite split)
|
899
|
+
script: bundle exec rake knapsack_pro:queue:rspec
|
900
|
+
|
901
|
+
# Other commands you could use:
|
902
|
+
|
903
|
+
# Knapsack Pro Regular Mode (deterministic test suite split)
|
904
|
+
# bundle exec rake knapsack_pro:rspec
|
905
|
+
# bundle exec rake knapsack_pro:cucumber
|
906
|
+
# bundle exec rake knapsack_pro:minitest
|
907
|
+
|
908
|
+
# Knapsack Pro Queue Mode (dynamic test suite split)
|
909
|
+
# bundle exec rake knapsack_pro:queue:minitest
|
910
|
+
```
|
911
|
+
|
912
|
+
Here you can find info [how to configure the GitLab parallel CI nodes](https://docs.gitlab.com/ee/ci/yaml/#parallel).
|
913
|
+
|
914
|
+
##### GitLab CI `< 11.5` (old GitLab CI)
|
915
|
+
|
888
916
|
Gitlab CI does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each parallel job running as part of the same `test` stage. Below is relevant part of `.gitlab-ci.yml` configuration for 2 parallel jobs.
|
889
917
|
|
890
918
|
```
|
@@ -915,8 +943,6 @@ test_ci_node_1:
|
|
915
943
|
- bundle exec rake knapsack_pro:queue:rspec
|
916
944
|
```
|
917
945
|
|
918
|
-
Remember to add API tokens like `KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER` and `KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC` to [Secret Variables](https://gitlab.com/help/ci/variables/README.md#secret-variables) in `Gitlab CI Settings -> CI/CD Pipelines -> Secret Variables`.
|
919
|
-
|
920
946
|
#### Info for codeship.com users
|
921
947
|
|
922
948
|
Codeship does not provide parallel jobs environment variables so you will have to define `KNAPSACK_PRO_CI_NODE_TOTAL` and `KNAPSACK_PRO_CI_NODE_INDEX` for each [parallel test pipeline](https://documentation.codeship.com/basic/builds-and-configuration/parallel-tests/#using-parallel-test-pipelines). Below is an example for 2 parallel test pipelines.
|
@@ -4,11 +4,14 @@ module KnapsackPro
|
|
4
4
|
module CI
|
5
5
|
class GitlabCI < Base
|
6
6
|
def node_total
|
7
|
-
|
7
|
+
ENV['CI_NODE_TOTAL']
|
8
8
|
end
|
9
9
|
|
10
10
|
def node_index
|
11
|
-
|
11
|
+
return unless ENV['GITLAB_CI']
|
12
|
+
# GitLab 11.5
|
13
|
+
index = ENV['CI_NODE_INDEX']
|
14
|
+
index.to_i - 1 if index
|
12
15
|
end
|
13
16
|
|
14
17
|
def node_build_id
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -10,13 +10,27 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
|
13
|
+
context 'when environment exists' do
|
14
|
+
let(:env) { { 'CI_NODE_TOTAL' => 4 } }
|
15
|
+
it { should eql 4 }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when environment doesn't exist" do
|
19
|
+
it { should be nil }
|
20
|
+
end
|
14
21
|
end
|
15
22
|
|
16
23
|
describe '#node_index' do
|
17
24
|
subject { described_class.new.node_index }
|
18
25
|
|
19
|
-
|
26
|
+
context 'when environment exists and is in GitLab CI' do
|
27
|
+
let(:env) { { 'CI_NODE_INDEX' => 4, 'GITLAB_CI' => 'true' } }
|
28
|
+
it { should eql 3 }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when environment doesn't exist" do
|
32
|
+
it { should be nil }
|
33
|
+
end
|
20
34
|
end
|
21
35
|
|
22
36
|
describe '#node_build_id' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knapsack_pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|