kettle-dev 3.1.39 → 3.1.41

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: 0b14e7434f6f14f4ce8d13b07fda59eb9fc869c7b9a9d31e841adeee856d3be5
4
- data.tar.gz: 17a445314db889dec7c090c2d6502df68e661a4f611739381da61213637314f9
3
+ metadata.gz: bf0e69682a72ff3f9debb5527d229782560d91c06fb9e5ac1305577eb69d035d
4
+ data.tar.gz: bec334cbf8d19acff4c7735206e9f5b8f5643509e6f85a60e9efc71c61fe4e4a
5
5
  SHA512:
6
- metadata.gz: 14ed3f6f7178f9aca3a32a602dbd69a995e91a29b1034d61f4c816552d7aa6c803dbd17d0724acdb9c394a4dc50bf060de1c0bffdbc8a2676d8cbdb25f049f17
7
- data.tar.gz: b2127ee81f5b95649e15162cd492c165a516aea7696816647a3d807c0d5b638d602eabf87a93716622936961ea9c17939985270c35d5c8e3a82fcd5106884080
6
+ metadata.gz: 9accbca8eaf70152a15e7e57e4924b28e108970b0245aad04a30c4bef3e23a30baccdf70ebbc1a50eaebe3169f40053dfe73b04c539c4e7a84eaa3a06932a2b7
7
+ data.tar.gz: 44b0402ae071d5cf15a4ee85649179ad406fd92715b866e2242696a214e2acb968a9fa79a35eadb9dd9125f94e0f55eb58ac9def0df0f011821cb8b012a2b12c
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,51 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [3.1.41] - 2026-12-04
34
+
35
+ - TAG: [v3.1.41][3.1.41t]
36
+ - COVERAGE: 91.57% -- 6749/7370 lines in 53 files
37
+ - BRANCH COVERAGE: 75.71% -- 2597/3430 branches in 53 files
38
+ - 57.12% documented
39
+
40
+ ### Changed
41
+
42
+ - Poll GitHub Actions in `Kettle::Dev::CIMonitor` with a single `GET /repos/{owner}/{repo}/actions/runs?head_sha={sha}&per_page=100` request per repo per cycle (`CIHelpers.latest_runs_for_head`, falling back to per-workflow `latest_run` if `total_count > 100`), cutting wave API volume by ~15x, and raise default `K_RELEASE_CI_POLL_INTERVAL` from 1s to 5s
43
+
44
+ ### Fixed
45
+
46
+ - Gate `kettle-release` `bundle install` phases (pre-step-0 lockfile materialization, borrowed changelog bundles, and standard `bin/setup`) on read-only `bundle check` with the identical release ENV, and serialize actual `bundle install` runs with a cross-process `flock` under XDG state so parallel family releases do not race on Bundler's shared `bundler/gems/` git checkouts
47
+
48
+ ## [3.1.40] - 2026-12-04
49
+
50
+ - TAG: [v3.1.40][3.1.40t]
51
+ - COVERAGE: 91.46% -- 6685/7309 lines in 53 files
52
+ - BRANCH COVERAGE: 75.71% -- 2574/3400 branches in 53 files
53
+ - 57.05% documented
54
+
55
+ ### Added
56
+
57
+ - Add optional soft CI time limit (`--ci-time-limit SECONDS` / `K_RELEASE_CI_TIME_LIMIT`) and required test-suite workflow override (`--ci-required-workflows` / `K_RELEASE_CI_REQUIRED_WORKFLOWS`) to `kettle-release` and `Kettle::Dev::CIMonitor`, allowing releases to proceed with a warning when required tests (`current.yml` if present, otherwise an allow-listed test workflow) have passed and no workflows have failed, while failing closed if tests have not passed
58
+ - kettle-jem-template-20261025-001 - Duel performance regression guards: the
59
+ Perf workflow compares each pull request, each push to main, and, on a
60
+ schedule, the last release, and `rake duel` compares local changes, with
61
+ the benchmarks in `duel/`.
62
+
63
+ ### Changed
64
+
65
+ - Exclude `perf-comment.yml` (PR-only `workflow_run`/`pull_request_target` workflow) from `CIHelpers.exclusions` so `kettle-release` does not fail with a branch trigger mismatch on `main`
66
+ - [kc] kettle-jem/template: updated 15 project files since the last release:
67
+ - code and tests (1)
68
+ - dependencies (7)
69
+ - documentation (1)
70
+ - other (3)
71
+ - workflows (3)
72
+
73
+ ### Fixed
74
+
75
+ - Replace `bundle update --bundler=VERSION` with `bundle lock --bundler=VERSION --add-checksums` in `LockfileReset#reset_command` so lockfile resets no longer install the entire bundle (including native/Rust gems like `structuredmerge-core`) into disposable `tmp/kettle-reset/gem-home-*` directories across parallel release waves
76
+ - Cache isolated `LockfileReset` Gemfile bootstrap gems (such as `nomono`) in a `flock`-guarded XDG cache keyed by Ruby ABI, gem name, version, and source, and cap `CARGO_BUILD_JOBS` during bootstrap installation
77
+
33
78
  ## [3.1.39] - 2026-12-03
34
79
 
35
80
  - TAG: [v3.1.39][3.1.39t]
@@ -4549,7 +4594,11 @@ Please file a bug if you notice a violation of semantic versioning.
4549
4594
  - Selecting will run the selected workflow via `act`
4550
4595
  - This may move to its own gem in the future.
4551
4596
 
