kettle-dev 3.1.29 → 3.1.30
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +32 -1
- data/README.md +3 -17
- data/exe/kettle-rebase +35 -0
- data/lib/kettle/dev/bundler_pinning.rb +24 -1
- data/lib/kettle/dev/ci_helpers.rb +41 -1
- data/lib/kettle/dev/ci_monitor.rb +17 -14
- data/lib/kettle/dev/rebase.rb +158 -0
- data/lib/kettle/dev/rebase_cli.rb +43 -0
- data/lib/kettle/dev/version.rb +1 -1
- data/lib/kettle/dev.rb +2 -0
- data.tar.gz.sig +0 -0
- metadata +18 -14
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62eace57495f2a0d160543da47ecf374a614cf628d103af9130229ab6b4ed017
|
|
4
|
+
data.tar.gz: ddc207d797d064743fdf5c450d704dd344a7ab2f5b11bdc7bc97c08b8c388fd0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b250c0d33c91d78d78512497ef1270b8f80d45a2cc8d229f41a33d7cb452e663a3d12b34280f41e5543d8c08df10fd5fa310ceea5879b96f8d58b46e5b78d08
|
|
7
|
+
data.tar.gz: 0e74a3a7ecfa10e808826b46ae67d37a4288ff151b6af314ca74085471634ec88fb2007e0566a852011cca628e807a0adb7c5f01b5562a4296274a9aa691a54b
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,35 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [3.1.30] - 2026-11-19
|
|
34
|
+
|
|
35
|
+
- TAG: [v3.1.30][3.1.30t]
|
|
36
|
+
- COVERAGE: 92.19% -- 5982/6489 lines in 50 files
|
|
37
|
+
- BRANCH COVERAGE: 76.26% -- 2297/3012 branches in 50 files
|
|
38
|
+
- 55.31% documented
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- Kettle::Dev::BundlerPinning known-bad stable holds: HELD_VERSIONS (version => reason), held?, and held_reason, with published_stable excluding held versions so update-bundler, bupb, and kettle-release never select a known-bad stable Bundler
|
|
43
|
+
|
|
44
|
+
- Add kettle-rebase tool (Kettle::Dev::Rebase module + kettle-rebase executable): sync a checkout to its upstream with git pull --rebase --autostash; aborts cleanly and restores the pre-pull state (including dirty worktree changes) on conflict, skips when nested inside an outer kettle command (KETTLE_REBASE_NESTED), and fails open for missing or unreachable upstreams
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- kettle-release no longer checks, waits for, or monitors macOS, Windows, heads, or dep-heads workflows (#62)
|
|
49
|
+
|
|
50
|
+
- kettle-release judges workflow runs by non-macOS/Windows jobs, so slow matrix lanes no longer gate or delay CI validation (#62)
|
|
51
|
+
|
|
52
|
+
- [kc] kettle-jem/prepare: updated 14 project files:
|
|
53
|
+
- dependencies (14)
|
|
54
|
+
|
|
55
|
+
- [kc] kettle-jem/template: updated 9 project files:
|
|
56
|
+
- code and tests (2)
|
|
57
|
+
- dependencies (3)
|
|
58
|
+
- documentation (1)
|
|
59
|
+
- other (1)
|
|
60
|
+
- workflows (2)
|
|
61
|
+
|
|
33
62
|
## [3.1.29] - 2026-11-15
|
|
34
63
|
|
|
35
64
|
- TAG: [v3.1.29][3.1.29t]
|
|
@@ -4339,7 +4368,9 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
4339
4368
|
- Selecting will run the selected workflow via `act`
|
|
4340
4369
|
- This may move to its own gem in the future.
|
|
4341
4370
|
|
|
4342
|
-
[Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.
|
|
4371
|
+
[Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.30...HEAD
|
|
4372
|
+
[3.1.30]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.29...v3.1.30
|
|
4373
|
+
[3.1.30t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.30
|
|
4343
4374
|
[3.1.29]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.28...v3.1.29
|
|
4344
4375
|
[3.1.29t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.29
|
|
4345
4376
|
[3.1.28]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.27...v3.1.28
|
data/README.md
CHANGED
|
@@ -92,8 +92,8 @@ out to `kettle-release` for each member that needs publishing.
|
|
|
92
92
|
|
|
93
93
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
94
94
|
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
95
|
-
| Works with JRuby | [![JRuby
|
|
96
|
-
| Works with Truffle Ruby | [![Truffle Ruby
|
|
95
|
+
| Works with JRuby | [![JRuby 10.0 Compat][💎jruby-10.0i]][🚎jruby-10.0-wf] [![JRuby current Compat][💎jruby-c-i]][🚎10-j-wf] [![JRuby HEAD Compat][💎jruby-headi]][🚎3-hd-wf]|
|
|
96
|
+
| Works with Truffle Ruby | [![Truffle Ruby 33.0 Compat][💎truby-33.0i]][🚎truby-33.0-wf] [![Truffle Ruby current Compat][💎truby-c-i]][🚎9-t-wf]|
|
|
97
97
|
| Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf] [![Ruby HEAD Compat][💎ruby-headi]][🚎3-hd-wf]|
|
|
98
98
|
| Works with MRI Ruby 3 | [![Ruby 3.0 Compat][💎ruby-3.0i]][🚎ruby-3.0-wf] [![Ruby 3.1 Compat][💎ruby-3.1i]][🚎ruby-3.1-wf] [![Ruby 3.2 Compat][💎ruby-3.2i]][🚎ruby-3.2-wf] [![Ruby 3.3 Compat][💎ruby-3.3i]][🚎ruby-3.3-wf] [![Ruby 3.4 Compat][💎ruby-3.4i]][🚎ruby-3.4-wf]|
|
|
99
99
|
| Works with MRI Ruby 2 | [![Ruby 2.4 Compat][💎ruby-2.4i]][🚎ruby-2.4-wf] [![Ruby 2.5 Compat][💎ruby-2.5i]][🚎ruby-2.5-wf] [![Ruby 2.6 Compat][💎ruby-2.6i]][🚎ruby-2.6-wf] [![Ruby 2.7 Compat][💎ruby-2.7i]][🚎ruby-2.7-wf]|
|
|
@@ -972,14 +972,7 @@ Thanks for RTFM. ☺️
|
|
|
972
972
|
[🚎ruby-3.2-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/ruby-3.2.yml
|
|
973
973
|
[🚎ruby-3.3-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/ruby-3.3.yml
|
|
974
974
|
[🚎ruby-3.4-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/ruby-3.4.yml
|
|
975
|
-
[🚎jruby-9.2-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/jruby-9.2.yml
|
|
976
|
-
[🚎jruby-9.3-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/jruby-9.3.yml
|
|
977
|
-
[🚎jruby-9.4-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/jruby-9.4.yml
|
|
978
975
|
[🚎jruby-10.0-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/jruby-10.0.yml
|
|
979
|
-
[🚎truby-22.3-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/truffleruby-22.3.yml
|
|
980
|
-
[🚎truby-23.1-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/truffleruby-23.1.yml
|
|
981
|
-
[🚎truby-24.2-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/truffleruby-24.2.yml
|
|
982
|
-
[🚎truby-25.0-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/truffleruby-25.0.yml
|
|
983
976
|
[🚎truby-33.0-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/truffleruby-33.0.yml
|
|
984
977
|
[🚎2-cov-wf]: https://github.com/kettle-dev/kettle-dev/actions/workflows/coverage.yml
|
|
985
978
|
[🚎2-cov-wfi]: https://github.com/kettle-dev/kettle-dev/actions/workflows/coverage.yml/badge.svg
|
|
@@ -1010,15 +1003,8 @@ Thanks for RTFM. ☺️
|
|
|
1010
1003
|
[💎ruby-3.4i]: https://img.shields.io/badge/Ruby-3.4-CC342D?style=for-the-badge&logo=ruby&logoColor=white
|
|
1011
1004
|
[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
|
|
1012
1005
|
[💎ruby-headi]: https://img.shields.io/badge/Ruby-HEAD-CC342D?style=for-the-badge&logo=ruby&logoColor=blue
|
|
1013
|
-
[💎truby-22.3i]: https://img.shields.io/badge/Truffle_Ruby-22.3-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
1014
|
-
[💎truby-23.1i]: https://img.shields.io/badge/Truffle_Ruby-23.1-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
1015
|
-
[💎truby-24.2i]: https://img.shields.io/badge/Truffle_Ruby-24.2-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
1016
|
-
[💎truby-25.0i]: https://img.shields.io/badge/Truffle_Ruby-25.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
1017
1006
|
[💎truby-33.0i]: https://img.shields.io/badge/Truffle_Ruby-33.0-34BCB1?style=for-the-badge&logo=ruby&logoColor=pink
|
|
1018
1007
|
[💎truby-c-i]: https://img.shields.io/badge/Truffle_Ruby-current-34BCB1?style=for-the-badge&logo=ruby&logoColor=green
|
|
1019
|
-
[💎jruby-9.2i]: https://img.shields.io/badge/JRuby-9.2-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
1020
|
-
[💎jruby-9.3i]: https://img.shields.io/badge/JRuby-9.3-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
1021
|
-
[💎jruby-9.4i]: https://img.shields.io/badge/JRuby-9.4-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
1022
1008
|
[💎jruby-10.0i]: https://img.shields.io/badge/JRuby-10.0-FBE742?style=for-the-badge&logo=ruby&logoColor=red
|
|
1023
1009
|
[💎jruby-c-i]: https://img.shields.io/badge/JRuby-current-FBE742?style=for-the-badge&logo=ruby&logoColor=green
|
|
1024
1010
|
[💎jruby-headi]: https://img.shields.io/badge/JRuby-HEAD-FBE742?style=for-the-badge&logo=ruby&logoColor=blue
|
|
@@ -1048,7 +1034,7 @@ Thanks for RTFM. ☺️
|
|
|
1048
1034
|
[📌gitmoji]: https://gitmoji.dev
|
|
1049
1035
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
1050
1036
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
1051
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-6.
|
|
1037
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-6.489-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
1052
1038
|
[🔐security]: https://github.com/kettle-dev/kettle-dev/blob/main/SECURITY.md
|
|
1053
1039
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
1054
1040
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
data/exe/kettle-rebase
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
$stdout.sync = true
|
|
5
|
+
$stderr.sync = true
|
|
6
|
+
|
|
7
|
+
begin
|
|
8
|
+
require "rubygems"
|
|
9
|
+
rescue LoadError
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
script_basename = File.basename(__FILE__)
|
|
13
|
+
repo_lib = File.expand_path("../lib", __dir__)
|
|
14
|
+
$LOAD_PATH.unshift(repo_lib) if File.directory?(repo_lib) && !$LOAD_PATH.include?(repo_lib)
|
|
15
|
+
|
|
16
|
+
begin
|
|
17
|
+
require "kettle/dev"
|
|
18
|
+
require "kettle/dev/executable_version"
|
|
19
|
+
Kettle::Dev::ExecutableVersion.print_and_exit!(script_basename, ARGV)
|
|
20
|
+
Kettle::Dev::ExecutableVersion.print_header(script_basename)
|
|
21
|
+
rescue LoadError => e
|
|
22
|
+
warn("#{script_basename}: could not load dependency: #{e.class}: #{e.message}")
|
|
23
|
+
warn("Hint: Ensure the host project has kettle-dev as a dependency and run bundle install.")
|
|
24
|
+
exit(1)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
begin
|
|
28
|
+
exit(Kettle::Dev::RebaseCLI.new(ARGV).run!)
|
|
29
|
+
rescue SystemExit
|
|
30
|
+
raise
|
|
31
|
+
rescue => e
|
|
32
|
+
warn("#{script_basename}: #{e.message}")
|
|
33
|
+
warn(e.backtrace.join("\n")) if ENV["DEBUG"]
|
|
34
|
+
exit(1)
|
|
35
|
+
end
|
|
@@ -18,8 +18,27 @@ module Kettle
|
|
|
18
18
|
module BundlerPinning
|
|
19
19
|
RUBYGEMS_SOURCE = "https://rubygems.org"
|
|
20
20
|
|
|
21
|
+
# Known-bad STABLE Bundler versions the toolchain must never select, as
|
|
22
|
+
# version String => reason. Prereleases need no entries — every lookup
|
|
23
|
+
# already rejects them (the 4.1.0.betaN infection vector). Add an entry
|
|
24
|
+
# when a stable release breaks the toolchain, and remove it once a fixed
|
|
25
|
+
# release supersedes it. FLOOR_HOLDS in bin/kettle-jem-deps-floor is the
|
|
26
|
+
# same idea for dependency floors.
|
|
27
|
+
HELD_VERSIONS = {}.freeze
|
|
28
|
+
|
|
21
29
|
module_function
|
|
22
30
|
|
|
31
|
+
# True when the version (String or Gem::Version) is a registered
|
|
32
|
+
# known-bad stable hold.
|
|
33
|
+
def held?(version)
|
|
34
|
+
HELD_VERSIONS.key?(version.to_s)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# The registered reason a version is held; nil when it is not.
|
|
38
|
+
def held_reason(version)
|
|
39
|
+
HELD_VERSIONS[version.to_s]
|
|
40
|
+
end
|
|
41
|
+
|
|
23
42
|
# Newest stable Bundler installed locally. Consults BOTH sources —
|
|
24
43
|
# the activated spec and every installed spec — because bundler/setup
|
|
25
44
|
# scoping can hide one from the other depending on how the process booted.
|
|
@@ -48,11 +67,15 @@ module Kettle
|
|
|
48
67
|
|
|
49
68
|
# Newest stable Bundler the registry serves; nil when the registry
|
|
50
69
|
# cannot be consulted, so callers can fail open to local state.
|
|
70
|
+
#
|
|
71
|
+
# Held versions (HELD_VERSIONS) are excluded: a known-bad stable is not
|
|
72
|
+
# a candidate no matter how new. When every published stable is held
|
|
73
|
+
# this returns nil, the same fail-open shape as a registry outage.
|
|
51
74
|
def published_stable
|
|
52
75
|
numbers = Kettle::Dev::RubyGemsVersions.published_version_numbers("bundler")
|
|
53
76
|
return nil unless numbers
|
|
54
77
|
|
|
55
|
-
numbers.filter_map { |number| published_candidate(number) }.max
|
|
78
|
+
numbers.filter_map { |number| published_candidate(number) }.reject { |candidate| held?(candidate) }.max
|
|
56
79
|
end
|
|
57
80
|
|
|
58
81
|
# Install a stable Bundler — the exact version given, or the latest
|
|
@@ -87,7 +87,18 @@ module Kettle
|
|
|
87
87
|
end
|
|
88
88
|
basenames = files.map { |p| File.basename(p) }
|
|
89
89
|
basenames = basenames.uniq - exclusions
|
|
90
|
-
basenames.sort
|
|
90
|
+
basenames.reject { |name| slow_workflow?(name) }.sort
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Workflows that are slow or resource constrained (macOS runner pool, Windows,
|
|
94
|
+
# dependency/engine "heads") and must never gate or delay a release.
|
|
95
|
+
# Matched on basename rather than a fixed list because templates vary the exact names.
|
|
96
|
+
SLOW_WORKFLOW_PATTERN = /mac|windows|heads/i
|
|
97
|
+
|
|
98
|
+
# @param name [String] workflow basename
|
|
99
|
+
# @return [Boolean]
|
|
100
|
+
def slow_workflow?(name)
|
|
101
|
+
name.to_s.match?(SLOW_WORKFLOW_PATTERN)
|
|
91
102
|
end
|
|
92
103
|
|
|
93
104
|
# List of workflow files to exclude from interactive menus and checks.
|
|
@@ -371,6 +382,35 @@ module Kettle
|
|
|
371
382
|
[]
|
|
372
383
|
end
|
|
373
384
|
|
|
385
|
+
# Matrix lanes (macOS, Windows) live inside ordinary workflows as jobs named
|
|
386
|
+
# after matrix.os, so filename filtering can't skip them; filter by job name.
|
|
387
|
+
SLOW_JOB_PATTERN = /macos|windows/i
|
|
388
|
+
|
|
389
|
+
# @param name [String]
|
|
390
|
+
# @return [Boolean]
|
|
391
|
+
def slow_job?(name)
|
|
392
|
+
name.to_s.match?(SLOW_JOB_PATTERN) || slow_workflow?(name)
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
# Judge a run from its jobs, ignoring slow (macOS/Windows/heads) jobs.
|
|
396
|
+
# @param jobs [Array<Hash>, nil] result of {#run_jobs}
|
|
397
|
+
# @param run_completed [Boolean] whether the run itself has completed
|
|
398
|
+
# @return [Array(Symbol, Hash)] [:failed, job] | [:passed, nil] | [nil, nil] (undecided)
|
|
399
|
+
def release_jobs_verdict(jobs, run_completed: false)
|
|
400
|
+
relevant = Array(jobs).reject { |job| slow_job?(job["name"]) }
|
|
401
|
+
return [nil, nil] if relevant.empty?
|
|
402
|
+
|
|
403
|
+
bad = relevant.find do |job|
|
|
404
|
+
job["status"] == "completed" && job["conclusion"] && !%w[success skipped].include?(job["conclusion"])
|
|
405
|
+
end
|
|
406
|
+
return [:failed, bad] if bad
|
|
407
|
+
|
|
408
|
+
# The jobs endpoint is capped at 100 per page; a truncated list can't prove success early.
|
|
409
|
+
truncated = Array(jobs).size >= 100 && !run_completed
|
|
410
|
+
all_done = relevant.all? { |job| job["status"] == "completed" }
|
|
411
|
+
(all_done && !truncated) ? [:passed, nil] : [nil, nil]
|
|
412
|
+
end
|
|
413
|
+
|
|
374
414
|
# Default GitHub token sourced from environment.
|
|
375
415
|
# @return [String, nil]
|
|
376
416
|
def default_token
|
|
@@ -405,7 +405,19 @@ module Kettle
|
|
|
405
405
|
started: started.size
|
|
406
406
|
)
|
|
407
407
|
end
|
|
408
|
-
|
|
408
|
+
# macOS/Windows matrix lanes are slow and must not gate a release:
|
|
409
|
+
# judge the run by its remaining jobs when it hasn't succeeded outright.
|
|
410
|
+
verdict = nil
|
|
411
|
+
verdict_job = nil
|
|
412
|
+
unless Kettle::Dev::CIHelpers.success?(run) || passed[wf] || failed[wf]
|
|
413
|
+
run_done = run["status"] == "completed"
|
|
414
|
+
if run_done || monotonic_time - last_jobs_poll >= jobs_poll_interval
|
|
415
|
+
last_jobs_poll = monotonic_time unless run_done
|
|
416
|
+
jobs = Kettle::Dev::CIHelpers.run_jobs(owner: owner, repo: repo, run_id: run["id"])
|
|
417
|
+
verdict, verdict_job = Kettle::Dev::CIHelpers.release_jobs_verdict(jobs, run_completed: run_done)
|
|
418
|
+
end
|
|
419
|
+
end
|
|
420
|
+
if Kettle::Dev::CIHelpers.success?(run) || verdict == :passed
|
|
409
421
|
unless passed[wf] || failed[wf]
|
|
410
422
|
passed[wf] = true
|
|
411
423
|
completed_workflow = wf
|
|
@@ -431,19 +443,10 @@ module Kettle
|
|
|
431
443
|
# sees the red job immediately. Abort as soon as any job is
|
|
432
444
|
# definitively red so the release stops burning minutes that
|
|
433
445
|
# a re-run will have to spend anyway.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
last_jobs_poll = monotonic_time
|
|
439
|
-
# Run still in flight: poll its jobs so a single red job in
|
|
440
|
-
# a large matrix aborts immediately instead of waiting for
|
|
441
|
-
# the whole workflow to conclude.
|
|
442
|
-
jobs = Kettle::Dev::CIHelpers.run_jobs(owner: owner, repo: repo, run_id: run["id"])
|
|
443
|
-
failed_job = jobs.find do |job|
|
|
444
|
-
job["status"] == "completed" && job["conclusion"] && job["conclusion"] != "success" && job["conclusion"] != "skipped"
|
|
445
|
-
end
|
|
446
|
-
end
|
|
446
|
+
# Verdict :failed comes from non-slow jobs only; with no verdict a
|
|
447
|
+
# completed-failed run is only fatal if it has no job detail at all.
|
|
448
|
+
run_failed = Kettle::Dev::CIHelpers.failed?(run) && verdict.nil?
|
|
449
|
+
failed_job = verdict_job
|
|
447
450
|
next unless run_failed || failed_job
|
|
448
451
|
|
|
449
452
|
puts
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "open3"
|
|
4
|
+
|
|
5
|
+
module Kettle
|
|
6
|
+
module Dev
|
|
7
|
+
# Tip check + safe rebase-sync for one checkout, shared by every kettle
|
|
8
|
+
# tool that mutates a checkout in place (kettle-family template / release
|
|
9
|
+
# / gha-sha-pins, kettle-release, kettle-changelog, ...).
|
|
10
|
+
#
|
|
11
|
+
# Contract:
|
|
12
|
+
# * behind or diverged from upstream -> `git pull --rebase --autostash`
|
|
13
|
+
# * rebase conflict -> capture conflicted paths, then
|
|
14
|
+
# `git rebase --abort`, which reapplies the pull autostash (verified:
|
|
15
|
+
# abort prints "Applied autostash"), leaving the checkout exactly as
|
|
16
|
+
# found; reported as :conflict with the path list
|
|
17
|
+
# * up to date -> :ok, no rebase
|
|
18
|
+
# * no upstream, or an unreachable one -> skipped, proceeding with local
|
|
19
|
+
# state (fail-open; offline work is never blocked)
|
|
20
|
+
# * nested inside an outer kettle command that already synced
|
|
21
|
+
# (KETTLE_REBASE_NESTED set) -> skipped
|
|
22
|
+
module Rebase
|
|
23
|
+
# Orchestrators (kettle-family, kettle-release) set this in child
|
|
24
|
+
# process env so nested kettle tools skip the preflight — the outer
|
|
25
|
+
# command synced once, up front.
|
|
26
|
+
NESTED_ENV = "KETTLE_REBASE_NESTED"
|
|
27
|
+
|
|
28
|
+
FALSEY = %w[false 0 no off].freeze
|
|
29
|
+
|
|
30
|
+
# Outcome of a call. #status is one of :updated, :ok, :skipped_nested,
|
|
31
|
+
# :skipped_no_upstream, :skipped_unreachable, :conflict, :error.
|
|
32
|
+
class Result
|
|
33
|
+
attr_reader :status, :branch, :upstream, :ahead, :behind, :conflicts, :message
|
|
34
|
+
|
|
35
|
+
def initialize(status:, message:, branch: nil, upstream: nil, ahead: nil, behind: nil, conflicts: [])
|
|
36
|
+
@status = status
|
|
37
|
+
@message = message
|
|
38
|
+
@branch = branch
|
|
39
|
+
@upstream = upstream
|
|
40
|
+
@ahead = ahead
|
|
41
|
+
@behind = behind
|
|
42
|
+
@conflicts = conflicts
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def ok?
|
|
46
|
+
![:error, :conflict].include?(status)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def synced?
|
|
50
|
+
status == :updated
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
module_function
|
|
55
|
+
|
|
56
|
+
def call(root:, env: ENV)
|
|
57
|
+
return Result.new(status: :skipped_nested, message: "nested kettle run; the outer command already synced") if nested?(env)
|
|
58
|
+
|
|
59
|
+
branch = current_branch(root)
|
|
60
|
+
return Result.new(status: :error, message: "not a git repository: #{root}") unless branch
|
|
61
|
+
return Result.new(status: :error, message: "#{root} is on a detached HEAD; refusing to rebase") if branch.empty?
|
|
62
|
+
|
|
63
|
+
upstream = upstream_for(root)
|
|
64
|
+
return Result.new(status: :skipped_no_upstream, branch: branch, message: "#{branch} has no upstream; nothing to sync") unless upstream
|
|
65
|
+
|
|
66
|
+
ahead, behind = tip_state(root)
|
|
67
|
+
if behind.nil?
|
|
68
|
+
return Result.new(status: :skipped_unreachable, branch: branch, upstream: upstream, message: "could not fetch #{upstream}; proceeding with local #{branch}")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
return Result.new(status: :ok, branch: branch, upstream: upstream, ahead: ahead, behind: 0, message: up_to_date_message(branch, upstream, ahead)) if behind.zero?
|
|
72
|
+
|
|
73
|
+
rebase(root, branch, upstream, ahead, behind)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def nested?(env)
|
|
77
|
+
value = env[NESTED_ENV]
|
|
78
|
+
return false if value.nil?
|
|
79
|
+
|
|
80
|
+
!FALSEY.include?(value.to_s.strip.downcase)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def up_to_date_message(branch, upstream, ahead)
|
|
84
|
+
return "#{branch} is up to date with #{upstream}" if ahead.zero?
|
|
85
|
+
|
|
86
|
+
"#{branch} is up to date with #{upstream} (ahead by #{ahead})"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def rebase(root, branch, upstream, ahead, behind)
|
|
90
|
+
_stdout, stderr, status = Open3.capture3("git", "pull", "--rebase", "--autostash", chdir: root)
|
|
91
|
+
if status.success?
|
|
92
|
+
return Result.new(status: :updated, branch: branch, upstream: upstream, ahead: ahead, behind: behind, message: "rebased #{branch} onto #{upstream} (was behind by #{behind})")
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
conflicts = conflicted_paths(root)
|
|
96
|
+
abort_stalled_rebase(root)
|
|
97
|
+
conflict_note = conflicts.empty? ? "" : " (conflicts: #{conflicts.join(", ")})"
|
|
98
|
+
hint = stderr.to_s.lines.map(&:strip).reject(&:empty?).last
|
|
99
|
+
detail = hint ? " Last output: #{hint}" : nil
|
|
100
|
+
Result.new(
|
|
101
|
+
status: :conflict,
|
|
102
|
+
branch: branch,
|
|
103
|
+
upstream: upstream,
|
|
104
|
+
ahead: ahead,
|
|
105
|
+
behind: behind,
|
|
106
|
+
conflicts: conflicts,
|
|
107
|
+
message: "rebase of #{branch} onto #{upstream} failed#{conflict_note}; the checkout was restored to its pre-rebase state — resolve manually, then re-run.#{detail}"
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# `git rebase --abort` reapplies the pull --autostash stash (verified:
|
|
112
|
+
# abort prints "Applied autostash"), restoring the pre-pull worktree.
|
|
113
|
+
# Best-effort: a failure before the rebase started leaves nothing to
|
|
114
|
+
# abort, and the error is noise.
|
|
115
|
+
def abort_stalled_rebase(root)
|
|
116
|
+
Open3.capture3("git", "rebase", "--abort", chdir: root)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def conflicted_paths(root)
|
|
120
|
+
stdout, _stderr, status = Open3.capture3("git", "diff", "--name-only", "--diff-filter=U", chdir: root)
|
|
121
|
+
return [] unless status.success?
|
|
122
|
+
|
|
123
|
+
stdout.lines.map(&:strip).reject(&:empty?)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Current branch short name; "" on a detached HEAD, nil when the root
|
|
127
|
+
# is not a git repository (or git cannot answer).
|
|
128
|
+
def current_branch(root)
|
|
129
|
+
stdout, _stderr, status = Open3.capture3("git", "branch", "--show-current", chdir: root)
|
|
130
|
+
status.success? ? stdout.strip : nil
|
|
131
|
+
rescue SystemCallError
|
|
132
|
+
nil
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def upstream_for(root)
|
|
136
|
+
stdout, _stderr, status = Open3.capture3("git", "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}", chdir: root)
|
|
137
|
+
status.success? ? stdout.strip : nil
|
|
138
|
+
rescue SystemCallError
|
|
139
|
+
nil
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# [ahead, behind] vs the upstream after a fetch, or [nil, nil] when the
|
|
143
|
+
# remote cannot be fetched / compared (fail-open: callers treat nil as
|
|
144
|
+
# "unknown", never as "stale").
|
|
145
|
+
def tip_state(root)
|
|
146
|
+
_stdout, _stderr, fetch_status = Open3.capture3("git", "fetch", "--quiet", chdir: root)
|
|
147
|
+
return [nil, nil] unless fetch_status.success?
|
|
148
|
+
|
|
149
|
+
stdout, _stderr, status = Open3.capture3("git", "rev-list", "--left-right", "--count", "HEAD...@{upstream}", chdir: root)
|
|
150
|
+
return [nil, nil] unless status.success?
|
|
151
|
+
|
|
152
|
+
stdout.strip.split(/\s+/).map { |part| part.to_i }
|
|
153
|
+
rescue SystemCallError
|
|
154
|
+
[nil, nil]
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "optparse"
|
|
4
|
+
|
|
5
|
+
module Kettle
|
|
6
|
+
module Dev
|
|
7
|
+
class RebaseCLI
|
|
8
|
+
def initialize(argv = [], root: Kettle::Dev::CIHelpers.project_root)
|
|
9
|
+
@argv = Array(argv).dup
|
|
10
|
+
@root = root
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run!
|
|
14
|
+
args = parse!
|
|
15
|
+
target = args.first.to_s
|
|
16
|
+
target = root if target.empty?
|
|
17
|
+
raise Error, "unexpected argument(s): #{args.drop(1).join(" ")}" if args.length > 1
|
|
18
|
+
|
|
19
|
+
result = Rebase.call(root: target)
|
|
20
|
+
puts result.message
|
|
21
|
+
result.ok? ? 0 : 1
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
attr_reader :argv, :root
|
|
27
|
+
|
|
28
|
+
def parse!
|
|
29
|
+
parser.parse!(argv)
|
|
30
|
+
rescue OptionParser::ParseError => error
|
|
31
|
+
raise Error, error.message
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def parser
|
|
35
|
+
OptionParser.new do |opts|
|
|
36
|
+
opts.banner = "Usage: kettle-rebase [PATH]"
|
|
37
|
+
opts.separator "Sync PATH (default: project root) to its upstream with git pull --rebase --autostash."
|
|
38
|
+
opts.separator "No-op when up to date; aborts and reports on rebase conflict."
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/lib/kettle/dev/version.rb
CHANGED
|
@@ -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.
|
|
8
|
+
VERSION = "3.1.30"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/kettle/dev.rb
CHANGED
|
@@ -54,6 +54,8 @@ module Kettle
|
|
|
54
54
|
autoload :ReleaseGraphContract, "kettle/dev/release_graph_contract"
|
|
55
55
|
autoload :ReleaseSecrets, "kettle/dev/release_secrets"
|
|
56
56
|
autoload :ReleaseSecretsDoctor, "kettle/dev/release_secrets_doctor"
|
|
57
|
+
autoload :Rebase, "kettle/dev/rebase"
|
|
58
|
+
autoload :RebaseCLI, "kettle/dev/rebase_cli"
|
|
57
59
|
autoload :ResetCLI, "kettle/dev/reset_cli"
|
|
58
60
|
autoload :PreReleaseCLI, "kettle/dev/pre_release_cli"
|
|
59
61
|
autoload :Version, "kettle/dev/version"
|
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.
|
|
4
|
+
version: 3.1.30
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -60,7 +60,7 @@ dependencies:
|
|
|
60
60
|
version: '0.3'
|
|
61
61
|
- - ">="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: 0.3.
|
|
63
|
+
version: 0.3.21
|
|
64
64
|
type: :runtime
|
|
65
65
|
prerelease: false
|
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -70,7 +70,7 @@ dependencies:
|
|
|
70
70
|
version: '0.3'
|
|
71
71
|
- - ">="
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: 0.3.
|
|
73
|
+
version: 0.3.21
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: kettle-ndjson
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,7 +80,7 @@ dependencies:
|
|
|
80
80
|
version: '0.1'
|
|
81
81
|
- - ">="
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: 0.1.
|
|
83
|
+
version: 0.1.24
|
|
84
84
|
type: :runtime
|
|
85
85
|
prerelease: false
|
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -90,7 +90,7 @@ dependencies:
|
|
|
90
90
|
version: '0.1'
|
|
91
91
|
- - ">="
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: 0.1.
|
|
93
|
+
version: 0.1.24
|
|
94
94
|
- !ruby/object:Gem::Dependency
|
|
95
95
|
name: kettle-rb
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -216,7 +216,7 @@ dependencies:
|
|
|
216
216
|
version: '1.0'
|
|
217
217
|
- - ">="
|
|
218
218
|
- !ruby/object:Gem::Version
|
|
219
|
-
version: 1.0.
|
|
219
|
+
version: 1.0.5
|
|
220
220
|
type: :development
|
|
221
221
|
prerelease: false
|
|
222
222
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -226,7 +226,7 @@ dependencies:
|
|
|
226
226
|
version: '1.0'
|
|
227
227
|
- - ">="
|
|
228
228
|
- !ruby/object:Gem::Version
|
|
229
|
-
version: 1.0.
|
|
229
|
+
version: 1.0.5
|
|
230
230
|
- !ruby/object:Gem::Dependency
|
|
231
231
|
name: anonymous_loader
|
|
232
232
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -296,7 +296,7 @@ dependencies:
|
|
|
296
296
|
version: '1.0'
|
|
297
297
|
- - ">="
|
|
298
298
|
- !ruby/object:Gem::Version
|
|
299
|
-
version: 1.0.
|
|
299
|
+
version: 1.0.11
|
|
300
300
|
type: :development
|
|
301
301
|
prerelease: false
|
|
302
302
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -306,7 +306,7 @@ dependencies:
|
|
|
306
306
|
version: '1.0'
|
|
307
307
|
- - ">="
|
|
308
308
|
- !ruby/object:Gem::Version
|
|
309
|
-
version: 1.0.
|
|
309
|
+
version: 1.0.11
|
|
310
310
|
- !ruby/object:Gem::Dependency
|
|
311
311
|
name: gitmoji-regex
|
|
312
312
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -316,7 +316,7 @@ dependencies:
|
|
|
316
316
|
version: '2.0'
|
|
317
317
|
- - ">="
|
|
318
318
|
- !ruby/object:Gem::Version
|
|
319
|
-
version: 2.0.
|
|
319
|
+
version: 2.0.17
|
|
320
320
|
type: :development
|
|
321
321
|
prerelease: false
|
|
322
322
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -326,7 +326,7 @@ dependencies:
|
|
|
326
326
|
version: '2.0'
|
|
327
327
|
- - ">="
|
|
328
328
|
- !ruby/object:Gem::Version
|
|
329
|
-
version: 2.0.
|
|
329
|
+
version: 2.0.17
|
|
330
330
|
description: "\U0001F372 Kettle::Dev is a meta tool from kettle-dev to streamline
|
|
331
331
|
development and testing. Acts as a shim dependency, pulling in many other dependencies,
|
|
332
332
|
to give you OOTB productivity with a RubyGem, or Ruby app project. Configures a
|
|
@@ -345,6 +345,7 @@ executables:
|
|
|
345
345
|
- kettle-gha-sha-pins
|
|
346
346
|
- kettle-pre-release
|
|
347
347
|
- kettle-readme-backers
|
|
348
|
+
- kettle-rebase
|
|
348
349
|
- kettle-release
|
|
349
350
|
- kettle-release-secrets-doctor
|
|
350
351
|
- kettle-reset
|
|
@@ -364,6 +365,7 @@ files:
|
|
|
364
365
|
- exe/kettle-gha-sha-pins
|
|
365
366
|
- exe/kettle-pre-release
|
|
366
367
|
- exe/kettle-readme-backers
|
|
368
|
+
- exe/kettle-rebase
|
|
367
369
|
- exe/kettle-release
|
|
368
370
|
- exe/kettle-release-secrets-doctor
|
|
369
371
|
- exe/kettle-reset
|
|
@@ -403,6 +405,8 @@ files:
|
|
|
403
405
|
- lib/kettle/dev/rakelib/spec_test.rake
|
|
404
406
|
- lib/kettle/dev/rakelib/yard.rake
|
|
405
407
|
- lib/kettle/dev/readme_backers.rb
|
|
408
|
+
- lib/kettle/dev/rebase.rb
|
|
409
|
+
- lib/kettle/dev/rebase_cli.rb
|
|
406
410
|
- lib/kettle/dev/release_cli.rb
|
|
407
411
|
- lib/kettle/dev/release_graph_contract.rb
|
|
408
412
|
- lib/kettle/dev/release_notifier.rb
|
|
@@ -423,10 +427,10 @@ licenses:
|
|
|
423
427
|
- AGPL-3.0-only
|
|
424
428
|
metadata:
|
|
425
429
|
homepage_uri: https://kettle-dev.galtzo.com
|
|
426
|
-
source_code_uri: https://github.com/kettle-dev/kettle-dev/tree/v3.1.
|
|
427
|
-
changelog_uri: https://github.com/kettle-dev/kettle-dev/blob/v3.1.
|
|
430
|
+
source_code_uri: https://github.com/kettle-dev/kettle-dev/tree/v3.1.30
|
|
431
|
+
changelog_uri: https://github.com/kettle-dev/kettle-dev/blob/v3.1.30/CHANGELOG.md
|
|
428
432
|
bug_tracker_uri: https://github.com/kettle-dev/kettle-dev/issues
|
|
429
|
-
documentation_uri: https://www.rubydoc.info/gems/kettle-dev/3.1.
|
|
433
|
+
documentation_uri: https://www.rubydoc.info/gems/kettle-dev/3.1.30
|
|
430
434
|
funding_uri: https://github.com/sponsors/pboling
|
|
431
435
|
wiki_uri: https://github.com/kettle-dev/kettle-dev/wiki
|
|
432
436
|
news_uri: https://www.railsbling.com/tags/kettle-dev
|
metadata.gz.sig
CHANGED
|
Binary file
|