knapsack_pro 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/knapsack_pro/config/ci/github_actions.rb +8 -0
- data/lib/knapsack_pro/version.rb +1 -1
- data/spec/knapsack_pro/config/ci/app_veyor_spec.rb +8 -8
- data/spec/knapsack_pro/config/ci/buildkite_spec.rb +14 -14
- data/spec/knapsack_pro/config/ci/circle_spec.rb +11 -11
- data/spec/knapsack_pro/config/ci/cirrus_ci_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/codefresh_spec.rb +6 -6
- data/spec/knapsack_pro/config/ci/codeship_spec.rb +6 -6
- data/spec/knapsack_pro/config/ci/github_actions_spec.rb +21 -8
- data/spec/knapsack_pro/config/ci/gitlab_ci_spec.rb +9 -9
- data/spec/knapsack_pro/config/ci/heroku_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/semaphore2_spec.rb +11 -11
- data/spec/knapsack_pro/config/ci/semaphore_spec.rb +12 -12
- data/spec/knapsack_pro/config/ci/travis_spec.rb +8 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf60d8383722268ee562e030a1012cf20544e072faf94017bf21e417782cc4a5
|
4
|
+
data.tar.gz: 91f304357d4228bdfda1c43e3387681abfe56fcbf2e75f202df565cbff0f3ec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 533b1f156df0b779e1ebe476ed87a9f3811929ae4a4e271bb2d880f8deda2f0e23da41ae727d5c3d38a3828f50dce5ed99c10af5857d0abdb45a674f6a128bf2
|
7
|
+
data.tar.gz: c3f1f95e7ed656c0347d09650f08b11f3a5987df3e31a54fb3b9cecc0113dd5c5e1181615803f8f938f1402b70ee3ca2649f6db5e64b135590e2e2d10c94b528
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.1.0
|
4
|
+
|
5
|
+
* Add support for CI node retry count on GitHub Actions
|
6
|
+
|
7
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/pull/197
|
8
|
+
|
9
|
+
https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v4.0.0...v4.1.0
|
10
|
+
|
3
11
|
### 4.0.0
|
4
12
|
|
5
13
|
* Raise when `KNAPSACK_PRO_CI_NODE_BUILD_ID` is missing
|
@@ -16,6 +16,14 @@ module KnapsackPro
|
|
16
16
|
ENV['GITHUB_RUN_ID']
|
17
17
|
end
|
18
18
|
|
19
|
+
def node_retry_count
|
20
|
+
# A unique number for each attempt of a particular workflow run in a repository.
|
21
|
+
# This number begins at 1 for the workflow run's first attempt, and increments with each re-run.
|
22
|
+
run_attempt = ENV['GITHUB_RUN_ATTEMPT']
|
23
|
+
return unless run_attempt
|
24
|
+
run_attempt.to_i - 1
|
25
|
+
end
|
26
|
+
|
19
27
|
def commit_hash
|
20
28
|
ENV['GITHUB_SHA']
|
21
29
|
end
|
data/lib/knapsack_pro/version.rb
CHANGED
@@ -22,12 +22,12 @@ describe KnapsackPro::Config::CI::AppVeyor do
|
|
22
22
|
describe '#node_build_id' do
|
23
23
|
subject { described_class.new.node_build_id }
|
24
24
|
|
25
|
-
context 'when environment exists' do
|
25
|
+
context 'when the environment exists' do
|
26
26
|
let(:env) { { 'APPVEYOR_BUILD_ID' => 123 } }
|
27
27
|
it { should eql 123 }
|
28
28
|
end
|
29
29
|
|
30
|
-
context "when environment doesn't exist" do
|
30
|
+
context "when the environment doesn't exist" do
|
31
31
|
it { should be nil }
|
32
32
|
end
|
33
33
|
end
|
@@ -35,12 +35,12 @@ describe KnapsackPro::Config::CI::AppVeyor do
|
|
35
35
|
describe '#commit_hash' do
|
36
36
|
subject { described_class.new.commit_hash }
|
37
37
|
|
38
|
-
context 'when environment exists' do
|
38
|
+
context 'when the environment exists' do
|
39
39
|
let(:env) { { 'APPVEYOR_REPO_COMMIT' => '2e13512fc230d6f9ebf4923352718e4d' } }
|
40
40
|
it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
|
41
41
|
end
|
42
42
|
|
43
|
-
context "when environment doesn't exist" do
|
43
|
+
context "when the environment doesn't exist" do
|
44
44
|
it { should be nil }
|
45
45
|
end
|
46
46
|
end
|
@@ -48,12 +48,12 @@ describe KnapsackPro::Config::CI::AppVeyor do
|
|
48
48
|
describe '#branch' do
|
49
49
|
subject { described_class.new.branch }
|
50
50
|
|
51
|
-
context 'when environment exists' do
|
51
|
+
context 'when the environment exists' do
|
52
52
|
let(:env) { { 'APPVEYOR_REPO_BRANCH' => 'master' } }
|
53
53
|
it { should eql 'master' }
|
54
54
|
end
|
55
55
|
|
56
|
-
context "when environment doesn't exist" do
|
56
|
+
context "when the environment doesn't exist" do
|
57
57
|
it { should be nil }
|
58
58
|
end
|
59
59
|
end
|
@@ -61,12 +61,12 @@ describe KnapsackPro::Config::CI::AppVeyor do
|
|
61
61
|
describe '#project_dir' do
|
62
62
|
subject { described_class.new.project_dir }
|
63
63
|
|
64
|
-
context 'when environment exists' do
|
64
|
+
context 'when the environment exists' do
|
65
65
|
let(:env) { { 'APPVEYOR_BUILD_FOLDER' => '/path/to/clone/repo' } }
|
66
66
|
it { should eql '/path/to/clone/repo' }
|
67
67
|
end
|
68
68
|
|
69
|
-
context "when environment doesn't exist" do
|
69
|
+
context "when the environment doesn't exist" do
|
70
70
|
it { should be nil }
|
71
71
|
end
|
72
72
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'BUILDKITE_PARALLEL_JOB_COUNT' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists' do
|
26
|
+
context 'when the environment exists' do
|
27
27
|
let(:env) { { 'BUILDKITE_PARALLEL_JOB' => 3 } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -36,12 +36,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
36
36
|
describe '#node_build_id' do
|
37
37
|
subject { described_class.new.node_build_id }
|
38
38
|
|
39
|
-
context 'when environment exists' do
|
39
|
+
context 'when the environment exists' do
|
40
40
|
let(:env) { { 'BUILDKITE_BUILD_NUMBER' => 1514 } }
|
41
41
|
it { should eql 1514 }
|
42
42
|
end
|
43
43
|
|
44
|
-
context "when environment doesn't exist" do
|
44
|
+
context "when the environment doesn't exist" do
|
45
45
|
it { should be nil }
|
46
46
|
end
|
47
47
|
end
|
@@ -49,12 +49,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
49
49
|
describe '#node_retry_count' do
|
50
50
|
subject { described_class.new.node_retry_count }
|
51
51
|
|
52
|
-
context 'when environment exists' do
|
52
|
+
context 'when the environment exists' do
|
53
53
|
let(:env) { { 'BUILDKITE_RETRY_COUNT' => '1' } }
|
54
54
|
it { should eql '1' }
|
55
55
|
end
|
56
56
|
|
57
|
-
context "when environment doesn't exist" do
|
57
|
+
context "when the environment doesn't exist" do
|
58
58
|
it { should be nil }
|
59
59
|
end
|
60
60
|
end
|
@@ -62,12 +62,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
62
62
|
describe '#commit_hash' do
|
63
63
|
subject { described_class.new.commit_hash }
|
64
64
|
|
65
|
-
context 'when environment exists' do
|
65
|
+
context 'when the environment exists' do
|
66
66
|
let(:env) { { 'BUILDKITE_COMMIT' => '3fa64859337f6e56409d49f865d13fd7' } }
|
67
67
|
it { should eql '3fa64859337f6e56409d49f865d13fd7' }
|
68
68
|
end
|
69
69
|
|
70
|
-
context "when environment doesn't exist" do
|
70
|
+
context "when the environment doesn't exist" do
|
71
71
|
it { should be nil }
|
72
72
|
end
|
73
73
|
end
|
@@ -75,12 +75,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
75
75
|
describe '#branch' do
|
76
76
|
subject { described_class.new.branch }
|
77
77
|
|
78
|
-
context 'when environment exists' do
|
78
|
+
context 'when the environment exists' do
|
79
79
|
let(:env) { { 'BUILDKITE_BRANCH' => 'main' } }
|
80
80
|
it { should eql 'main' }
|
81
81
|
end
|
82
82
|
|
83
|
-
context "when environment doesn't exist" do
|
83
|
+
context "when the environment doesn't exist" do
|
84
84
|
it { should be nil }
|
85
85
|
end
|
86
86
|
end
|
@@ -88,12 +88,12 @@ describe KnapsackPro::Config::CI::Buildkite do
|
|
88
88
|
describe '#project_dir' do
|
89
89
|
subject { described_class.new.project_dir }
|
90
90
|
|
91
|
-
context 'when environment exists' do
|
91
|
+
context 'when the environment exists' do
|
92
92
|
let(:env) { { 'BUILDKITE_BUILD_CHECKOUT_PATH' => '/home/user/knapsack_pro-ruby' } }
|
93
93
|
it { should eql '/home/user/knapsack_pro-ruby' }
|
94
94
|
end
|
95
95
|
|
96
|
-
context "when environment doesn't exist" do
|
96
|
+
context "when the environment doesn't exist" do
|
97
97
|
it { should be nil }
|
98
98
|
end
|
99
99
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::Circle do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'CIRCLE_NODE_TOTAL' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::Circle do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists' do
|
26
|
+
context 'when the environment exists' do
|
27
27
|
let(:env) { { 'CIRCLE_NODE_INDEX' => 3 } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -36,12 +36,12 @@ describe KnapsackPro::Config::CI::Circle do
|
|
36
36
|
describe '#node_build_id' do
|
37
37
|
subject { described_class.new.node_build_id }
|
38
38
|
|
39
|
-
context 'when environment exists' do
|
39
|
+
context 'when the environment exists' do
|
40
40
|
let(:env) { { 'CIRCLE_BUILD_NUM' => 123 } }
|
41
41
|
it { should eql 123 }
|
42
42
|
end
|
43
43
|
|
44
|
-
context "when environment doesn't exist" do
|
44
|
+
context "when the environment doesn't exist" do
|
45
45
|
it { should be nil }
|
46
46
|
end
|
47
47
|
end
|
@@ -49,12 +49,12 @@ describe KnapsackPro::Config::CI::Circle do
|
|
49
49
|
describe '#commit_hash' do
|
50
50
|
subject { described_class.new.commit_hash }
|
51
51
|
|
52
|
-
context 'when environment exists' do
|
52
|
+
context 'when the environment exists' do
|
53
53
|
let(:env) { { 'CIRCLE_SHA1' => '3fa64859337f6e56409d49f865d13fd7' } }
|
54
54
|
it { should eql '3fa64859337f6e56409d49f865d13fd7' }
|
55
55
|
end
|
56
56
|
|
57
|
-
context "when environment doesn't exist" do
|
57
|
+
context "when the environment doesn't exist" do
|
58
58
|
it { should be nil }
|
59
59
|
end
|
60
60
|
end
|
@@ -62,12 +62,12 @@ describe KnapsackPro::Config::CI::Circle do
|
|
62
62
|
describe '#branch' do
|
63
63
|
subject { described_class.new.branch }
|
64
64
|
|
65
|
-
context 'when environment exists' do
|
65
|
+
context 'when the environment exists' do
|
66
66
|
let(:env) { { 'CIRCLE_BRANCH' => 'main' } }
|
67
67
|
it { should eql 'main' }
|
68
68
|
end
|
69
69
|
|
70
|
-
context "when environment doesn't exist" do
|
70
|
+
context "when the environment doesn't exist" do
|
71
71
|
it { should be nil }
|
72
72
|
end
|
73
73
|
end
|
@@ -80,7 +80,7 @@ describe KnapsackPro::Config::CI::Circle do
|
|
80
80
|
it { should eql '~/knapsack_pro-ruby' }
|
81
81
|
end
|
82
82
|
|
83
|
-
context "when environment doesn't exist" do
|
83
|
+
context "when the environment doesn't exist" do
|
84
84
|
it { should be nil }
|
85
85
|
end
|
86
86
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::CirrusCI do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'CI_NODE_TOTAL' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::CirrusCI do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists' do
|
26
|
+
context 'when the environment exists' do
|
27
27
|
let(:env) { { 'CI_NODE_INDEX' => 3 } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -36,12 +36,12 @@ describe KnapsackPro::Config::CI::CirrusCI do
|
|
36
36
|
describe '#node_build_id' do
|
37
37
|
subject { described_class.new.node_build_id }
|
38
38
|
|
39
|
-
context 'when environment exists' do
|
39
|
+
context 'when the environment exists' do
|
40
40
|
let(:env) { { 'CIRRUS_BUILD_ID' => 123 } }
|
41
41
|
it { should eql 123 }
|
42
42
|
end
|
43
43
|
|
44
|
-
context "when environment doesn't exist" do
|
44
|
+
context "when the environment doesn't exist" do
|
45
45
|
it { should be nil }
|
46
46
|
end
|
47
47
|
end
|
@@ -49,12 +49,12 @@ describe KnapsackPro::Config::CI::CirrusCI do
|
|
49
49
|
describe '#commit_hash' do
|
50
50
|
subject { described_class.new.commit_hash }
|
51
51
|
|
52
|
-
context 'when environment exists' do
|
52
|
+
context 'when the environment exists' do
|
53
53
|
let(:env) { { 'CIRRUS_CHANGE_IN_REPO' => '2e13512fc230d6f9ebf4923352718e4d' } }
|
54
54
|
it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
|
55
55
|
end
|
56
56
|
|
57
|
-
context "when environment doesn't exist" do
|
57
|
+
context "when the environment doesn't exist" do
|
58
58
|
it { should be nil }
|
59
59
|
end
|
60
60
|
end
|
@@ -62,12 +62,12 @@ describe KnapsackPro::Config::CI::CirrusCI do
|
|
62
62
|
describe '#branch' do
|
63
63
|
subject { described_class.new.branch }
|
64
64
|
|
65
|
-
context 'when environment exists' do
|
65
|
+
context 'when the environment exists' do
|
66
66
|
let(:env) { { 'CIRRUS_BRANCH' => 'master' } }
|
67
67
|
it { should eql 'master' }
|
68
68
|
end
|
69
69
|
|
70
|
-
context "when environment doesn't exist" do
|
70
|
+
context "when the environment doesn't exist" do
|
71
71
|
it { should be nil }
|
72
72
|
end
|
73
73
|
end
|
@@ -75,12 +75,12 @@ describe KnapsackPro::Config::CI::CirrusCI do
|
|
75
75
|
describe '#project_dir' do
|
76
76
|
subject { described_class.new.project_dir }
|
77
77
|
|
78
|
-
context 'when environment exists' do
|
78
|
+
context 'when the environment exists' do
|
79
79
|
let(:env) { { 'CIRRUS_WORKING_DIR' => '/tmp/cirrus-ci-build' } }
|
80
80
|
it { should eql '/tmp/cirrus-ci-build' }
|
81
81
|
end
|
82
82
|
|
83
|
-
context "when environment doesn't exist" do
|
83
|
+
context "when the environment doesn't exist" do
|
84
84
|
it { should be nil }
|
85
85
|
end
|
86
86
|
end
|
@@ -22,12 +22,12 @@ describe KnapsackPro::Config::CI::Codefresh do
|
|
22
22
|
describe '#node_build_id' do
|
23
23
|
subject { described_class.new.node_build_id }
|
24
24
|
|
25
|
-
context 'when environment exists' do
|
25
|
+
context 'when the environment exists' do
|
26
26
|
let(:env) { { 'CF_BUILD_ID' => '1005' } }
|
27
27
|
it { should eql '1005' }
|
28
28
|
end
|
29
29
|
|
30
|
-
context "when environment doesn't exist" do
|
30
|
+
context "when the environment doesn't exist" do
|
31
31
|
it { should be nil }
|
32
32
|
end
|
33
33
|
end
|
@@ -35,12 +35,12 @@ describe KnapsackPro::Config::CI::Codefresh do
|
|
35
35
|
describe '#commit_hash' do
|
36
36
|
subject { described_class.new.commit_hash }
|
37
37
|
|
38
|
-
context 'when environment exists' do
|
38
|
+
context 'when the environment exists' do
|
39
39
|
let(:env) { { 'CF_REVISION' => 'b624067a61d2134df1db74ebdabb1d8d' } }
|
40
40
|
it { should eql 'b624067a61d2134df1db74ebdabb1d8d' }
|
41
41
|
end
|
42
42
|
|
43
|
-
context "when environment doesn't exist" do
|
43
|
+
context "when the environment doesn't exist" do
|
44
44
|
it { should be nil }
|
45
45
|
end
|
46
46
|
end
|
@@ -48,12 +48,12 @@ describe KnapsackPro::Config::CI::Codefresh do
|
|
48
48
|
describe '#branch' do
|
49
49
|
subject { described_class.new.branch }
|
50
50
|
|
51
|
-
context 'when environment exists' do
|
51
|
+
context 'when the environment exists' do
|
52
52
|
let(:env) { { 'CF_BRANCH' => 'codefresh-branch' } }
|
53
53
|
it { should eql 'codefresh-branch' }
|
54
54
|
end
|
55
55
|
|
56
|
-
context "when environment doesn't exist" do
|
56
|
+
context "when the environment doesn't exist" do
|
57
57
|
it { should be nil }
|
58
58
|
end
|
59
59
|
end
|
@@ -22,12 +22,12 @@ describe KnapsackPro::Config::CI::Codeship do
|
|
22
22
|
describe '#node_build_id' do
|
23
23
|
subject { described_class.new.node_build_id }
|
24
24
|
|
25
|
-
context 'when environment exists' do
|
25
|
+
context 'when the environment exists' do
|
26
26
|
let(:env) { { 'CI_BUILD_NUMBER' => 2013 } }
|
27
27
|
it { should eql 2013 }
|
28
28
|
end
|
29
29
|
|
30
|
-
context "when environment doesn't exist" do
|
30
|
+
context "when the environment doesn't exist" do
|
31
31
|
it { should be nil }
|
32
32
|
end
|
33
33
|
end
|
@@ -35,12 +35,12 @@ describe KnapsackPro::Config::CI::Codeship do
|
|
35
35
|
describe '#commit_hash' do
|
36
36
|
subject { described_class.new.commit_hash }
|
37
37
|
|
38
|
-
context 'when environment exists' do
|
38
|
+
context 'when the environment exists' do
|
39
39
|
let(:env) { { 'CI_COMMIT_ID' => 'a22aec3ee5d334fd658da35646b42bc5' } }
|
40
40
|
it { should eql 'a22aec3ee5d334fd658da35646b42bc5' }
|
41
41
|
end
|
42
42
|
|
43
|
-
context "when environment doesn't exist" do
|
43
|
+
context "when the environment doesn't exist" do
|
44
44
|
it { should be nil }
|
45
45
|
end
|
46
46
|
end
|
@@ -48,12 +48,12 @@ describe KnapsackPro::Config::CI::Codeship do
|
|
48
48
|
describe '#branch' do
|
49
49
|
subject { described_class.new.branch }
|
50
50
|
|
51
|
-
context 'when environment exists' do
|
51
|
+
context 'when the environment exists' do
|
52
52
|
let(:env) { { 'CI_BRANCH' => 'master' } }
|
53
53
|
it { should eql 'master' }
|
54
54
|
end
|
55
55
|
|
56
|
-
context "when environment doesn't exist" do
|
56
|
+
context "when the environment doesn't exist" do
|
57
57
|
it { should be nil }
|
58
58
|
end
|
59
59
|
end
|
@@ -22,12 +22,25 @@ describe KnapsackPro::Config::CI::GithubActions do
|
|
22
22
|
describe '#node_build_id' do
|
23
23
|
subject { described_class.new.node_build_id }
|
24
24
|
|
25
|
-
context 'when environment exists' do
|
25
|
+
context 'when the environment exists' do
|
26
26
|
let(:env) { { 'GITHUB_RUN_ID' => 2706 } }
|
27
27
|
it { should eql 2706 }
|
28
28
|
end
|
29
29
|
|
30
|
-
context "when environment doesn't exist" do
|
30
|
+
context "when the environment doesn't exist" do
|
31
|
+
it { should be nil }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#node_retry_count' do
|
36
|
+
subject { described_class.new.node_retry_count }
|
37
|
+
|
38
|
+
context 'when the environment exists' do
|
39
|
+
let(:env) { { 'GITHUB_RUN_ATTEMPT' => 2 } }
|
40
|
+
it { should eql 1 }
|
41
|
+
end
|
42
|
+
|
43
|
+
context "when the environment doesn't exist" do
|
31
44
|
it { should be nil }
|
32
45
|
end
|
33
46
|
end
|
@@ -35,12 +48,12 @@ describe KnapsackPro::Config::CI::GithubActions do
|
|
35
48
|
describe '#commit_hash' do
|
36
49
|
subject { described_class.new.commit_hash }
|
37
50
|
|
38
|
-
context 'when environment exists' do
|
51
|
+
context 'when the environment exists' do
|
39
52
|
let(:env) { { 'GITHUB_SHA' => '2e13512fc230d6f9ebf4923352718e4d' } }
|
40
53
|
it { should eql '2e13512fc230d6f9ebf4923352718e4d' }
|
41
54
|
end
|
42
55
|
|
43
|
-
context "when environment doesn't exist" do
|
56
|
+
context "when the environment doesn't exist" do
|
44
57
|
it { should be nil }
|
45
58
|
end
|
46
59
|
end
|
@@ -48,7 +61,7 @@ describe KnapsackPro::Config::CI::GithubActions do
|
|
48
61
|
describe '#branch' do
|
49
62
|
subject { described_class.new.branch }
|
50
63
|
|
51
|
-
context 'when environment exists' do
|
64
|
+
context 'when the environment exists' do
|
52
65
|
context 'when GITHUB_REF has value' do
|
53
66
|
let(:env) do
|
54
67
|
{
|
@@ -71,7 +84,7 @@ describe KnapsackPro::Config::CI::GithubActions do
|
|
71
84
|
end
|
72
85
|
end
|
73
86
|
|
74
|
-
context "when environment doesn't exist" do
|
87
|
+
context "when the environment doesn't exist" do
|
75
88
|
it { should be nil }
|
76
89
|
end
|
77
90
|
end
|
@@ -79,12 +92,12 @@ describe KnapsackPro::Config::CI::GithubActions do
|
|
79
92
|
describe '#project_dir' do
|
80
93
|
subject { described_class.new.project_dir }
|
81
94
|
|
82
|
-
context 'when environment exists' do
|
95
|
+
context 'when the environment exists' do
|
83
96
|
let(:env) { { 'GITHUB_WORKSPACE' => '/home/runner/work/my-repo-name/my-repo-name' } }
|
84
97
|
it { should eql '/home/runner/work/my-repo-name/my-repo-name' }
|
85
98
|
end
|
86
99
|
|
87
|
-
context "when environment doesn't exist" do
|
100
|
+
context "when the environment doesn't exist" do
|
88
101
|
it { should be nil }
|
89
102
|
end
|
90
103
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'CI_NODE_TOTAL' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists and is in GitLab CI' do
|
26
|
+
context 'when the environment exists and is in GitLab CI' do
|
27
27
|
let(:env) { { 'CI_NODE_INDEX' => 4, 'GITLAB_CI' => 'true' } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -46,7 +46,7 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
46
46
|
it { should eql 7046508 }
|
47
47
|
end
|
48
48
|
|
49
|
-
context "when environment doesn't exist" do
|
49
|
+
context "when the environment doesn't exist" do
|
50
50
|
it { should be nil }
|
51
51
|
end
|
52
52
|
end
|
@@ -64,7 +64,7 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
64
64
|
it { should eql 'f76c468e3e1d570f71f5822b1e48bb04' }
|
65
65
|
end
|
66
66
|
|
67
|
-
context "when environment doesn't exist" do
|
67
|
+
context "when the environment doesn't exist" do
|
68
68
|
it { should be nil }
|
69
69
|
end
|
70
70
|
end
|
@@ -82,7 +82,7 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
82
82
|
it { should eql 'main' }
|
83
83
|
end
|
84
84
|
|
85
|
-
context "when environment doesn't exist" do
|
85
|
+
context "when the environment doesn't exist" do
|
86
86
|
it { should be nil }
|
87
87
|
end
|
88
88
|
end
|
@@ -90,12 +90,12 @@ describe KnapsackPro::Config::CI::GitlabCI do
|
|
90
90
|
describe '#project_dir' do
|
91
91
|
subject { described_class.new.project_dir }
|
92
92
|
|
93
|
-
context 'when environment exists' do
|
93
|
+
context 'when the environment exists' do
|
94
94
|
let(:env) { { 'CI_PROJECT_DIR' => '/home/user/knapsack_pro-ruby' } }
|
95
95
|
it { should eql '/home/user/knapsack_pro-ruby' }
|
96
96
|
end
|
97
97
|
|
98
|
-
context "when environment doesn't exist" do
|
98
|
+
context "when the environment doesn't exist" do
|
99
99
|
it { should be nil }
|
100
100
|
end
|
101
101
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::Heroku do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'CI_NODE_TOTAL' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::Heroku do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists' do
|
26
|
+
context 'when the environment exists' do
|
27
27
|
let(:env) { { 'CI_NODE_INDEX' => 3 } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -36,12 +36,12 @@ describe KnapsackPro::Config::CI::Heroku do
|
|
36
36
|
describe '#node_build_id' do
|
37
37
|
subject { described_class.new.node_build_id }
|
38
38
|
|
39
|
-
context 'when environment exists' do
|
39
|
+
context 'when the environment exists' do
|
40
40
|
let(:env) { { 'HEROKU_TEST_RUN_ID' => 1234 } }
|
41
41
|
it { should eql 1234 }
|
42
42
|
end
|
43
43
|
|
44
|
-
context "when environment doesn't exist" do
|
44
|
+
context "when the environment doesn't exist" do
|
45
45
|
it { should be nil }
|
46
46
|
end
|
47
47
|
end
|
@@ -49,12 +49,12 @@ describe KnapsackPro::Config::CI::Heroku do
|
|
49
49
|
describe '#commit_hash' do
|
50
50
|
subject { described_class.new.commit_hash }
|
51
51
|
|
52
|
-
context 'when environment exists' do
|
52
|
+
context 'when the environment exists' do
|
53
53
|
let(:env) { { 'HEROKU_TEST_RUN_COMMIT_VERSION' => 'abbaec3ee5d334fd658da35646b42bc5' } }
|
54
54
|
it { should eql 'abbaec3ee5d334fd658da35646b42bc5' }
|
55
55
|
end
|
56
56
|
|
57
|
-
context "when environment doesn't exist" do
|
57
|
+
context "when the environment doesn't exist" do
|
58
58
|
it { should be nil }
|
59
59
|
end
|
60
60
|
end
|
@@ -62,12 +62,12 @@ describe KnapsackPro::Config::CI::Heroku do
|
|
62
62
|
describe '#branch' do
|
63
63
|
subject { described_class.new.branch }
|
64
64
|
|
65
|
-
context 'when environment exists' do
|
65
|
+
context 'when the environment exists' do
|
66
66
|
let(:env) { { 'HEROKU_TEST_RUN_BRANCH' => 'master' } }
|
67
67
|
it { should eql 'master' }
|
68
68
|
end
|
69
69
|
|
70
|
-
context "when environment doesn't exist" do
|
70
|
+
context "when the environment doesn't exist" do
|
71
71
|
it { should be nil }
|
72
72
|
end
|
73
73
|
end
|
@@ -75,12 +75,12 @@ describe KnapsackPro::Config::CI::Heroku do
|
|
75
75
|
describe '#project_dir' do
|
76
76
|
subject { described_class.new.project_dir }
|
77
77
|
|
78
|
-
context 'when environment exists' do
|
78
|
+
context 'when the environment exists' do
|
79
79
|
let(:env) { { 'HEROKU_TEST_RUN_ID' => 1234 } }
|
80
80
|
it { should eq '/app' }
|
81
81
|
end
|
82
82
|
|
83
|
-
context "when environment doesn't exist" do
|
83
|
+
context "when the environment doesn't exist" do
|
84
84
|
it { should be nil }
|
85
85
|
end
|
86
86
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::Semaphore2 do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'SEMAPHORE_JOB_COUNT' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::Semaphore2 do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists' do
|
26
|
+
context 'when the environment exists' do
|
27
27
|
let(:env) { { 'SEMAPHORE_JOB_INDEX' => 4 } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -36,12 +36,12 @@ describe KnapsackPro::Config::CI::Semaphore2 do
|
|
36
36
|
describe '#node_build_id' do
|
37
37
|
subject { described_class.new.node_build_id }
|
38
38
|
|
39
|
-
context 'when environment exists' do
|
39
|
+
context 'when the environment exists' do
|
40
40
|
let(:env) { { 'SEMAPHORE_WORKFLOW_ID' => 123 } }
|
41
41
|
it { should eql 123 }
|
42
42
|
end
|
43
43
|
|
44
|
-
context "when environment doesn't exist" do
|
44
|
+
context "when the environment doesn't exist" do
|
45
45
|
it { should be nil }
|
46
46
|
end
|
47
47
|
end
|
@@ -49,12 +49,12 @@ describe KnapsackPro::Config::CI::Semaphore2 do
|
|
49
49
|
describe '#commit_hash' do
|
50
50
|
subject { described_class.new.commit_hash }
|
51
51
|
|
52
|
-
context 'when environment exists' do
|
52
|
+
context 'when the environment exists' do
|
53
53
|
let(:env) { { 'SEMAPHORE_GIT_SHA' => '4323320992a21b1169e3ac5b7789d379597738e6' } }
|
54
54
|
it { should eql '4323320992a21b1169e3ac5b7789d379597738e6' }
|
55
55
|
end
|
56
56
|
|
57
|
-
context "when environment doesn't exist" do
|
57
|
+
context "when the environment doesn't exist" do
|
58
58
|
it { should be nil }
|
59
59
|
end
|
60
60
|
end
|
@@ -62,12 +62,12 @@ describe KnapsackPro::Config::CI::Semaphore2 do
|
|
62
62
|
describe '#branch' do
|
63
63
|
subject { described_class.new.branch }
|
64
64
|
|
65
|
-
context 'when environment exists' do
|
65
|
+
context 'when the environment exists' do
|
66
66
|
let(:env) { { 'SEMAPHORE_GIT_BRANCH' => 'master' } }
|
67
67
|
it { should eql 'master' }
|
68
68
|
end
|
69
69
|
|
70
|
-
context "when environment doesn't exist" do
|
70
|
+
context "when the environment doesn't exist" do
|
71
71
|
it { should be nil }
|
72
72
|
end
|
73
73
|
end
|
@@ -103,7 +103,7 @@ describe KnapsackPro::Config::CI::Semaphore2 do
|
|
103
103
|
it { should be nil }
|
104
104
|
end
|
105
105
|
|
106
|
-
context "when environments don't exist" do
|
106
|
+
context "when the environments don't exist" do
|
107
107
|
it { should be nil }
|
108
108
|
end
|
109
109
|
end
|
@@ -10,12 +10,12 @@ describe KnapsackPro::Config::CI::Semaphore do
|
|
10
10
|
describe '#node_total' do
|
11
11
|
subject { described_class.new.node_total }
|
12
12
|
|
13
|
-
context 'when environment exists' do
|
13
|
+
context 'when the environment exists' do
|
14
14
|
let(:env) { { 'SEMAPHORE_THREAD_COUNT' => 4 } }
|
15
15
|
it { should eql 4 }
|
16
16
|
end
|
17
17
|
|
18
|
-
context "when environment doesn't exist" do
|
18
|
+
context "when the environment doesn't exist" do
|
19
19
|
it { should be nil }
|
20
20
|
end
|
21
21
|
end
|
@@ -23,12 +23,12 @@ describe KnapsackPro::Config::CI::Semaphore do
|
|
23
23
|
describe '#node_index' do
|
24
24
|
subject { described_class.new.node_index }
|
25
25
|
|
26
|
-
context 'when environment exists' do
|
26
|
+
context 'when the environment exists' do
|
27
27
|
let(:env) { { 'SEMAPHORE_CURRENT_THREAD' => 4 } }
|
28
28
|
it { should eql 3 }
|
29
29
|
end
|
30
30
|
|
31
|
-
context "when environment doesn't exist" do
|
31
|
+
context "when the environment doesn't exist" do
|
32
32
|
it { should be nil }
|
33
33
|
end
|
34
34
|
end
|
@@ -36,12 +36,12 @@ describe KnapsackPro::Config::CI::Semaphore do
|
|
36
36
|
describe '#node_build_id' do
|
37
37
|
subject { described_class.new.node_build_id }
|
38
38
|
|
39
|
-
context 'when environment exists' do
|
39
|
+
context 'when the environment exists' do
|
40
40
|
let(:env) { { 'SEMAPHORE_BUILD_NUMBER' => 23 } }
|
41
41
|
it { should eql 23 }
|
42
42
|
end
|
43
43
|
|
44
|
-
context "when environment doesn't exist" do
|
44
|
+
context "when the environment doesn't exist" do
|
45
45
|
it { should be nil }
|
46
46
|
end
|
47
47
|
end
|
@@ -49,12 +49,12 @@ describe KnapsackPro::Config::CI::Semaphore do
|
|
49
49
|
describe '#commit_hash' do
|
50
50
|
subject { described_class.new.commit_hash }
|
51
51
|
|
52
|
-
context 'when environment exists' do
|
52
|
+
context 'when the environment exists' do
|
53
53
|
let(:env) { { 'REVISION' => '3fa64859337f6e56409d49f865d13fd7' } }
|
54
54
|
it { should eql '3fa64859337f6e56409d49f865d13fd7' }
|
55
55
|
end
|
56
56
|
|
57
|
-
context "when environment doesn't exist" do
|
57
|
+
context "when the environment doesn't exist" do
|
58
58
|
it { should be nil }
|
59
59
|
end
|
60
60
|
end
|
@@ -62,12 +62,12 @@ describe KnapsackPro::Config::CI::Semaphore do
|
|
62
62
|
describe '#branch' do
|
63
63
|
subject { described_class.new.branch }
|
64
64
|
|
65
|
-
context 'when environment exists' do
|
65
|
+
context 'when the environment exists' do
|
66
66
|
let(:env) { { 'BRANCH_NAME' => 'master' } }
|
67
67
|
it { should eql 'master' }
|
68
68
|
end
|
69
69
|
|
70
|
-
context "when environment doesn't exist" do
|
70
|
+
context "when the environment doesn't exist" do
|
71
71
|
it { should be nil }
|
72
72
|
end
|
73
73
|
end
|
@@ -75,12 +75,12 @@ describe KnapsackPro::Config::CI::Semaphore do
|
|
75
75
|
describe '#project_dir' do
|
76
76
|
subject { described_class.new.project_dir }
|
77
77
|
|
78
|
-
context 'when environment exists' do
|
78
|
+
context 'when the environment exists' do
|
79
79
|
let(:env) { { 'SEMAPHORE_PROJECT_DIR' => '/home/runner/knapsack_pro-ruby' } }
|
80
80
|
it { should eql '/home/runner/knapsack_pro-ruby' }
|
81
81
|
end
|
82
82
|
|
83
|
-
context "when environment doesn't exist" do
|
83
|
+
context "when the environment doesn't exist" do
|
84
84
|
it { should be nil }
|
85
85
|
end
|
86
86
|
end
|
@@ -22,12 +22,12 @@ describe KnapsackPro::Config::CI::Travis do
|
|
22
22
|
describe '#node_build_id' do
|
23
23
|
subject { described_class.new.node_build_id }
|
24
24
|
|
25
|
-
context 'when environment exists' do
|
25
|
+
context 'when the environment exists' do
|
26
26
|
let(:env) { { 'TRAVIS_BUILD_NUMBER' => 4 } }
|
27
27
|
it { should eql 4 }
|
28
28
|
end
|
29
29
|
|
30
|
-
context "when environment doesn't exist" do
|
30
|
+
context "when the environment doesn't exist" do
|
31
31
|
it { should be nil }
|
32
32
|
end
|
33
33
|
end
|
@@ -35,12 +35,12 @@ describe KnapsackPro::Config::CI::Travis do
|
|
35
35
|
describe '#commit_hash' do
|
36
36
|
subject { described_class.new.commit_hash }
|
37
37
|
|
38
|
-
context 'when environment exists' do
|
38
|
+
context 'when the environment exists' do
|
39
39
|
let(:env) { { 'TRAVIS_COMMIT' => '3fa64859337f6e56409d49f865d13fd7' } }
|
40
40
|
it { should eql '3fa64859337f6e56409d49f865d13fd7' }
|
41
41
|
end
|
42
42
|
|
43
|
-
context "when environment doesn't exist" do
|
43
|
+
context "when the environment doesn't exist" do
|
44
44
|
it { should be nil }
|
45
45
|
end
|
46
46
|
end
|
@@ -48,12 +48,12 @@ describe KnapsackPro::Config::CI::Travis do
|
|
48
48
|
describe '#branch' do
|
49
49
|
subject { described_class.new.branch }
|
50
50
|
|
51
|
-
context 'when environment exists' do
|
51
|
+
context 'when the environment exists' do
|
52
52
|
let(:env) { { 'TRAVIS_BRANCH' => 'master' } }
|
53
53
|
it { should eql 'master' }
|
54
54
|
end
|
55
55
|
|
56
|
-
context "when environment doesn't exist" do
|
56
|
+
context "when the environment doesn't exist" do
|
57
57
|
it { should be nil }
|
58
58
|
end
|
59
59
|
end
|
@@ -61,12 +61,12 @@ describe KnapsackPro::Config::CI::Travis do
|
|
61
61
|
describe '#project_dir' do
|
62
62
|
subject { described_class.new.project_dir }
|
63
63
|
|
64
|
-
context 'when environment exists' do
|
64
|
+
context 'when the environment exists' do
|
65
65
|
let(:env) { { 'TRAVIS_BUILD_DIR' => '/home/travis/build/KnapsackPro/rails-app-with-knapsack_pro' } }
|
66
66
|
it { should eql '/home/travis/build/KnapsackPro/rails-app-with-knapsack_pro' }
|
67
67
|
end
|
68
68
|
|
69
|
-
context "when environment doesn't exist" do
|
69
|
+
context "when the environment doesn't exist" do
|
70
70
|
it { should be nil }
|
71
71
|
end
|
72
72
|
end
|
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: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -404,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
404
404
|
- !ruby/object:Gem::Version
|
405
405
|
version: '0'
|
406
406
|
requirements: []
|
407
|
-
rubygems_version: 3.4.
|
407
|
+
rubygems_version: 3.4.10
|
408
408
|
signing_key:
|
409
409
|
specification_version: 4
|
410
410
|
summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
|