ci-queue 0.47.0 → 0.49.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44d3c9d768457c849133f6886a33d756823e5d59393f045ffd22222538745e09
4
- data.tar.gz: 416acb36f1b32c8cbb170e71346522d735bf9375c7032f7337ef4fb5901b9e85
3
+ metadata.gz: 946f3f483ffbf8d89553c575d733767bd0851dffaa1439463ce43508f1727eb1
4
+ data.tar.gz: b74f1059c33686eacc6ef613900595ce8ff74d7fdd55f5f14c856c33fe35c2b3
5
5
  SHA512:
6
- metadata.gz: 41d246408b2a2cbc619978a37e67de356169ce048216359cf063b1f623b03a8073be4cf117cbedc6c19719d2ff13db94e07ad6cdc804fba104fea9ee5c236614
7
- data.tar.gz: bbe69b32ccc8253323ed181852fdea8c4a22cf6b69e0136bfafc0722421efa94ecf171ca669e6a454c7d0adc80d55f7b59ced7585e763047122ca0d01131f4c4
6
+ metadata.gz: 4eca10a80566c11cb600f133008848bde44adec4347f16ec174300e24fb7fafc8727f2dbeae90884b41c60ed784ea8477c5ac896fefac3a7170c84e6b87249fd
7
+ data.tar.gz: e8e04782df56a2b1cfd873e3ec9295f4e91b848f7f02cc99df41a349a45115a6ceb0fcd2263fc19e54dfe0b72fb870afc80bd74970f443920c0e31a7c5af8937
data/.gitignore CHANGED
@@ -4,7 +4,6 @@ test/fixtures/log/test_data.json
4
4
  /.byebug_history
5
5
  /.bundle/
6
6
  /.yardoc
7
- /Gemfile.lock
8
7
  /_yardoc/
9
8
  /coverage/
10
9
  /doc/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ci-queue (0.49.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (7.1.3.2)
10
+ base64
11
+ bigdecimal
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ connection_pool (>= 2.2.5)
14
+ drb
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ mutex_m
18
+ tzinfo (~> 2.0)
19
+ ansi (1.5.0)
20
+ ast (2.4.2)
21
+ base64 (0.2.0)
22
+ bigdecimal (3.1.7)
23
+ builder (3.2.4)
24
+ concurrent-ruby (1.2.3)
25
+ connection_pool (2.4.1)
26
+ diff-lcs (1.5.1)
27
+ docile (1.4.0)
28
+ drb (2.2.1)
29
+ i18n (1.14.4)
30
+ concurrent-ruby (~> 1.0)
31
+ json (2.7.1)
32
+ language_server-protocol (3.17.0.3)
33
+ minitest (5.22.3)
34
+ minitest-reporters (1.6.1)
35
+ ansi
36
+ builder
37
+ minitest (>= 5.0)
38
+ ruby-progressbar
39
+ msgpack (1.7.2)
40
+ mutex_m (0.2.0)
41
+ parallel (1.24.0)
42
+ parser (3.3.0.5)
43
+ ast (~> 2.4.1)
44
+ racc
45
+ racc (1.7.3)
46
+ rainbow (3.1.1)
47
+ rake (13.1.0)
48
+ redis (5.1.0)
49
+ redis-client (>= 0.17.0)
50
+ redis-client (0.21.1)
51
+ connection_pool
52
+ regexp_parser (2.9.0)
53
+ rexml (3.2.6)
54
+ rspec (3.13.0)
55
+ rspec-core (~> 3.13.0)
56
+ rspec-expectations (~> 3.13.0)
57
+ rspec-mocks (~> 3.13.0)
58
+ rspec-core (3.13.0)
59
+ rspec-support (~> 3.13.0)
60
+ rspec-expectations (3.13.0)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.13.0)
63
+ rspec-mocks (3.13.0)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.13.0)
66
+ rspec-support (3.13.1)
67
+ rubocop (1.62.1)
68
+ json (~> 2.3)
69
+ language_server-protocol (>= 3.17.0)
70
+ parallel (~> 1.10)
71
+ parser (>= 3.3.0.2)
72
+ rainbow (>= 2.2.2, < 4.0)
73
+ regexp_parser (>= 1.8, < 3.0)
74
+ rexml (>= 3.2.5, < 4.0)
75
+ rubocop-ast (>= 1.31.1, < 2.0)
76
+ ruby-progressbar (~> 1.7)
77
+ unicode-display_width (>= 2.4.0, < 3.0)
78
+ rubocop-ast (1.31.2)
79
+ parser (>= 3.3.0.4)
80
+ ruby-progressbar (1.13.0)
81
+ simplecov (0.22.0)
82
+ docile (~> 1.1)
83
+ simplecov-html (~> 0.11)
84
+ simplecov_json_formatter (~> 0.1)
85
+ simplecov-html (0.12.3)
86
+ simplecov_json_formatter (0.1.4)
87
+ snappy (0.4.0)
88
+ tzinfo (2.0.6)
89
+ concurrent-ruby (~> 1.0)
90
+ unicode-display_width (2.5.0)
91
+
92
+ PLATFORMS
93
+ arm64-darwin-23
94
+ ruby
95
+
96
+ DEPENDENCIES
97
+ activesupport
98
+ bundler
99
+ ci-queue!
100
+ minitest (~> 5.11)
101
+ minitest-reporters (~> 1.1)
102
+ msgpack
103
+ rake
104
+ redis
105
+ rspec (~> 3.10)
106
+ rubocop
107
+ simplecov (~> 0.12)
108
+ snappy
109
+
110
+ BUNDLED WITH
111
+ 2.5.3
data/ci-queue.gemspec CHANGED
@@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
19
19
  spec.homepage = 'https://github.com/Shopify/ci-queue'