4552
- [Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.39...HEAD
4597
+ [Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.41...HEAD
4598
+ [3.1.41]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.40...v3.1.41
4599
+ [3.1.41t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.41
4600
+ [3.1.40]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.39...v3.1.40
4601
+ [3.1.40t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.40
4553
4602
  [3.1.39]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.38...v3.1.39
4554
4603
  [3.1.39t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.39
4555
4604
  [3.1.38]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.37...v3.1.38
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # 🍲 Kettle::Dev
4
4
 
5
- [![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: AGPL-3.0-only][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf]
5
+ [![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: AGPL-3.0-only][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Heads][🚎3-hd-wfi]][🚎3-hd-wf] [![CI Runtime Dependencies @ HEAD][🚎12-crh-wfi]][🚎12-crh-wf] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Truffle Ruby][🚎9-t-wfi]][🚎9-t-wf] [![CI JRuby][🚎10-j-wfi]][🚎10-j-wf] [![Deps Locked][🚎13-🔒️-wfi]][🚎13-🔒️-wf] [![Deps Unlocked][🚎14-🔓️-wfi]][🚎14-🔓️-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf] [![CI Style][🚎5-st-wfi]][🚎5-st-wf] [![Duel][⚔️duel-img]][⚔️duel]
6
6
 
7
7
  `if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know on Discord][✉️discord-invite] or [RubyForum][✉️ruby-forum], as I may have missed the notification.
8
8
 
@@ -202,7 +202,12 @@ GitHub API and CI helpers
202
202
  - `GITHUB_TOKEN` or `GH_TOKEN`: Token used by `ci:act` and release workflow checks to query GitHub Actions status at higher rate limits
203
203
  - `GITLAB_TOKEN` or `GL_TOKEN`: Token used by `ci:act` and CI monitor to query GitLab pipeline status
204
204
  - `K_RELEASE_CI_REQUESTS_PER_MINUTE`: GitHub API request budget for the release CI monitor (default 90/min). Requests above the budget are spaced out; an exhausted quota parks the monitor until the reset instead of failing
205
+ - `K_RELEASE_CI_POLL_INTERVAL`: Seconds between GitHub Actions poll cycles (default 5; polls all workflows for `HEAD` in 1 `/actions/runs?head_sha=...` request per cycle)
205
206
  - `K_RELEASE_CI_JOBS_POLL_INTERVAL`: Minimum seconds between job-level polls of an in-flight workflow run during release CI monitoring (default 60). Job-level detection catches a failed job in a large matrix before the run concludes, without multiplying API request volume
207
+ - `K_RELEASE_CI_TIME_LIMIT`: Optional soft CI wait limit in seconds (also `--ci-time-limit SECONDS`, default unlimited). When reached with no failures, proceeds with a warning if `current.yml` (when present) or an allow-listed test workflow has passed; fails closed otherwise
208
+ - `K_RELEASE_CI_REQUIRED_WORKFLOWS`: Comma-separated test workflow files/stems required to pass before `--ci-time-limit` can bypass unfinished secondary workflows (also `--ci-required-workflows`)
209
+ - `KETTLE_DEV_RESET_BOOTSTRAP_CACHE`: Override the XDG cache directory (`~/.cache/kettle-dev/reset-bootstrap`) used to cache isolated `LockfileReset` bootstrap gems across parallel releases
210
+ - `KETTLE_DEV_BUNDLE_INSTALL_LOCK`: Override the XDG state `flock` path (`~/.local/state/kettle-dev/bundle-install-<ruby-abi>.lock`) used to serialize `bundle install` runs across parallel releases (redundant installs are skipped via `bundle check`)
206
211
 
207
212
  Releasing and signing
208
213
 
@@ -365,6 +370,7 @@ What it does:
365
370
  - After a transient CI or provider failure with no code, version, changelog, or lockfile changes, restart at the failed step: for example, `bundle exec kettle-release --start-step 10` for CI monitoring or `bundle exec kettle-release --start-step 15` for RubyGems publication. The legacy `start_step=10` spelling remains supported.
366
371
  - If the failure required a code or release-metadata change, rerun `bundle exec kettle-release` from step 0 so the release checks, prep metadata, commit, and CI all describe the new release commit.
367
372
  - For an intentional same-commit CI bypass, use `bundle exec kettle-release --skip-ci` (or `--skip-steps 10`); this skips remote CI monitoring only and does not claim that CI passed.
373
+ - To cap remote CI wait time while still requiring tests to pass: `bundle exec kettle-release --ci-time-limit 600` (optionally add `--ci-required-workflows current,locked_deps`).
368
374
  - To retain release documentation generation while bypassing a known Appraisal-only issue, use `bundle exec kettle-release --skip-appraisals`.
369
375
  - After fixing a failed pre-release gate, rerun from step 0: `bundle exec kettle-release`
370
376
  - After intentionally handling a failed pre-release gate, skip it and start numbered release steps: `bundle exec kettle-release --start-step 1`
@@ -1040,7 +1046,7 @@ Thanks for RTFM. ☺️
1040
1046
  [📌gitmoji]: https://gitmoji.dev
1041
1047
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
1042
1048
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
1043
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-7.194-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1049
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-7.370-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
1044
1050
  [🔐security]: https://github.com/kettle-dev/kettle-dev/blob/main/SECURITY.md
1045
1051
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
1046
1052
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -1050,6 +1056,8 @@ Thanks for RTFM. ☺️
1050
1056
  [📄license-compat]: https://www.apache.org/legal/resolved.html#category-x
1051
1057
  [📄license-compat-img]: https://img.shields.io/badge/Apache_Incompatible:_Category_X-%E2%9C%97-C0392B.svg?style=flat&logo=Apache
1052
1058
 
1059
+ [⚔️duel]: https://github.com/sferik/duel-ruby
1060
+ [⚔️duel-img]: https://raw.githubusercontent.com/sferik/duel-ruby/main/assets/badge.svg
1053
1061
  [📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
1054
1062
  [📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
1055
1063
  [🚎yard-current]: http://rubydoc.info/gems/kettle-dev
data/exe/kettle-release CHANGED
@@ -49,7 +49,7 @@ end
49
49
  # Do not guard with __FILE__ == $PROGRAM_NAME because binstubs use Kernel.load.
50
50
  if ARGV.include?("-h") || ARGV.include?("--help")
51
51
  puts <<~USAGE
52
- Usage: kettle-release [--version VERSION] [--local-ci] [--yes] [--appraisal-update] [--skip-changelog] [--skip-appraisals] [--skip-bundle-audit] [--start-step STEP] [--skip-ci] [--skip-steps STEPS] [--ci-workflows WORKFLOWS] [--skip-remotes REMOTES] [--required-remotes REMOTES] [--secrets-provider NAME] [--json|--events[=TYPES]] [--report PATH] [start_step=<0-19>]
52
+ Usage: kettle-release [--version VERSION] [--local-ci] [--yes] [--appraisal-update] [--skip-changelog] [--skip-appraisals] [--skip-bundle-audit] [--start-step STEP] [--skip-ci] [--skip-steps STEPS] [--ci-workflows WORKFLOWS] [--ci-time-limit SECONDS] [--ci-required-workflows WORKFLOWS] [--skip-remotes REMOTES] [--required-remotes REMOTES] [--secrets-provider NAME] [--json|--events[=TYPES]] [--report PATH] [start_step=<0-19>]
53
53
 
54
54
  Automates the release flow for a Ruby gem in the host project.
55
55
 
@@ -94,6 +94,8 @@ if ARGV.include?("-h") || ARGV.include?("--help")
94
94
  --skip-appraisals # Skip appraisal generation at step 5 but still generate documentation
95
95
  --skip-bundle-audit # Skip bundle:audit/update during release rake checks
96
96
  --ci-workflows WORKFLOWS # Comma-separated workflow files or stems to monitor at CI step 10
97
+ --ci-time-limit SECONDS # Soft CI wait limit (e.g., 600); proceeds if required tests passed and nothing failed
98
+ --ci-required-workflows WFS # Comma-separated test workflows required to pass before --ci-time-limit can bypass others
97
99
  --skip-remotes REMOTES # Comma-separated git remote names to exclude from release fetch/push parity
98
100
  --required-remotes REMOTES # Comma-separated remote names that must fetch for release parity; defaults to origin
99
101
  --secrets-provider NAME # Release secrets provider: interactive, 1password
@@ -264,6 +266,56 @@ def extract_ci_workflows_arg!(argv)
264
266
  workflows
265
267
  end
266
268
 
269
+ def extract_ci_time_limit_arg!(argv)
270
+ limit = nil
271
+ if (idx = argv.index("--ci-time-limit"))
272
+ limit = argv[idx + 1]
273
+ if limit.to_s.empty? || limit.to_s.start_with?("-")
274
+ Kettle::Dev::ExitAdapter.abort("--ci-time-limit requires a positive number of seconds")
275
+ end
276
+ argv.slice!(idx, 2)
277
+ end
278
+ argv.delete_if do |arg|
279
+ if arg.start_with?("--ci-time-limit=", "ci_time_limit=")
280
+ limit = arg.split("=", 2)[1]
281
+ Kettle::Dev::ExitAdapter.abort("--ci-time-limit requires a positive number of seconds") if limit.to_s.empty?
282
+ true
283
+ else
284
+ false
285
+ end
286
+ end
287
+ if limit
288
+ valid = begin
289
+ Float(limit).positive?
290
+ rescue ArgumentError, TypeError
291
+ false
292
+ end
293
+ Kettle::Dev::ExitAdapter.abort("--ci-time-limit requires a positive number of seconds") unless valid
294
+ end
295
+ limit
296
+ end
297
+
298
+ def extract_ci_required_workflows_arg!(argv)
299
+ workflows = nil
300
+ if (idx = argv.index("--ci-required-workflows"))
301
+ workflows = argv[idx + 1]
302
+ if workflows.to_s.empty? || workflows.to_s.start_with?("-")
303
+ Kettle::Dev::ExitAdapter.abort("--ci-required-workflows requires a comma-separated workflow list")
304
+ end
305
+ argv.slice!(idx, 2)
306
+ end
307
+ argv.delete_if do |arg|
308
+ if arg.start_with?("--ci-required-workflows=", "ci_required_workflows=")
309
+ workflows = arg.split("=", 2)[1]
310
+ Kettle::Dev::ExitAdapter.abort("--ci-required-workflows requires a comma-separated workflow list") if workflows.to_s.empty?
311
+ true
312
+ else
313
+ false
314
+ end
315
+ end
316
+ workflows
317
+ end
318
+
267
319
  def extract_skip_remotes_arg!(argv)
268
320
  remotes = nil
269
321
  if (idx = argv.index("--skip-remotes"))
@@ -379,6 +431,8 @@ version_override = extract_version_arg!(ARGV)
379
431
  skip_steps = extract_skip_steps_arg!(ARGV)
380
432
  skip_steps = [skip_steps, "10"].compact.join(",") if skip_ci
381
433
  ci_workflows = extract_ci_workflows_arg!(ARGV)
434
+ ci_time_limit = extract_ci_time_limit_arg!(ARGV)
435
+ ci_required_workflows = extract_ci_required_workflows_arg!(ARGV)
382
436
  skip_remotes = extract_skip_remotes_arg!(ARGV)
383
437
  required_remotes = extract_required_remotes_arg!(ARGV)
384
438
  report_path = extract_report_arg!(ARGV)
@@ -386,7 +440,7 @@ secrets_provider = extract_secrets_provider_arg!(ARGV)
386
440
 
387
441
  begin
388
442
  event_stream = events_output ? Kettle::Ndjson.event_stream($stdout, types: event_types) : nil
389
- Kettle::Dev::ReleaseCLI.new(start_step: start_step, local_ci: local_ci, version: version_override, appraisal_task: appraisal_task, skip_steps: skip_steps, skip_changelog: skip_changelog, skip_appraisals: skip_appraisals, skip_bundle_audit: skip_bundle_audit, ci_workflows: ci_workflows, skip_remotes: skip_remotes, required_remotes: required_remotes, secrets_provider_name: secrets_provider, yes: yes, event_stream: event_stream, json_output: json_output, json_io: $stdout, report_path: report_path).run
443
+ Kettle::Dev::ReleaseCLI.new(start_step: start_step, local_ci: local_ci, version: version_override, appraisal_task: appraisal_task, skip_steps: skip_steps, skip_changelog: skip_changelog, skip_appraisals: skip_appraisals, skip_bundle_audit: skip_bundle_audit, ci_workflows: ci_workflows, ci_time_limit: ci_time_limit, ci_required_workflows: ci_required_workflows, skip_remotes: skip_remotes, required_remotes: required_remotes, secrets_provider_name: secrets_provider, yes: yes, event_stream: event_stream, json_output: json_output, json_io: $stdout, report_path: report_path).run
390
444
  rescue LoadError => e
391
445
  warn("#{script_basename}: could not load dependency: #{e.class}: #{e.message}")
392
446
  warn(Array(e.backtrace).join("\n")) if ENV["DEBUG"]
@@ -100,12 +100,23 @@ module Kettle
100
100
  # Matched on basename rather than a fixed list because templates vary the exact names.
101
101
  SLOW_WORKFLOW_PATTERN = /mac|windows|heads|platforms/i
102
102
 
103
+ # Strict allow-list of workflow basenames that execute the project's test suite.
104
+ # Used by CIMonitor's optional CI time limit to verify tests passed before allowing
105
+ # still-running or queued secondary workflows to be bypassed.
106
+ TEST_WORKFLOW_PATTERN = /\A(current|locked_deps|unlocked_deps|supported|unsupported|rspec|spec|test|tests|ci)\.ya?ml\z/i
107
+
103
108
  # @param name [String] workflow basename
104
109
  # @return [Boolean]
105
110
  def slow_workflow?(name)
106
111
  name.to_s.match?(SLOW_WORKFLOW_PATTERN)
107
112
  end
108
113
 
114
+ # @param name [String] workflow basename
115
+ # @return [Boolean]
116
+ def test_workflow?(name)
117
+ name.to_s.match?(TEST_WORKFLOW_PATTERN)
118
+ end
119
+
109
120
  # List of workflow files to exclude from interactive menus and checks.
110
121
  # @return [Array<String>]
111
122
  def exclusions
@@ -116,6 +127,7 @@ module Kettle
116
127
  dependency-review.yml
117
128
  discord-notifier.yml
118
129
  opencollective.yml
130
+ perf-comment.yml
119
131
  scorecard-analysis.yml
120
132
  ]
121
133
  end
@@ -170,6 +182,50 @@ module Kettle
170
182
  nil
171
183
  end
172
184
 
185
+ # Fetch all workflow runs for +head_sha+ in a single API request and return
186
+ # a Hash of workflow basename => latest normalized run hash. Returns nil on
187
+ # transient failure or when total_count exceeds 100 so callers can fall back
188
+ # to per-workflow {#latest_run} queries.
189
+ # @param owner [String]
190
+ # @param repo [String]
191
+ # @param head_sha [String]
192
+ # @param token [String, nil]
193
+ # @return [Hash{String => Hash}, nil]
194
+ def latest_runs_for_head(owner:, repo:, head_sha:, token: default_token)
195
+ return nil if owner.to_s.empty? || repo.to_s.empty? || head_sha.to_s.empty?
196
+
197
+ url = "https://api.github.com/repos/#{owner}/#{repo}/actions/runs?head_sha=#{URI.encode_www_form_component(head_sha)}&per_page=100"
198
+ data = github_get_json(url, token: token)
199
+ return nil unless data.is_a?(Hash)
200
+ return nil if data["total_count"].to_i > 100
201
+
202
+ grouped = Hash.new { |h, k| h[k] = [] }
203
+ Array(data["workflow_runs"]).each do |run|
204
+ wf = File.basename(run["path"].to_s)
205
+ next if wf.empty?
206
+
207
+ grouped[wf] << run
208
+ end
209
+
210
+ grouped.each_with_object({}) do |(wf, runs), memo|
211
+ run = preferred_head_run(runs)
212
+ next unless run
213
+
214
+ memo[wf] = {
215
+ "status" => run["status"],
216
+ "conclusion" => run["conclusion"],
217
+ "html_url" => run["html_url"],
218
+ "id" => run["id"],
219
+ "head_sha" => run["head_sha"]
220
+ }
221
+ end
222
+ rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
223
+ raise
224
+ rescue => e
225
+ Kettle::Dev.debug_error(e, __method__)
226
+ nil
227
+ end
228
+
173
229
  def latest_repository_workflow_run(owner:, repo:, workflow_file:, branch:, head_sha:, token:)
174
230
  data = github_get_json(
175
231
  "https://api.github.com/repos/#{owner}/#{repo}/actions/runs?branch=#{URI.encode_www_form_component(branch)}&per_page=100",
@@ -48,18 +48,40 @@ module Kettle
48
48
  # tolerated through K_RELEASE_CI_CONTINUE.
49
49
  #
50
50
  # @param restart_hint [String] guidance command shown on failure
51
+ # @param time_limit [Numeric, String, nil] optional soft CI time limit in seconds
52
+ # @param required_workflows [Array<String>, String, nil] optional required test workflows for time-limit bypass
51
53
  # @return [Boolean] whether all configured CI providers passed
52
- def monitor_all!(restart_hint: "bundle exec kettle-release --start-step 10", workflows: nil, keepalive: nil, event_recorder: nil, **options)
54
+ def monitor_all!(restart_hint: "bundle exec kettle-release --start-step 10", workflows: nil, keepalive: nil, event_recorder: nil, time_limit: nil, required_workflows: nil, **options)
53
55
  clear_warnings!
56
+ resolved_limit = resolve_time_limit(time_limit)
57
+ deadline = resolved_limit ? (monotonic_time + resolved_limit) : nil
54
58
  # Rate limiting is recoverable: when the GitHub monitor parks for the
55
59
  # quota reset it returns :rate_limited and we re-enter it. GitLab has
56
60
  # no equivalent, so only the GitHub result drives the retry.
57
61
  results = nil
58
62
  loop do
59
- results = [
60
- monitor_github_internal!(restart_hint: restart_hint, workflows: workflows, keepalive: keepalive, event_recorder: event_recorder),
61
- monitor_gitlab_internal!(restart_hint: restart_hint, keepalive: keepalive, event_recorder: event_recorder)
62
- ]
63
+ gh_result = monitor_github_internal!(
64
+ restart_hint: restart_hint,
65
+ workflows: workflows,
66
+ keepalive: keepalive,
67
+ event_recorder: event_recorder,
68
+ deadline: deadline,
69
+ time_limit: resolved_limit,
70
+ required_workflows: required_workflows
71
+ )
72
+ gl_result = if gh_result == :rate_limited
73
+ nil
74
+ else
75
+ monitor_gitlab_internal!(
76
+ restart_hint: restart_hint,
77
+ keepalive: keepalive,
78
+ event_recorder: event_recorder,
79
+ deadline: deadline,
80
+ time_limit: resolved_limit,
81
+ github_passed: gh_result == true
82
+ )
83
+ end
84
+ results = [gh_result, gl_result]
63
85
  break unless results.first == :rate_limited
64
86
  end
65
87
  abort("CI configuration not detected (GitHub or GitLab). Ensure CI is configured and remotes point to the correct hosts.") if results.all?(&:nil?)
@@ -308,7 +330,7 @@ module Kettle
308
330
  end
309
331
  module_function :collect_gitlab
310
332
 
311
- def monitor_github_internal!(restart_hint:, workflows: nil, keepalive: nil, event_recorder: nil)
333
+ def monitor_github_internal!(restart_hint:, workflows: nil, keepalive: nil, event_recorder: nil, deadline: nil, time_limit: nil, required_workflows: nil)
312
334
  root = Kettle::Dev::CIHelpers.ci_project_root
313
335
  workflows = Array(workflows).empty? ? Kettle::Dev::CIHelpers.workflows_list(root) : Array(workflows)
314
336
  gh_remote = preferred_github_remote
@@ -343,6 +365,7 @@ module Kettle
343
365
  passed = {}
344
366
  failed = {}
345
367
  started = {}
368
+ last_status = {}
346
369
  emit_ci_monitor_event(
347
370
  event_recorder,
348
371
  action: "github_discover",
@@ -382,8 +405,10 @@ module Kettle
382
405
 
383
406
  sleep((initial_sleep && initial_sleep >= 0) ? initial_sleep : 3)
384
407
  start_timeout = github_start_timeout
408
+ start_timeout = [start_timeout, time_limit.to_i].min if time_limit&.positive?
385
409
  poll_interval = github_poll_interval
386
410
  start_deadline = monotonic_time + start_timeout
411
+ start_deadline = [start_deadline, deadline].min if deadline
387
412
  keepalive_timer = keepalive_timer(keepalive)
388
413
  all_started_emitted = false
389
414
  # Job-level failure detection polls one jobs endpoint per in-flight
@@ -409,11 +434,17 @@ module Kettle
409
434
  break if pending_workflows.empty?
410
435
 
411
436
  completed = passed.size + failed.size
437
+ batch_runs = Kettle::Dev::CIHelpers.latest_runs_for_head(owner: owner, repo: repo, head_sha: head_sha)
412
438
  pending_workflows.each do |wf|
413
439
  keepalive_timer.call
414
- run = Kettle::Dev::CIHelpers.latest_run(owner: owner, repo: repo, workflow_file: wf, branch: branch, require_head: true, head_sha: head_sha)
440
+ run = if batch_runs
441
+ batch_runs[wf]
442
+ else
443
+ Kettle::Dev::CIHelpers.latest_run(owner: owner, repo: repo, workflow_file: wf, branch: branch, require_head: true, head_sha: head_sha)
444
+ end
415
445
  completed_workflow = nil
416
446
  if run
447
+ last_status[wf] = run["status"].to_s unless run["status"].to_s.empty?
417
448
  unless started[wf]
418
449
  started[wf] = true
419
450
  emit_ci_monitor_event(
@@ -530,6 +561,19 @@ module Kettle
530
561
  )
531
562
  end
532
563
  break if completed == total
564
+ if deadline && monotonic_time >= deadline
565
+ return handle_github_time_limit!(
566
+ workflows: workflows,
567
+ passed: passed,
568
+ failed: failed,
569
+ last_status: last_status,
570
+ time_limit: time_limit,
571
+ required_workflows: required_workflows,
572
+ restart_hint: restart_hint,
573
+ pbar: pbar,
574
+ event_recorder: event_recorder
575
+ )
576
+ end
533
577
  if started.size < total && monotonic_time >= start_deadline
534
578
  missing = (workflows - started.keys).join(", ")
535
579
  puts
@@ -742,7 +786,7 @@ module Kettle
742
786
  rescue
743
787
  nil
744
788
  end
745
- (seconds && seconds >= 0) ? seconds : 1
789
+ (seconds && seconds >= 0) ? seconds : 5
746
790
  end
747
791
  module_function :github_poll_interval
748
792
 
@@ -771,7 +815,118 @@ module Kettle
771
815
  end
772
816
  module_function :keepalive_interval
773
817
 
774
- def monitor_gitlab_internal!(restart_hint:, keepalive: nil, event_recorder: nil)
818
+ def resolve_time_limit(explicit = nil)
819
+ raw = explicit.nil? ? ENV["K_RELEASE_CI_TIME_LIMIT"] : explicit
820
+ return nil if raw.nil? || raw.to_s.strip.empty?
821
+
822
+ seconds = Float(raw)
823
+ seconds.positive? ? seconds : nil
824
+ rescue ArgumentError, TypeError
825
+ nil
826
+ end
827
+ module_function :resolve_time_limit
828
+
829
+ def normalize_required_workflows(value)
830
+ raw = value.nil? ? ENV["K_RELEASE_CI_REQUIRED_WORKFLOWS"] : value
831
+ entries = case raw
832
+ when Array
833
+ raw
834
+ when String
835
+ raw.split(",")
836
+ else
837
+ []
838
+ end
839
+ entries.map { |entry| entry.to_s.strip }.reject(&:empty?).map do |entry|
840
+ entry.match?(/\.ya?ml\z/i) ? entry : "#{entry}.yml"
841
+ end.uniq
842
+ end
843
+ module_function :normalize_required_workflows
844
+
845
+ def evaluate_time_limit_gate(workflows:, passed:, failed:, required_workflows: nil)
846
+ return [false, "one or more workflows failed"] unless failed.empty?
847
+
848
+ explicit = normalize_required_workflows(required_workflows)
849
+ unless explicit.empty?
850
+ matching = explicit & workflows
851
+ return [false, "none of the required workflows (#{explicit.join(", ")}) exist in this repo"] if matching.empty?
852
+
853
+ missing = matching.reject { |wf| passed[wf] }
854
+ return [true, matching.join(", ")] if missing.empty?
855
+
856
+ return [false, "required workflow(s) did not pass in time: #{missing.join(", ")}"]
857
+ end
858
+
859
+ test_wfs = workflows.select { |wf| Kettle::Dev::CIHelpers.test_workflow?(wf) }
860
+ return [false, "no test-suite workflows matched the allow-list (fail-closed)"] if test_wfs.empty?
861
+
862
+ if workflows.include?("current.yml")
863
+ return [true, "current.yml"] if passed["current.yml"]
864
+
865
+ return [false, "current.yml did not pass in time"]
866
+ end
867
+
868
+ passed_tests = test_wfs.select { |wf| passed[wf] }
869
+ return [true, passed_tests.join(", ")] unless passed_tests.empty?
870
+
871
+ [false, "no test-suite workflow passed in time (checked: #{test_wfs.join(", ")})"]
872
+ end
873
+ module_function :evaluate_time_limit_gate
874
+
875
+ def handle_github_time_limit!(workflows:, passed:, failed:, last_status:, time_limit:, required_workflows:, restart_hint:, pbar:, event_recorder:)
876
+ pbar&.finish unless pbar&.finished?
877
+ ok, detail = evaluate_time_limit_gate(
878
+ workflows: workflows,
879
+ passed: passed,
880
+ failed: failed,
881
+ required_workflows: required_workflows
882
+ )
883
+ pending_wfs = workflows.reject { |wf| passed[wf] || failed[wf] }
884
+ bypassed = pending_wfs.map { |wf| "#{wf} (#{last_status[wf] || "not_started"})" }
885
+ limit_i = time_limit.to_i
886
+
887
+ if ok
888
+ msg = "CI time limit (#{limit_i}s) reached: #{passed.size}/#{workflows.size} passed " \
889
+ "(test suite verified: #{detail}); bypassing unfinished workflow(s): #{bypassed.join(", ")}"
890
+ warn("\nWARNING: #{msg}")
891
+ record_warning(kind: "ci_time_limit_bypass", message: msg)
892
+ emit_ci_monitor_event(
893
+ event_recorder,
894
+ action: "github_time_limit",
895
+ status: "warning",
896
+ provider: "github",
897
+ time_limit: limit_i,
898
+ passed: passed.keys,
899
+ verified_tests: detail,
900
+ bypassed: bypassed,
901
+ completed: passed.size + failed.size,
902
+ total: workflows.size,
903
+ reason: msg
904
+ )
905
+ return true
906
+ end
907
+
908
+ msg = "CI time limit (#{limit_i}s) reached without required tests passing (#{detail}). " \
909
+ "Unfinished: #{bypassed.join(", ")}. Fix or rerun CI, then restart with: #{restart_hint}"
910
+ emit_ci_monitor_event(
911
+ event_recorder,
912
+ action: "github_time_limit",
913
+ status: "failed",
914
+ provider: "github",
915
+ time_limit: limit_i,
916
+ passed: passed.keys,
917
+ pending: bypassed,
918
+ completed: passed.size + failed.size,
919
+ total: workflows.size,
920
+ reason: msg
921
+ )
922
+ abort(msg) unless continue_ci_failures?
923
+
924
+ puts "\n#{msg} Continuing because K_RELEASE_CI_CONTINUE=true."
925
+ false
926
+ end
927
+ module_function :handle_github_time_limit!
928
+
929
+ def monitor_gitlab_internal!(restart_hint:, keepalive: nil, event_recorder: nil, deadline: nil, time_limit: nil, github_passed: false)
775
930
  root = Kettle::Dev::CIHelpers.ci_project_root
776
931
  gitlab_ci = File.exist?(File.join(root, ".gitlab-ci.yml"))
777
932
  gl_remote = gitlab_remote_candidates.first
@@ -876,6 +1031,40 @@ module Kettle
876
1031
  break
877
1032
  end
878
1033
  end
1034
+ if deadline && monotonic_time >= deadline
1035
+ pbar&.finish unless pbar&.finished?
1036
+ limit_i = time_limit.to_i
1037
+ if github_passed
1038
+ msg = "GitLab pipeline still running at CI time limit (#{limit_i}s); proceeding because GitHub tests passed."
1039
+ warn("\nWARNING: #{msg}")
1040
+ record_warning(kind: "ci_time_limit_bypass", message: msg)
1041
+ emit_ci_monitor_event(
1042
+ event_recorder,
1043
+ action: "gitlab_time_limit",
1044
+ status: "warning",
1045
+ provider: "gitlab",
1046
+ time_limit: limit_i,
1047
+ completed: 0,
1048
+ total: 1,
1049
+ reason: msg
1050
+ )
1051
+ return true
1052
+ end
1053
+ msg = "GitLab pipeline did not complete within CI time limit (#{limit_i}s). Fix or rerun CI, then restart with: #{restart_hint}"
1054
+ emit_ci_monitor_event(
1055
+ event_recorder,
1056
+ action: "gitlab_time_limit",
1057
+ status: "failed",
1058
+ provider: "gitlab",
1059
+ time_limit: limit_i,
1060
+ completed: 0,
1061
+ total: 1,
1062
+ reason: msg
1063
+ )
1064
+ abort(msg) unless continue_ci_failures?
1065
+ puts "\n#{msg} Continuing because K_RELEASE_CI_CONTINUE=true."
1066
+ return false
1067
+ end
879
1068
  sleep(1)
880
1069
  end
881
1070
  pbar&.finish unless pbar&.finished?
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "digest"
4
+ require "etc"
5
+ require "rbconfig"
3
6
  require "set"
4
7
  require "shellwords"
5
8
  require "fileutils"
@@ -208,7 +211,8 @@ module Kettle
208
211
  end
209
212
 
210
213
  with_isolated_gem_paths do |gem_home|
211
- install_gemfile_bootstrap_gems!(gemfile: gemfile, lockfile: path, gem_home: gem_home)
214
+ bootstrap_dirs = install_gemfile_bootstrap_gems!(gemfile: gemfile, lockfile: path, gem_home: gem_home)
215
+ isolated_gem_path = ([gem_home] + bootstrap_dirs).uniq.join(File::PATH_SEPARATOR)
212
216
  command = reset_command(
213
217
  path: path,
214
218
  gemfile: gemfile,
@@ -217,6 +221,7 @@ module Kettle
217
221
  skip_changelog_dependency: skip_changelog_dependency,
218
222
  update_bundler: update_bundler,
219
223
  isolated_gem_home: gem_home,
224
+ isolated_gem_path: isolated_gem_path,
220
225
  strict: strict
221
226
  )
222
227
  if full_update || has_local_path_remote?(path, strict: strict)
@@ -256,17 +261,13 @@ module Kettle
256
261
  command << " --add-platform #{platforms.map { |platform| Shellwords.escape(platform) }.join(" ")}" unless platforms.empty?
257
262
  command << " --update"
258
263
  command << " #{update_gems.map { |gem_name| Shellwords.escape(gem_name) }.join(" ")}" unless update_gems.empty?
259
- command << " --add-checksums" unless update_bundler
260
- return command unless update_bundler
261
-
262
- # `bundle lock --bundler` accepts a requirement and retains a locked
263
- # prerelease that satisfies it. `bundle update --bundler=VERSION`
264
- # records the exact Bundler that is executing the reset instead.
265
- # Finish with `bundle lock --add-checksums`, since `bundle update`
266
- # does not support that option.
267
- bundler_version = Shellwords.escape(Bundler::VERSION)
268
- command << " && #{command_prefix} bundle update --bundler=#{bundler_version}"
269
- command << " && #{command_prefix} bundle lock --add-checksums"
264
+ # Use `bundle lock --bundler=VERSION` (NOT `bundle update --bundler=...`):
265
+ # `bundle update` installs the entire bundle (including native/Rust gems)
266
+ # into the disposable isolated GEM_HOME, whereas `bundle lock --bundler=`
267
+ # records the exact Bundler version in `BUNDLED WITH` without installing
268
+ # any gems.
269
+ command << " --bundler=#{Shellwords.escape(Bundler::VERSION)}" if update_bundler
270
+ command << " --add-checksums"
270
271
  command
271
272
  end
272
273
 
@@ -606,10 +607,13 @@ module Kettle
606
607
  end
607
608
 
608
609
  # Bundler evaluates a Gemfile and its static eval_gemfile inputs before it
609
- # resolves declared gems. Install only literal bootstrap requires into the
610
- # reset sandbox so unrelated gems from the invoking Ruby cannot influence
611
- # resolution.
610
+ # resolves declared gems. Install only literal bootstrap requires into a
611
+ # versioned, flock-guarded XDG cache keyed by Ruby ABI, gem name, version,
612
+ # and source so parallel family releases compile native bootstrap deps
613
+ # (e.g., structuredmerge-core via nomono) once instead of N times concurrently,
614
+ # while keeping Bundler isolated from the host Ruby's Gem.path.
612
615
  def install_gemfile_bootstrap_gems!(gemfile:, lockfile:, gem_home:)
616
+ bootstrap_dirs = []
613
617
  gemfile_bootstrap_gems(gemfile).each do |name, required_by_root_gemfile|
614
618
  version = locked_registry_gem_version(lockfile, name)
615
619
  source_url = registry_source_urls(lockfile).first
@@ -620,8 +624,51 @@ module Kettle
620
624
  raise Error, "Cannot isolate Gemfile bootstrap #{name.inspect}: #{display_path(lockfile)} does not lock it from a registry source"
621
625
  end
622
626
 
623
- command_runner.call(bootstrap_gem_install_command(name, version, source_url, gem_home))
627
+ cache_dir = bootstrap_cache_dir(name: name, version: version, source_url: source_url)
628
+ ensure_bootstrap_gem_installed!(name: name, version: version, source_url: source_url, cache_dir: cache_dir)
629
+ bootstrap_dirs << cache_dir
624
630
  end
631
+ bootstrap_dirs
632
+ end
633
+
634
+ def bootstrap_cache_root
635
+ override = ENV["KETTLE_DEV_RESET_BOOTSTRAP_CACHE"].to_s.strip
636
+ return override unless override.empty?
637
+
638
+ xdg_cache = ENV["XDG_CACHE_HOME"].to_s.strip
639
+ base = xdg_cache.empty? ? File.join(Dir.home, ".cache") : xdg_cache
640
+ File.join(base, "kettle-dev", "reset-bootstrap")
641
+ end
642
+
643
+ def bootstrap_cache_dir(name:, version:, source_url:)
644
+ ruby_abi = "#{RUBY_ENGINE}-#{RbConfig::CONFIG["ruby_version"]}-#{RUBY_PLATFORM}"
645
+ source_digest = Digest::SHA256.hexdigest(source_url.to_s)[0, 12]
646
+ File.join(bootstrap_cache_root, ruby_abi, "#{name}-#{version}-#{source_digest}")
647
+ end
648
+
649
+ def ensure_bootstrap_gem_installed!(name:, version:, source_url:, cache_dir:)
650
+ ready_stamp = File.join(cache_dir, ".ready")
651
+ return if File.file?(ready_stamp)
652
+
653
+ FileUtils.mkdir_p(File.dirname(cache_dir))
654
+ lock_path = "#{cache_dir}.lock"
655
+ File.open(lock_path, File::RDWR | File::CREAT, 0o600) do |lock_file|
656
+ lock_file.flock(File::LOCK_EX)
657
+ next if File.file?(ready_stamp)
658
+
659
+ FileUtils.mkdir_p(cache_dir)
660
+ command_runner.call(bootstrap_gem_install_command(name, version, source_url, cache_dir))
661
+ File.write(ready_stamp, "#{name} #{version}\n")
662
+ end
663
+ end
664
+
665
+ def bootstrap_cargo_build_jobs
666
+ explicit = ENV["CARGO_BUILD_JOBS"].to_s.strip
667
+ return explicit unless explicit.empty?
668
+
669
+ (Etc.nprocessors / 4).clamp(2, 4).to_s
670
+ rescue
671
+ "2"
625
672
  end
626
673
 
627
674
  def gemfile_bootstrap_gems(gemfile)
@@ -689,7 +736,11 @@ module Kettle
689
736
  end
690
737
 
691
738
  def bootstrap_gem_install_command(name, version, source_url, gem_home)
692
- env = unbundled_env.merge("GEM_HOME" => gem_home, "GEM_PATH" => gem_home)
739
+ env = unbundled_env.merge(
740
+ "GEM_HOME" => gem_home,
741
+ "GEM_PATH" => gem_home,
742
+ "CARGO_BUILD_JOBS" => bootstrap_cargo_build_jobs
743
+ )
693
744
  command = +"env"
694
745
  env.each do |key, value|
695
746
  assignment = value.nil? ? " -u #{key}" : " #{key}=#{Shellwords.escape(value)}"
@@ -238,7 +238,7 @@ module Kettle
238
238
 
239
239
  public
240
240
 
241
- def initialize(start_step: 0, local_ci: false, version: nil, appraisal_task: nil, skip_steps: nil, skip_changelog: nil, skip_appraisals: nil, skip_bundle_audit: nil, ci_workflows: nil, skip_remotes: nil, required_remotes: nil, secrets_provider_name: nil, yes: false, **options)
241
+ def initialize(start_step: 0, local_ci: false, version: nil, appraisal_task: nil, skip_steps: nil, skip_changelog: nil, skip_appraisals: nil, skip_bundle_audit: nil, ci_workflows: nil, ci_time_limit: nil, ci_required_workflows: nil, skip_remotes: nil, required_remotes: nil, secrets_provider_name: nil, yes: false, **options)
242
242
  @root = Kettle::Dev::CIHelpers.project_root
243
243
  @git = Kettle::Dev::GitAdapter.new(@root)
244
244
  @start_step = (start_step || 0).to_i
@@ -247,6 +247,8 @@ module Kettle
247
247
  @skip_changelog = truthy_value?(skip_changelog) || truthy_value?(ENV["KETTLE_DEV_SKIP_CHANGELOG"])
248
248
  @skip_appraisals = truthy_value?(skip_appraisals) || truthy_value?(ENV["KETTLE_DEV_SKIP_APPRAISALS"])
249
249
  @ci_workflows = normalize_ci_workflows(ci_workflows || ENV["K_RELEASE_CI_WORKFLOWS"])
250
+ @ci_time_limit = Kettle::Dev::CIMonitor.resolve_time_limit(ci_time_limit)
251
+ @ci_required_workflows = normalize_ci_workflows(ci_required_workflows || ENV["K_RELEASE_CI_REQUIRED_WORKFLOWS"])
250
252
  @skip_remotes = normalize_remote_names(skip_remotes || ENV["K_RELEASE_SKIP_REMOTES"], "skip remotes")
251
253
  @required_remotes = normalize_required_remotes(required_remotes)
252
254
  @local_ci = !!local_ci
@@ -424,7 +426,7 @@ module Kettle
424
426
  prepare_rubocop_lts_local_branch! if rubocop_lts_release_preflight_needed?
425
427
 
426
428
  # 3. bin/setup
427
- with_release_resume_step(3) { run_cmd!(release_setup_command) } if run_step?(3)
429
+ with_release_resume_step(3) { run_release_setup! } if run_step?(3)
428
430
  # 4. bin/rake
429
431
  with_release_resume_step(4) { run_cmd!(release_default_task_command) } if run_step?(4)
430
432
 
@@ -898,15 +900,22 @@ module Kettle
898
900
  begin
899
901
  stage = "before release task bundle installs"
900
902
  task_lockfile = release_task_lockfile_path(gemfile: gemfile)
903
+ install_env = {
904
+ "BUNDLE_GEMFILE" => gemfile,
905
+ "BUNDLE_LOCKFILE" => task_lockfile || lockfile
906
+ }
907
+ if bundle_satisfied?(environment: install_env)
908
+ emit_release_lockfile_event(action: "install", status: "ok", stage: stage, reason: "#{File.basename(gemfile)} (already satisfied)")
909
+ next
910
+ end
911
+
901
912
  emit_release_lockfile_event(action: "install", status: "started", stage: stage, reason: File.basename(gemfile))
902
913
  puts "Installing normalized release bundle for #{File.basename(gemfile)}..."
903
- run_cmd!(release_child_command(
904
- "bundle install",
905
- environment: {
906
- "BUNDLE_GEMFILE" => gemfile,
907
- "BUNDLE_LOCKFILE" => task_lockfile || lockfile
908
- }
909
- ))
914
+ with_bundle_install_lock do
915
+ unless bundle_satisfied?(environment: install_env)
916
+ run_cmd!(release_child_command("bundle install", environment: install_env))
917
+ end
918
+ end
910
919
  emit_release_lockfile_event(action: "install", status: "ok", stage: stage, reason: File.basename(gemfile))
911
920
  rescue => error
912
921
  emit_release_lockfile_event(action: "install", status: "failed", stage: stage, reason: error.message)
@@ -1163,8 +1172,14 @@ module Kettle
1163
1172
  if (lockfile = release_borrowed_bundle_lockfile(gemfile))
1164
1173
  environment["BUNDLE_LOCKFILE"] = lockfile
1165
1174
  end
1175
+ next if bundle_satisfied?(environment: environment)
1176
+
1166
1177
  puts "Installing changelog bundle for #{gemfile}..."
1167
- run_cmd!(release_child_command("bundle install", environment: environment))
1178
+ with_bundle_install_lock do
1179
+ unless bundle_satisfied?(environment: environment)
1180
+ run_cmd!(release_child_command("bundle install", environment: environment))
1181
+ end
1182
+ end
1168
1183
  end
1169
1184
  end
1170
1185
 
@@ -1281,6 +1296,57 @@ module Kettle
1281
1296
  release_project_command("bin/setup")
1282
1297
  end
1283
1298
 
1299
+ def run_release_setup!
1300
+ if standard_bundle_install_setup? && bundle_satisfied?
1301
+ puts "Bundle already satisfied; skipping redundant bin/setup."
1302
+ return
1303
+ end
1304
+
1305
+ with_bundle_install_lock { run_cmd!(release_setup_command) }
1306
+ end
1307
+
1308
+ def standard_bundle_install_setup?
1309
+ setup_path = File.join(@root, "bin", "setup")
1310
+ return false unless File.file?(setup_path)
1311
+
1312
+ content = File.read(setup_path)
1313
+ return false unless content.include?('bundle "${bundle_args[@]}"') || content.include?("bundle install")
1314
+
1315
+ # Only treat as standard bundle-install-only wrapper when there are no
1316
+ # custom non-comment lines after the bundle invocation.
1317
+ tail = content.split(/bundle (?:"\$\{bundle_args\[@\]\}"|install)/, 2).last.to_s
1318
+ tail.lines.none? { |line| !line.strip.empty? && !line.strip.start_with?("#") }
1319
+ rescue SystemCallError
1320
+ false
1321
+ end
1322
+
1323
+ def bundle_satisfied?(environment: {})
1324
+ cmd = release_child_command("bundle check", environment: environment)
1325
+ _out, _err, status = Open3.capture3(cmd, chdir: @root)
1326
+ status.success?
1327
+ rescue SystemCallError
1328
+ false
1329
+ end
1330
+
1331
+ def bundle_install_lock_path
1332
+ override = ENV["KETTLE_DEV_BUNDLE_INSTALL_LOCK"].to_s.strip
1333
+ return override unless override.empty?
1334
+
1335
+ xdg_state = ENV["XDG_STATE_HOME"].to_s.strip
1336
+ base = xdg_state.empty? ? File.join(Dir.home, ".local", "state") : xdg_state
1337
+ ruby_abi = "#{RUBY_ENGINE}-#{RbConfig::CONFIG["ruby_version"]}-#{RUBY_PLATFORM}"
1338
+ File.join(base, "kettle-dev", "bundle-install-#{ruby_abi}.lock")
1339
+ end
1340
+
1341
+ def with_bundle_install_lock
1342
+ lock_path = bundle_install_lock_path
1343
+ FileUtils.mkdir_p(File.dirname(lock_path))
1344
+ File.open(lock_path, File::RDWR | File::CREAT, 0o600) do |lock_file|
1345
+ lock_file.flock(File::LOCK_EX)
1346
+ yield
1347
+ end
1348
+ end
1349
+
1284
1350
  # Canonical release commands use the tracked project lockfiles. These
1285
1351
  # lockfiles are shared state and are normalized/committed before release
1286
1352
  # prep; they must never contain sibling PATH sources.
@@ -1593,7 +1659,9 @@ module Kettle
1593
1659
  restart_hint: restart_hint,
1594
1660
  workflows: @ci_workflows,
1595
1661
  keepalive: release_secrets_keepalive_required? ? -> { keep_release_secrets_alive!("CI monitoring") } : nil,
1596
- event_recorder: @event_recorder
1662
+ event_recorder: @event_recorder,
1663
+ time_limit: @ci_time_limit,
1664
+ required_workflows: @ci_required_workflows.empty? ? nil : @ci_required_workflows
1597
1665
  )
1598
1666
  if ci_ok
1599
1667
  emit_ci_monitor_event(action: "finish", status: "ok", workflows: @ci_workflows, restart_hint: restart_hint)
@@ -5,7 +5,7 @@ module Kettle
5
5
  # Version namespace for this gem.
6
6
  module Version
7
7
  # Current gem version.
8
- VERSION = "3.1.39"
8
+ VERSION = "3.1.41"
9
9
  end
10
10
  # Current gem version exposed at the traditional constant location.
11
11
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.39
4
+ version: 3.1.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -64,7 +64,7 @@ dependencies:
64
64
  -
65
65
  - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 0.3.22
67
+ version: 0.3.23
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
@@ -76,7 +76,7 @@ dependencies:
76
76
  -
77
77
  - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.3.22
79
+ version: 0.3.23
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: kettle-ndjson
82
82
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +88,7 @@ dependencies:
88
88
  -
89
89
  - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 0.1.25
91
+ version: 0.1.27
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
@@ -100,7 +100,7 @@ dependencies:
100
100
  -
101
101
  - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.1.25
103
+ version: 0.1.27
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: kettle-rb
106
106
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +112,7 @@ dependencies:
112
112
  -
113
113
  - ">="
114
114
  - !ruby/object:Gem::Version
115
- version: 0.1.22
115
+ version: 0.1.24
116
116
  type: :runtime
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
@@ -124,7 +124,7 @@ dependencies:
124
124
  -
125
125
  - ">="
126
126
  - !ruby/object:Gem::Version
127
- version: 0.1.22
127
+ version: 0.1.24
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: kettle-test
130
130
  requirement: !ruby/object:Gem::Requirement
@@ -136,7 +136,7 @@ dependencies:
136
136
  -
137
137
  - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 2.0.31
139
+ version: 2.0.32
140
140
  type: :runtime
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
@@ -148,7 +148,7 @@ dependencies:
148
148
  -
149
149
  - ">="
150
150
  - !ruby/object:Gem::Version
151
- version: 2.0.31
151
+ version: 2.0.32
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: ruby-progressbar
154
154
  requirement: !ruby/object:Gem::Requirement
@@ -479,10 +479,10 @@ licenses:
479
479
  - AGPL-3.0-only
480
480
  metadata:
481
481
  homepage_uri: "https://kettle-dev.galtzo.com"
482
- source_code_uri: "https://github.com/kettle-dev/kettle-dev/tree/v3.1.39"
483
- changelog_uri: "https://github.com/kettle-dev/kettle-dev/blob/v3.1.39/CHANGELOG.md"
482
+ source_code_uri: "https://github.com/kettle-dev/kettle-dev/tree/v3.1.41"
483
+ changelog_uri: "https://github.com/kettle-dev/kettle-dev/blob/v3.1.41/CHANGELOG.md"
484
484
  bug_tracker_uri: "https://github.com/kettle-dev/kettle-dev/issues"
485
- documentation_uri: "https://www.rubydoc.info/gems/kettle-dev/3.1.39"
485
+ documentation_uri: "https://www.rubydoc.info/gems/kettle-dev/3.1.41"
486
486
  funding_uri: "https://github.com/sponsors/pboling"
487
487
  wiki_uri: "https://github.com/kettle-dev/kettle-dev/wiki"
488
488
  news_uri: "https://www.railsbling.com/tags/kettle-dev"
metadata.gz.sig CHANGED
Binary file