kettle-dev 3.1.29 → 3.1.31
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 +52 -1
- data/README.md +3 -17
- data/exe/kettle-rebase +35 -0
- data/lib/kettle/dev/bundler_pinning.rb +72 -3
- data/lib/kettle/dev/ci_helpers.rb +41 -1
- data/lib/kettle/dev/ci_monitor.rb +24 -19
- data/lib/kettle/dev/rebase.rb +158 -0
- data/lib/kettle/dev/rebase_cli.rb +43 -0
- data/lib/kettle/dev/release_cli.rb +39 -0
- data/lib/kettle/dev/version.rb +1 -1
- data/lib/kettle/dev.rb +2 -0
- data.tar.gz.sig +1 -6
- metadata +492 -437
- 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: 6dc6dbbd0c403410098d97c9bf12d56073b241db96492a3d53272ea581cd1aa1
|
|
4
|
+
data.tar.gz: 18cf1fc3df94d8948cc92813e1290a4d8ff7a0f6706b85e4f974695d9f9ea304
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93ad80b29218697907e1bf20f794a04d3ac3d3b090724514bc8dff3d7c23409a89ba4dd30585b9e12210b6e27f9081d9fe8627d3a4630d2d12eaa62581bf865c
|
|
7
|
+
data.tar.gz: 84928f50793695a92073da7ecdce1eb18a83350c8b9e22695126e2ddebdbb7f11f346bf54e8f0c1e72c8f7a4600afc65e45bc009c493047ba3560fc58344a279
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,53 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [3.1.31] - 2026-11-20
|
|
34
|
+
|
|
35
|
+
- TAG: [v3.1.31][3.1.31t]
|
|
36
|
+
- COVERAGE: 91.93% -- 5994/6520 lines in 50 files
|
|
37
|
+
- BRANCH COVERAGE: 76.01% -- 2294/3018 branches in 50 files
|
|
38
|
+
- 55.84% documented
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- BundlerPinning RubyGems pair lookups: installed_rubygems (gem -v) and published_stable_rubygems (latest stable rubygems-update the registry serves, prereleases rejected, fail-open on outage), with a RUBYGEMS_HELD_VERSIONS registry mirroring HELD_VERSIONS — the RubyGems half of the matched Bundler/RubyGems pair
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Stop requiring Bundler at load time in BundlerPinning (require it at the point of use): loading Bundler activates the default Bundler, whose vendored uri clashes with RubyGems' own vendored copy and floods stderr with Gem::URI double-initialization warnings on every CLI invocation once Bundler 4.x is the machine default
|
|
47
|
+
- GitHub CI monitoring events now report a consistent `completed` count (passed + failed) within a run, including the failure event itself.
|
|
48
|
+
|
|
49
|
+
- Release is now cold-start safe for borrowed bundles: the changelog step's tool bundle (kettle-changelog's release gemfile) and the member coverage bundle are installed via bundle install before the changelog exec, each against a disposable lockfile under tmp/kettle-release/lockfiles so canonical lockfiles never change. Previously a fresh gem home (e.g. after a Ruby upgrade) died mid-publish with Bundler::GemNotFound for gems those borrowed bundles pin. Fixes #67
|
|
50
|
+
|
|
51
|
+
## [3.1.30] - 2026-11-19
|
|
52
|
+
|
|
53
|
+
- TAG: [v3.1.30][3.1.30t]
|
|
54
|
+
- COVERAGE: 92.19% -- 5982/6489 lines in 50 files
|
|
55
|
+
- BRANCH COVERAGE: 76.26% -- 2297/3012 branches in 50 files
|
|
56
|
+
- 55.31% documented
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- 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
|
|
61
|
+
|
|
62
|
+
- 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
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- kettle-release no longer checks, waits for, or monitors macOS, Windows, heads, or dep-heads workflows (#62)
|
|
67
|
+
|
|
68
|
+
- kettle-release judges workflow runs by non-macOS/Windows jobs, so slow matrix lanes no longer gate or delay CI validation (#62)
|
|
69
|
+
|
|
70
|
+
- [kc] kettle-jem/prepare: updated 14 project files:
|
|
71
|
+
- dependencies (14)
|
|
72
|
+
|
|
73
|
+
- [kc] kettle-jem/template: updated 9 project files:
|
|
74
|
+
- code and tests (2)
|
|
75
|
+
- dependencies (3)
|
|
76
|
+
- documentation (1)
|
|
77
|
+
- other (1)
|
|
78
|
+
- workflows (2)
|
|
79
|
+
|
|
33
80
|
## [3.1.29] - 2026-11-15
|
|
34
81
|
|
|
35
82
|
- TAG: [v3.1.29][3.1.29t]
|
|
@@ -4339,7 +4386,11 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
4339
4386
|
- Selecting will run the selected workflow via `act`
|
|
4340
4387
|
- This may move to its own gem in the future.
|
|
4341
4388
|
|
|
4342
|
-
[Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.
|
|
4389
|
+
[Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.31...HEAD
|
|
4390
|
+
[3.1.31]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.30...v3.1.31
|
|
4391
|
+
[3.1.31t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.31
|
|
4392
|
+
[3.1.30]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.29...v3.1.30
|
|
4393
|
+
[3.1.30t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.30
|
|
4343
4394
|
[3.1.29]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.28...v3.1.29
|
|
4344
4395
|
[3.1.29t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.29
|
|
4345
4396
|
[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.520-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
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# NOTE: `bundler` is deliberately NOT required at load time. This file is on
|
|
4
|
+
# the kettle CLI load path (kettle-family requires it eagerly), and loading
|
|
5
|
+
# Bundler activates the DEFAULT Bundler — whose vendored `uri` clashes with
|
|
6
|
+
# RubyGems' own vendored copy (the Gem::URI double-initialization warning
|
|
7
|
+
# wall on stderr) whenever the default Bundler is 4.x. Methods require it at
|
|
8
|
+
# the point of use instead, so plain CLI invocations never load Bundler.
|
|
4
9
|
require "fileutils"
|
|
5
10
|
require "rubygems/dependency_installer"
|
|
6
11
|
|
|
@@ -18,8 +23,36 @@ module Kettle
|
|
|
18
23
|
module BundlerPinning
|
|
19
24
|
RUBYGEMS_SOURCE = "https://rubygems.org"
|
|
20
25
|
|
|
26
|
+
# The gem whose versions track RubyGems itself. Bundler and RubyGems
|
|
27
|
+
# release as a matched pair (same version, same day), so this is the
|
|
28
|
+
# other half of every Bundler version question.
|
|
29
|
+
RUBYGEMS_UPDATE_GEM = "rubygems-update"
|
|
30
|
+
|
|
31
|
+
# Known-bad STABLE Bundler versions the toolchain must never select, as
|
|
32
|
+
# version String => reason. Prereleases need no entries — every lookup
|
|
33
|
+
# already rejects them (the 4.1.0.betaN infection vector). Add an entry
|
|
34
|
+
# when a stable release breaks the toolchain, and remove it once a fixed
|
|
35
|
+
# release supersedes it. FLOOR_HOLDS in bin/kettle-jem-deps-floor is the
|
|
36
|
+
# same idea for dependency floors.
|
|
37
|
+
HELD_VERSIONS = {}.freeze
|
|
38
|
+
|
|
39
|
+
# Known-bad STABLE RubyGems versions, same shape and policy as
|
|
40
|
+
# HELD_VERSIONS.
|
|
41
|
+
RUBYGEMS_HELD_VERSIONS = {}.freeze
|
|
42
|
+
|
|
21
43
|
module_function
|
|
22
44
|
|
|
45
|
+
# True when the version (String or Gem::Version) is a registered
|
|
46
|
+
# known-bad stable hold.
|
|
47
|
+
def held?(version)
|
|
48
|
+
HELD_VERSIONS.key?(version.to_s)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The registered reason a version is held; nil when it is not.
|
|
52
|
+
def held_reason(version)
|
|
53
|
+
HELD_VERSIONS[version.to_s]
|
|
54
|
+
end
|
|
55
|
+
|
|
23
56
|
# Newest stable Bundler installed locally. Consults BOTH sources —
|
|
24
57
|
# the activated spec and every installed spec — because bundler/setup
|
|
25
58
|
# scoping can hide one from the other depending on how the process booted.
|
|
@@ -48,11 +81,15 @@ module Kettle
|
|
|
48
81
|
|
|
49
82
|
# Newest stable Bundler the registry serves; nil when the registry
|
|
50
83
|
# cannot be consulted, so callers can fail open to local state.
|
|
84
|
+
#
|
|
85
|
+
# Held versions (HELD_VERSIONS) are excluded: a known-bad stable is not
|
|
86
|
+
# a candidate no matter how new. When every published stable is held
|
|
87
|
+
# this returns nil, the same fail-open shape as a registry outage.
|
|
51
88
|
def published_stable
|
|
52
89
|
numbers = Kettle::Dev::RubyGemsVersions.published_version_numbers("bundler")
|
|
53
90
|
return nil unless numbers
|
|
54
91
|
|
|
55
|
-
numbers.filter_map { |number| published_candidate(number) }.max
|
|
92
|
+
numbers.filter_map { |number| published_candidate(number) }.reject { |candidate| held?(candidate) }.max
|
|
56
93
|
end
|
|
57
94
|
|
|
58
95
|
# Install a stable Bundler — the exact version given, or the latest
|
|
@@ -108,7 +145,9 @@ module Kettle
|
|
|
108
145
|
# newest stable, installing it first when the executing Bundler lags.
|
|
109
146
|
# A registry outage fails open to the executing Bundler rather than
|
|
110
147
|
# blocking the release.
|
|
111
|
-
def ensure_latest_stable(executing:
|
|
148
|
+
def ensure_latest_stable(executing: nil)
|
|
149
|
+
require "bundler"
|
|
150
|
+
executing ||= Bundler::VERSION
|
|
112
151
|
current = Gem::Version.new(executing)
|
|
113
152
|
latest = published_stable
|
|
114
153
|
return current.to_s if latest.nil? || latest <= current
|
|
@@ -131,6 +170,36 @@ module Kettle
|
|
|
131
170
|
rescue ArgumentError
|
|
132
171
|
nil
|
|
133
172
|
end
|
|
173
|
+
|
|
174
|
+
# True when the RubyGems version (String or Gem::Version) is a
|
|
175
|
+
# registered known-bad stable hold.
|
|
176
|
+
def rubygems_held?(version)
|
|
177
|
+
RUBYGEMS_HELD_VERSIONS.key?(version.to_s)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# The registered reason a RubyGems version is held; nil when it is not.
|
|
181
|
+
def rubygems_held_reason(version)
|
|
182
|
+
RUBYGEMS_HELD_VERSIONS[version.to_s]
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# The RubyGems running this process (`gem -v`). RubyGems is not a gem in
|
|
186
|
+
# the gem home — it IS the runtime's package manager — so there is no
|
|
187
|
+
# spec-index fallback to make; this is the only installed version that
|
|
188
|
+
# matters.
|
|
189
|
+
def installed_rubygems
|
|
190
|
+
Gem.rubygems_version
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Newest stable RubyGems the registry serves (tracked via the
|
|
194
|
+
# rubygems-update gem); nil when the registry cannot be consulted, so
|
|
195
|
+
# callers fail open. Held versions (RUBYGEMS_HELD_VERSIONS) are
|
|
196
|
+
# excluded, exactly like the Bundler lookup.
|
|
197
|
+
def published_stable_rubygems
|
|
198
|
+
numbers = Kettle::Dev::RubyGemsVersions.published_version_numbers(RUBYGEMS_UPDATE_GEM)
|
|
199
|
+
return nil unless numbers
|
|
200
|
+
|
|
201
|
+
numbers.filter_map { |number| published_candidate(number) }.reject { |candidate| rubygems_held?(candidate) }.max
|
|
202
|
+
end
|
|
134
203
|
end
|
|
135
204
|
end
|
|
136
205
|
end
|
|
@@ -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
|
|
@@ -389,7 +389,7 @@ module Kettle
|
|
|
389
389
|
url: run["html_url"],
|
|
390
390
|
run_status: run["status"],
|
|
391
391
|
conclusion: run["conclusion"],
|
|
392
|
-
completed: passed.size,
|
|
392
|
+
completed: passed.size + failed.size,
|
|
393
393
|
total: total
|
|
394
394
|
)
|
|
395
395
|
end
|
|
@@ -400,12 +400,24 @@ module Kettle
|
|
|
400
400
|
action: "github_started",
|
|
401
401
|
status: "ok",
|
|
402
402
|
provider: "github",
|
|
403
|
-
completed: passed.size,
|
|
403
|
+
completed: passed.size + failed.size,
|
|
404
404
|
total: total,
|
|
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
|
|
@@ -419,7 +431,7 @@ module Kettle
|
|
|
419
431
|
url: run["html_url"],
|
|
420
432
|
run_status: run["status"],
|
|
421
433
|
conclusion: run["conclusion"],
|
|
422
|
-
completed: passed.size,
|
|
434
|
+
completed: passed.size + failed.size,
|
|
423
435
|
total: total
|
|
424
436
|
)
|
|
425
437
|
end
|
|
@@ -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
|
|
@@ -460,7 +463,9 @@ module Kettle
|
|
|
460
463
|
run_status: run["status"],
|
|
461
464
|
conclusion: run["conclusion"],
|
|
462
465
|
failed_job: failed_job && failed_job["name"],
|
|
463
|
-
completed
|
|
466
|
+
# Count this failure as completed so the progress count never
|
|
467
|
+
# moves backwards relative to the following tick/complete events.
|
|
468
|
+
completed: passed.size + failed.size + 1,
|
|
464
469
|
total: total,
|
|
465
470
|
reason: "Workflow failed#{failed_job_note}"
|
|
466
471
|
)
|
|
@@ -500,7 +505,7 @@ module Kettle
|
|
|
500
505
|
missing: workflows - started.keys,
|
|
501
506
|
head_sha: head_sha,
|
|
502
507
|
total: total,
|
|
503
|
-
completed: passed.size,
|
|
508
|
+
completed: passed.size + failed.size,
|
|
504
509
|
reason: "Timed out waiting for workflows to start"
|
|
505
510
|
)
|
|
506
511
|
abort("Timed out after #{start_timeout}s waiting for GitHub Actions workflows to start for HEAD #{head_sha[0, 12]}: #{missing}. Confirm GitHub Actions started, then restart this tool from CI validation with: #{restart_hint}")
|
|
@@ -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
|