20
20
  spec.license = 'MIT'
21
21
 
22
+ spec.required_ruby_version = '>= 2.7'
23
+
22
24
  spec.files = lua_scripts + `git ls-files -z`.split("\x0").reject do |f|
23
25
  f.match(%r{^(test|spec|features)/})
24
26
  end
data/dev.yml CHANGED
@@ -3,9 +3,9 @@
3
3
  name: ci-queue
4
4
 
5
5
  up:
6
- - ruby: 3.3.0
6
+ - ruby
7
7
  - bundler
8
8
  - redis
9
9
 
10
10
  commands:
11
- test: REDIS_URL=${REDIS_URL:-redis://ci-queue.railgun/0} bundle exec rake test TEST_FILES="$*"
11
+ test: REDIS_URL=${REDIS_URL} bundle exec rake test TEST_FILES="$*"
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module CI
3
4
  module Queue
4
5
  module Redis
@@ -17,11 +18,13 @@ module CI
17
18
  end
18
19
 
19
20
  def wait_for_workers
20
- wait_for_master(timeout: config.queue_init_timeout)
21
+ duration = measure do
22
+ wait_for_master(timeout: config.queue_init_timeout)
23
+ end
21
24
 
22
25
  yield if block_given?
23
26
 
24
- time_left = config.report_timeout
27
+ time_left = config.report_timeout - duration.to_i
25
28
  time_left_with_no_workers = config.inactive_workers_timeout
26
29
  until exhausted? || time_left <= 0 || max_test_failed? || time_left_with_no_workers <= 0
27
30
  time_left -= 1
@@ -44,6 +47,12 @@ module CI
44
47
 
45
48
  private
46
49
 
50
+ def measure
51
+ starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
52
+ yield
53
+ Process.clock_gettime(Process::CLOCK_MONOTONIC) - starting
54
+ end
55
+
47
56
  def active_workers?
48
57
  # if there are running jobs we assume there are still agents active
49
58
  redis.zrangebyscore(key('running'), CI::Queue.time_now.to_f - config.timeout, "+inf", limit: [0,1]).count > 0
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CI
4
4
  module Queue
5
- VERSION = '0.47.0'
5
+ VERSION = '0.49.0'
6
6
  DEV_SCRIPTS_ROOT = ::File.expand_path('../../../../../redis', __FILE__)
7
7
  RELEASE_SCRIPTS_ROOT = ::File.expand_path('../redis', __FILE__)
8
8
  end
@@ -49,7 +49,8 @@ module Minitest
49
49
 
50
50
  def run_command
51
51
  require_worker_id!
52
- if queue.retrying? || retry?
52
+ # if it's an automatic job retry we should process the main queue
53
+ if manual_retry?
53
54
  if queue.expired?
54
55
  abort! "The test run is too old and can't be retried"
55
56
  end
@@ -207,6 +208,12 @@ module Minitest
207
208
  puts
208
209
  end
209
210
 
211
+ if run_index == 0
212
+ step(yellow("The failing test was the first test in the test order so there is nothing to bisect."))
213
+ File.write('log/test_order.log', "")
214
+ exit! 1
215
+ end
216
+
210
217
  failing_order = queue.candidates
211
218
  step("Final validation")
212
219
  status = if run_tests_in_fork(failing_order)
@@ -220,7 +227,7 @@ module Minitest
220
227
  command += argv
221
228
 
222
229
  puts
223
- puts "cat <<EOF |\n#{failing_order.to_a.map(&:id).join("\n")}\nEOF\n#{command.join(' ')}"
230
+ puts "cat <<'EOF' |\n#{failing_order.to_a.map(&:id).join("\n")}\nEOF\n#{command.join(' ')}"
224
231
  puts
225
232
 
226
233
  File.write('log/test_order.log', failing_order.to_a.map(&:id).join("\n"))
@@ -665,6 +672,12 @@ module Minitest
665
672
  exit! exit_status # exit! is required to avoid minitest at_exit callback
666
673
  end
667
674
 
675
+ def manual_retry?
676
+ # this env variable only exists on Buildkite so we should default to manual for backward compatibility
677
+ (retry? || queue.retrying?) &&
678
+ ENV.fetch("BUILDKITE_RETRY_TYPE", "manual") == "manual"
679
+ end
680
+
668
681
  def retry?
669
682
  ENV["BUILDKITE_RETRY_COUNT"].to_i > 0 ||
670
683
  ENV["SEMAPHORE_PIPELINE_RERUN"] == "true"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci-queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
4
+ version: 0.49.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,7 +160,9 @@ extensions: []
160
160
  extra_rdoc_files: []
161
161
  files:
162
162
  - ".gitignore"
163
+ - ".ruby-version"
163
164
  - Gemfile
165
+ - Gemfile.lock
164
166
  - README.md
165
167
  - Rakefile
166
168
  - bin/bundler
@@ -171,7 +173,6 @@ files:
171
173
  - dev.yml
172
174
  - exe/minitest-queue
173
175
  - exe/rspec-queue
174
- - isogun.yml
175
176
  - lib/ci/queue.rb
176
177
  - lib/ci/queue/bisect.rb
177
178
  - lib/ci/queue/build_record.rb
@@ -234,14 +235,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
235
  requirements:
235
236
  - - ">="
236
237
  - !ruby/object:Gem::Version
237
- version: '0'
238
+ version: '2.7'
238
239
  required_rubygems_version: !ruby/object:Gem::Requirement
239
240
  requirements:
240
241
  - - ">="
241
242
  - !ruby/object:Gem::Version
242
243
  version: '0'
243
244
  requirements: []
244
- rubygems_version: 3.5.6
245
+ rubygems_version: 3.5.7
245
246
  signing_key:
246
247
  specification_version: 4
247
248
  summary: Distribute tests over many workers using a queue
data/isogun.yml DELETED
@@ -1,10 +0,0 @@
1
- # This file is for Shopify employees development environment.
2
- # If you are an external contributor you don't have to bother with it.
3
- name: ci-queue
4
-
5
- vm:
6
- ip_address: 192.168.64.245
7
- memory: 1G
8
- cores: 2
9
- services:
10
- - redis