knapsack_pro 5.0.0 → 5.1.1

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: ee1c87eca84a9ac30345268d7d2e9ac71d09003098e5173f73c0a3afccfea7bf
4
- data.tar.gz: 52d53bd9c42699151ec2ac5ed6d340cbcdd0b632b88f2da60fcae54db3984090
3
+ metadata.gz: 58063b1846ea84151755a05ad9f4cca8297246b78ff0c47d140576cb0d32e19c
4
+ data.tar.gz: bf36f5e4232ae62eb835dea8f6aeb0d767f5bef88e7aabf7fea2508c8017068a
5
5
  SHA512:
6
- metadata.gz: 8afa9cc8410a16af780fcc854ebed0f50959eaa8c5cbdbe8fadb67e3822494ef2f18d56ee6158b1503d4db5be129a308e1e7794aab853685163b9888d70f18be
7
- data.tar.gz: 4304ce7d54d20e43ed4576989f9700ef68f25a099671cb42a578f27ccb6fcc67dd1d2c7c0c546a96a0af9a570bc5b6c8c6c2d0742c6f1868f7a77557cd50d45f
6
+ metadata.gz: 756a63cd54c3e35e60cd09ba057c026d5ab279dab5bdd295bccfb49c6f235f68835e956171a19d9a8c5ca21db46de204e22867c879dae331fe482ffefe906189
7
+ data.tar.gz: 54e7d11084f8eab1ace9e225f0a1455dd9b391f33742cafa475b2ce144024f8509d7afcb0915f663784f0ead5407b7accee33d90acb19c44a6ab845c8507e0b5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ### 5.1.1
4
+
5
+ * Use `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` as default value in Queue Mode for GitLab CI
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/206
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.1.0...v5.1.1
10
+
11
+ ### 5.1.0
12
+
13
+ * Mask user seats data instead of hashing it
14
+
15
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/202
16
+
17
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.0.0...v5.1.0
18
+
19
+
3
20
  ### 5.0.0
4
21
 
5
22
  * __(breaking change)__ Use `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` as default value in Queue Mode and use `false` for proper CI providers
@@ -10,6 +27,10 @@
10
27
 
11
28
  https://github.com/KnapsackPro/knapsack_pro-ruby/pull/201
12
29
 
30
+ __(breaking change)__ for Buildkite. You need to pass the `BUILDKITE` environment variable to Docker Compose.
31
+
32
+ https://github.com/KnapsackPro/knapsack_pro-ruby/issues/204
33
+
13
34
  * Set `RAILS_ENV=test` / `RACK_ENV=test` in Queue Mode
14
35
 
15
36
  https://github.com/KnapsackPro/knapsack_pro-ruby/pull/199
@@ -15,7 +15,7 @@ module KnapsackPro
15
15
  :node_total => args.fetch(:node_total),
16
16
  :node_index => args.fetch(:node_index),
17
17
  :ci_build_id => KnapsackPro::Config::Env.ci_node_build_id,
18
- :user_seat => KnapsackPro::Config::Env.user_seat_hash,
18
+ :user_seat => KnapsackPro::Config::Env.masked_user_seat,
19
19
  }
20
20
 
21
21
  unless request_hash[:cache_read_attempt]
@@ -16,7 +16,7 @@ module KnapsackPro
16
16
  :node_total => args.fetch(:node_total),
17
17
  :node_index => args.fetch(:node_index),
18
18
  :node_build_id => KnapsackPro::Config::Env.ci_node_build_id,
19
- :user_seat => KnapsackPro::Config::Env.user_seat_hash,
19
+ :user_seat => KnapsackPro::Config::Env.masked_user_seat,
20
20
  }
21
21
 
22
22
  if request_hash[:can_initialize_queue] && !request_hash[:attempt_connect_to_queue]
@@ -43,7 +43,7 @@ module KnapsackPro
43
43
  end
44
44
 
45
45
  def fixed_queue_split
46
- false
46
+ true
47
47
  end
48
48
  end
49
49
  end
@@ -64,9 +64,10 @@ module KnapsackPro
64
64
  ci_env_for(:user_seat)
65
65
  end
66
66
 
67
- def user_seat_hash
67
+ def masked_user_seat
68
68
  return unless user_seat
69
- Digest::SHA2.hexdigest(user_seat)
69
+
70
+ user_seat.gsub(/(?<=\w{2})[a-zA-Z]/, "*")
70
71
  end
71
72
 
72
73
  def test_file_pattern
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '5.0.0'
2
+ VERSION = '5.1.1'
3
3
  end
@@ -6,7 +6,7 @@ describe KnapsackPro::Client::API::V1::BuildDistributions do
6
6
  let(:node_total) { double }
7
7
  let(:node_index) { double }
8
8
  let(:ci_build_id) { double }
9
- let(:user_seat_hash) { double }
9
+ let(:masked_user_seat) { double }
10
10
  let(:test_files) { double }
11
11
 
12
12
  subject do
@@ -23,7 +23,7 @@ describe KnapsackPro::Client::API::V1::BuildDistributions do
23
23
  before do
24
24
  expect(KnapsackPro::Config::Env).to receive(:fixed_test_suite_split).and_return(fixed_test_suite_split)
25
25
  expect(KnapsackPro::Config::Env).to receive(:ci_node_build_id).and_return(ci_build_id)
26
- expect(KnapsackPro::Config::Env).to receive(:user_seat_hash).and_return(user_seat_hash)
26
+ expect(KnapsackPro::Config::Env).to receive(:masked_user_seat).and_return(masked_user_seat)
27
27
  end
