knapsack_pro 5.0.0 → 5.1.0

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: d4e0c8f7bd4c8bf4c50885cdbcbecf34222a3d1ab46d3be52d937d940a0ba5c0
4
+ data.tar.gz: b8a68e22c872686d20fc6fac50ec3d02bad449768da522eb36ed86db5d331dfc
5
5
  SHA512:
6
- metadata.gz: 8afa9cc8410a16af780fcc854ebed0f50959eaa8c5cbdbe8fadb67e3822494ef2f18d56ee6158b1503d4db5be129a308e1e7794aab853685163b9888d70f18be
7
- data.tar.gz: 4304ce7d54d20e43ed4576989f9700ef68f25a099671cb42a578f27ccb6fcc67dd1d2c7c0c546a96a0af9a570bc5b6c8c6c2d0742c6f1868f7a77557cd50d45f
6
+ metadata.gz: 34d669379edb42f5a3e3eaf9075320bd1e2457ec48dfae86d94e2fa21eb4562d1fcc2db66ed49749ef78a641741d934e6d978bc9cc557d5985e49eb9bbed133d
7
+ data.tar.gz: bde90595bb3123c0c10b53d58de5b78637a2c30679f3ab5e37283735ce3a4f6bcbc19a39be7fcf691f6878f5be0018d16e3eb0bc8adc9f2d6f23827de72f0bb2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ### 5.1.0
4
+
5
+ * Mask user seats data instead of hashing it
6
+
7
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/202
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v5.0.0...v5.1.0
10
+
11
+
3
12
  ### 5.0.0
4
13
 
5
14
  * __(breaking change)__ Use `KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true` as default value in Queue Mode and use `false` for proper CI providers
@@ -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]
@@ -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.0'
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 }
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.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-07 00:00:00.000000000 Z
11
+ date: 2023-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -389,7 +389,7 @@ metadata:
389
389
  documentation_uri: https://docs.knapsackpro.com/integration/
390
390
  homepage_uri: https://knapsackpro.com
391
391
  source_code_uri: https://github.com/KnapsackPro/knapsack_pro-ruby
392
- post_install_message:
392
+ post_install_message:
393
393
  rdoc_options: []
394
394
  require_paths:
395
395
  - lib
@@ -404,8 +404,8 @@ 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.10
408
- signing_key:
407
+ rubygems_version: 3.3.7
408
+ signing_key:
409
409
  specification_version: 4
410
410
  summary: Knapsack Pro splits tests across parallel CI nodes and ensures each parallel
411
411
  job finish work at a similar time.