28
28
 
29
29
  context 'when cache_read_attempt=true' do
@@ -42,7 +42,7 @@ describe KnapsackPro::Client::API::V1::BuildDistributions do
42
42
  node_total: node_total,
43
43
  node_index: node_index,
44
44
  ci_build_id: ci_build_id,
45
- user_seat: user_seat_hash,
45
+ user_seat: masked_user_seat,
46
46
  }
47
47
  }).and_return(action)
48
48
  expect(subject).to eq action
@@ -65,7 +65,7 @@ describe KnapsackPro::Client::API::V1::BuildDistributions do
65
65
  node_total: node_total,
66
66
  node_index: node_index,
67
67
  ci_build_id: ci_build_id,
68
- user_seat: user_seat_hash,
68
+ user_seat: masked_user_seat,
69
69
  test_files: test_files
70
70
  }
71
71
  }).and_return(action)
@@ -7,7 +7,7 @@ describe KnapsackPro::Client::API::V1::Queues do
7
7
  let(:node_index) { double }
8
8
  let(:test_files) { double }
9
9
  let(:node_build_id) { double }
10
- let(:user_seat_hash) { double }
10
+ let(:masked_user_seat) { double }
11
11
 
12
12
  subject do
13
13
  described_class.queue(
@@ -24,7 +24,7 @@ describe KnapsackPro::Client::API::V1::Queues do
24
24
  before do
25
25
  expect(KnapsackPro::Config::Env).to receive(:fixed_queue_split).and_return(fixed_queue_split)
26
26
  expect(KnapsackPro::Config::Env).to receive(:ci_node_build_id).and_return(node_build_id)
27
- expect(KnapsackPro::Config::Env).to receive(:user_seat_hash).and_return(user_seat_hash)
27
+ expect(KnapsackPro::Config::Env).to receive(:masked_user_seat).and_return(masked_user_seat)
28
28
  end
29
29
 
30
30
  context 'when can_initialize_queue=true and attempt_connect_to_queue=true' do
@@ -45,7 +45,7 @@ describe KnapsackPro::Client::API::V1::Queues do
45
45
  node_total: node_total,
46
46
  node_index: node_index,
47
47
  node_build_id: node_build_id,
48
- user_seat: user_seat_hash,
48
+ user_seat: masked_user_seat,
49
49
  }
50
50
  }).and_return(action)
51
51
  expect(subject).to eq action
@@ -70,7 +70,7 @@ describe KnapsackPro::Client::API::V1::Queues do
70
70
  node_total: node_total,
71
71
  node_index: node_index,
72
72
  node_build_id: node_build_id,
73
- user_seat: user_seat_hash,
73
+ user_seat: masked_user_seat,
74
74
  test_files: test_files
75
75
  }
76
76
  }).and_return(action)
@@ -96,7 +96,7 @@ describe KnapsackPro::Client::API::V1::Queues do
96
96
  node_total: node_total,
97
97
  node_index: node_index,
98
98
  node_build_id: node_build_id,
99
- user_seat: user_seat_hash,
99
+ user_seat: masked_user_seat,
100
100
  }
101
101
  }).and_return(action)
102
102
  expect(subject).to eq action
@@ -207,22 +207,26 @@ describe KnapsackPro::Config::Env do
207
207
  end
208
208
  end
209
209
 
210
- describe '.user_seat_hash' do
211
- subject { described_class.user_seat_hash }
210
+ describe '.masked_seat_hash' do
211
+ subject { described_class.masked_user_seat }
212
212
 
213
213
  before do
214
214
  expect(described_class).to receive(:user_seat).at_least(1).and_return(user_seat)
215
215
  end
216
216
 
217
- context 'when the user seat has a value' do
217
+ context 'when the user seat is a name' do
218
218
  let(:user_seat) { 'John Doe' }
219
219
 
220
- it 'returns a SHA256 hash for the user seat' do
221
- expect(subject).to eq '6cea57c2fb6cbc2a40411135005760f241fffc3e5e67ab99882726431037f908'
222
- end
220
+ it { expect(subject).to eq 'Jo** Do*' }
221
+ end
222
+
223
+ context 'when the user seat is an e-mail' do
224
+ let(:user_seat) { 'john.doe@example.com' }
225
+
226
+ it { expect(subject).to eq 'jo**.do*@ex*****.co*' }
223
227
  end
224
228
 
225
- context 'when the user seat has no value' do
229
+ context 'when the user seat is nil' do
226
230
  let(:user_seat) { nil }
227
231
 
228
232
  it { expect(subject).to be_nil }
@@ -724,7 +728,7 @@ describe KnapsackPro::Config::Env do
724
728
  ['Codefresh', { 'CF_BUILD_ID' => '123' }, false],
725
729
  ['Codeship', { 'CI_NAME' => 'codeship' }, true],
726
730
  ['GitHub Actions', { 'GITHUB_ACTIONS' => 'true' }, true],
727
- ['GitLab CI', { 'GITLAB_CI' => 'true' }, false],
731
+ ['GitLab CI', { 'GITLAB_CI' => 'true' }, true],
728
732
  ['Heroku CI', { 'HEROKU_TEST_RUN_ID' => '123' }, false],
729
733
  ['Semaphore CI 1.0', { 'SEMAPHORE_BUILD_NUMBER' => '123' }, false],
730
734
  ['Semaphore CI 2.0', { 'SEMAPHORE' => 'true', 'SEMAPHORE_WORKFLOW_ID' => '123' }, false],
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: 5.0.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-07 00:00:00.000000000 Z
11
+ date: 2023-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake