kettle-dev 3.1.33 → 3.1.34
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 +24 -1
- data/README.md +1 -1
- data/lib/kettle/dev/ci_helpers.rb +410 -24
- data/lib/kettle/dev/ci_monitor.rb +170 -1
- data/lib/kettle/dev/release_cli.rb +62 -15
- data/lib/kettle/dev/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +12 -12
- 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: 65c7579f03a20c8b1b277cc6e8045460d69538f2e5c2fd3fad7bc83869281220
|
|
4
|
+
data.tar.gz: 302eaebac2fe66f1338a2d53061599b984f978e75e948dcad5ca2525665a0fa8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24d348c72c38bc3e2537470b15e14d96c070d56b5ee22c41871ed43fa8b1c345e80fa5dc17529c1380810904920e1567dbb92c594fc947b5474b813ba2b8f5d1
|
|
7
|
+
data.tar.gz: 417d2b247efea41fa6b45c1087d8b0707fb7e252e5fe74cfe237074c1158492cd0f517b7b4bc2344a6499faeceef0124e9715b49c2e6b19fd2cf24f6511b84d4
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,27 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [3.1.34] - 2026-11-27
|
|
34
|
+
|
|
35
|
+
- TAG: [v3.1.34][3.1.34t]
|
|
36
|
+
- COVERAGE: 91.87% -- 6259/6813 lines in 50 files
|
|
37
|
+
- BRANCH COVERAGE: 75.79% -- 2413/3184 branches in 50 files
|
|
38
|
+
- 56.67% documented
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- [kc] kettle-jem/prepare: updated 9 project files since the last release:
|
|
43
|
+
- dependencies (9)
|
|
44
|
+
|
|
45
|
+
- [kc] kettle-jem/template: updated 3 project files since the last release:
|
|
46
|
+
- code and tests (2)
|
|
47
|
+
- other (1)
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- GitHub CI monitoring (`CIHelpers` / `CIMonitor` / `ReleaseCLI`): follow HTTP `301`/`302`/`307`/`308` redirects (forwarding `Authorization` only on same-host redirects, capped at 5 hops) instead of silently returning `nil` for 300s, switch monitoring to the canonical `owner/repo` on permanent redirects, and surface a loud warning + non-blocking diagnostic + final summary `Warnings:` line with the exact `git remote set-url` command; pre-empt the 300s workflow-start timeout by failing fast on wrong/nonexistent remotes (HTTP 404), unpushed commits (`git ls-remote` + GitHub `/commits/:sha` 404/422 suggesting `--start-step 9`), disabled GitHub Actions or disabled workflows, broken workflow YAML, and branch trigger mismatches (fixes #71)
|
|
52
|
+
- `ReleaseCLI#push!` and `push_tags!`: record optional remotes skipped during fetch parity (`fetch_remote_for_parity!`) in `@skip_remotes`, exclude the aggregate `"all"` remote from individual remote candidates, fall back to pushing active individual remotes (`origin` first) if `git push all` / `git push all --tags` fails (preventing an unreachable optional mirror such as Codeberg from aborting `git push all` before GitHub is pushed), and abort with `--start-step 9` when pushing to a required remote fails instead of silently continuing into CI monitoring (fixes #73)
|
|
53
|
+
|
|
33
54
|
## [3.1.33] - 2026-11-27
|
|
34
55
|
|
|
35
56
|
- TAG: [v3.1.33][3.1.33t]
|
|
@@ -4408,7 +4429,9 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
4408
4429
|
- Selecting will run the selected workflow via `act`
|
|
4409
4430
|
- This may move to its own gem in the future.
|
|
4410
4431
|
|
|
4411
|
-
[Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.
|
|
4432
|
+
[Unreleased]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.34...HEAD
|
|
4433
|
+
[3.1.34]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.33...v3.1.34
|
|
4434
|
+
[3.1.34t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.34
|
|
4412
4435
|
[3.1.33]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.32...v3.1.33
|
|
4413
4436
|
[3.1.33t]: https://github.com/kettle-dev/kettle-dev/releases/tag/v3.1.33
|
|
4414
4437
|
[3.1.32]: https://github.com/kettle-dev/kettle-dev/compare/v3.1.31...v3.1.32
|
data/README.md
CHANGED
|
@@ -1034,7 +1034,7 @@ Thanks for RTFM. ☺️
|
|
|
1034
1034
|
[📌gitmoji]: https://gitmoji.dev
|
|
1035
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
|
|
1036
1036
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
1037
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-6.
|
|
1037
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-6.813-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
1038
1038
|
[🔐security]: https://github.com/kettle-dev/kettle-dev/blob/main/SECURITY.md
|
|
1039
1039
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
1040
1040
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -12,6 +12,11 @@ module Kettle
|
|
|
12
12
|
# GitHub API rejected the request because the token is invalid/revoked.
|
|
13
13
|
class CIAuthError < StandardError; end
|
|
14
14
|
|
|
15
|
+
# Non-retryable CI setup/configuration failure (wrong remote / 404,
|
|
16
|
+
# unpushed commit, Actions disabled, broken workflow YAML, trigger mismatch,
|
|
17
|
+
# or redirect loop) that must fail fast rather than waiting for timeout.
|
|
18
|
+
class CIConfigurationError < StandardError; end
|
|
19
|
+
|
|
15
20
|
# GitHub API quota exhausted. Recoverable: retry after the reset time.
|
|
16
21
|
class CIRateLimitError < StandardError
|
|
17
22
|
attr_reader :reset_at
|
|
@@ -155,12 +160,10 @@ module Kettle
|
|
|
155
160
|
"id" => run["id"],
|
|
156
161
|
"head_sha" => run["head_sha"]
|
|
157
162
|
}
|
|
158
|
-
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError
|
|
159
|
-
# Auth failures are fatal; rate limits are recoverable
|
|
160
|
-
# the monitor (which parks until the reset) — swallowing
|
|
161
|
-
# the poll into an infinite 0/N tick.
|
|
162
|
-
# fail the same way, so swallowing this turns the monitor into an
|
|
163
|
-
# infinite 0/N tick. Re-raise for the caller to abort with guidance.
|
|
163
|
+
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
|
|
164
|
+
# Auth and configuration failures are fatal; rate limits are recoverable
|
|
165
|
+
# but must reach the monitor (which parks until the reset) — swallowing
|
|
166
|
+
# any of them turns the poll into an infinite 0/N tick.
|
|
164
167
|
raise
|
|
165
168
|
rescue => e
|
|
166
169
|
Kettle::Dev.debug_error(e, __method__)
|
|
@@ -290,17 +293,63 @@ module Kettle
|
|
|
290
293
|
end
|
|
291
294
|
# rubocop:enable ThreadSafety/ClassInstanceVariable
|
|
292
295
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
296
|
+
MAX_GITHUB_REDIRECTS = 5
|
|
297
|
+
PERMANENT_REDIRECT_CODES = [301, 308].freeze
|
|
298
|
+
|
|
299
|
+
def github_request(url, token:, on_redirect: nil, max_redirects: MAX_GITHUB_REDIRECTS)
|
|
300
|
+
current_url = url.to_s
|
|
301
|
+
initial_host = URI(current_url).hostname
|
|
302
|
+
redirects = []
|
|
303
|
+
|
|
304
|
+
(max_redirects + 1).times do
|
|
305
|
+
github_rate_limit_wait!
|
|
306
|
+
uri = URI(current_url)
|
|
307
|
+
req = Net::HTTP::Get.new(uri)
|
|
308
|
+
req["User-Agent"] = "kettle-dev/ci-helpers"
|
|
309
|
+
if token && !token.empty? && uri.hostname == initial_host
|
|
310
|
+
req["Authorization"] = "token #{token}"
|
|
311
|
+
end
|
|
312
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
|
|
313
|
+
|
|
314
|
+
# Dispatch on is_a? rather than `case`/===: verifying doubles
|
|
315
|
+
# (instance_double(Net::HTTPOK)) used in specs do not reliably match
|
|
316
|
+
# `Net::HTTPSuccess === res`, which silently degraded every stubbed
|
|
317
|
+
# response to "no data".
|
|
318
|
+
return [res, redirects] if res.is_a?(Net::HTTPSuccess)
|
|
319
|
+
|
|
320
|
+
if res.is_a?(Net::HTTPRedirection)
|
|
321
|
+
location = res["location"] || res["Location"]
|
|
322
|
+
return [res, redirects] if location.nil? || location.empty?
|
|
323
|
+
|
|
324
|
+
next_url = URI.join(current_url, location).to_s
|
|
325
|
+
hop = {from: current_url, to: next_url, code: res.code.to_i}
|
|
326
|
+
redirects << hop
|
|
327
|
+
on_redirect&.call(hop)
|
|
328
|
+
current_url = next_url
|
|
329
|
+
next
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
return [res, redirects]
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
raise(
|
|
336
|
+
Kettle::Dev::CIConfigurationError,
|
|
337
|
+
"GitHub API exceeded #{max_redirects} redirects starting from #{url}."
|
|
338
|
+
)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def github_get_json(url, token:, on_redirect: nil, **options)
|
|
342
|
+
res, redirects = github_request(url, token: token, on_redirect: on_redirect)
|
|
343
|
+
if on_redirect.nil?
|
|
344
|
+
permanent = redirects.find { |hop| PERMANENT_REDIRECT_CODES.include?(hop[:code]) }
|
|
345
|
+
if permanent
|
|
346
|
+
warn(
|
|
347
|
+
"[kettle-dev] WARNING: GitHub API permanently redirected #{permanent[:from]} -> " \
|
|
348
|
+
"#{redirects.last[:to]} (HTTP #{permanent[:code]}). Update your git remote URL to the canonical repository."
|
|
349
|
+
)
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
304
353
|
if res.is_a?(Net::HTTPSuccess)
|
|
305
354
|
JSON.parse(res.body)
|
|
306
355
|
elsif res.is_a?(Net::HTTPUnauthorized)
|
|
@@ -317,9 +366,9 @@ module Kettle
|
|
|
317
366
|
# Rate limited: recoverable. Honor the reset time, then let the
|
|
318
367
|
# caller retry the poll cycle.
|
|
319
368
|
reset_at = Time.at(res["X-RateLimit-Reset"].to_i).utc
|
|
320
|
-
raise(
|
|
321
|
-
|
|
322
|
-
|
|
369
|
+
raise Kettle::Dev::CIRateLimitError.new(
|
|
370
|
+
"GitHub API rate limit exceeded; resets at #{reset_at.strftime("%H:%M:%SZ")}",
|
|
371
|
+
reset_at: reset_at
|
|
323
372
|
)
|
|
324
373
|
end
|
|
325
374
|
|
|
@@ -331,6 +380,344 @@ module Kettle
|
|
|
331
380
|
end
|
|
332
381
|
end
|
|
333
382
|
|
|
383
|
+
# Fetch GitHub repository metadata, following redirects and detecting 404.
|
|
384
|
+
# Returns nil on transient/network errors so callers can fail open when offline.
|
|
385
|
+
# @param owner [String]
|
|
386
|
+
# @param repo [String]
|
|
387
|
+
# @param token [String, nil]
|
|
388
|
+
# @return [Hash, nil]
|
|
389
|
+
def github_repo_info(owner:, repo:, token: default_token, **options)
|
|
390
|
+
return unless owner && repo
|
|
391
|
+
|
|
392
|
+
url = "https://api.github.com/repos/#{owner}/#{repo}"
|
|
393
|
+
res, redirects = github_request(url, token: token)
|
|
394
|
+
if res.is_a?(Net::HTTPSuccess)
|
|
395
|
+
data = JSON.parse(res.body)
|
|
396
|
+
{
|
|
397
|
+
"data" => data,
|
|
398
|
+
"full_name" => data["full_name"],
|
|
399
|
+
"default_branch" => data["default_branch"],
|
|
400
|
+
"archived" => data["archived"],
|
|
401
|
+
"redirected" => redirects.any? { |hop| PERMANENT_REDIRECT_CODES.include?(hop[:code]) },
|
|
402
|
+
"redirects" => redirects
|
|
403
|
+
}
|
|
404
|
+
elsif res.is_a?(Net::HTTPNotFound)
|
|
405
|
+
raise(
|
|
406
|
+
Kettle::Dev::CIConfigurationError,
|
|
407
|
+
"GitHub repository #{owner}/#{repo} not found (HTTP 404). " \
|
|
408
|
+
"Check the git remote URL and ensure GITHUB_TOKEN / GH_TOKEN has access to this repository."
|
|
409
|
+
)
|
|
410
|
+
elsif res.is_a?(Net::HTTPUnauthorized)
|
|
411
|
+
raise(
|
|
412
|
+
Kettle::Dev::CIAuthError,
|
|
413
|
+
"GitHub API rejected the request (401: invalid or revoked token) for #{url}. " \
|
|
414
|
+
"Check GITHUB_TOKEN / GH_TOKEN."
|
|
415
|
+
)
|
|
416
|
+
elsif res.is_a?(Net::HTTPForbidden) && res["X-RateLimit-Remaining"].to_i.zero?
|
|
417
|
+
reset_at = Time.at(res["X-RateLimit-Reset"].to_i).utc
|
|
418
|
+
raise Kettle::Dev::CIRateLimitError.new(
|
|
419
|
+
"GitHub API rate limit exceeded; resets at #{reset_at.strftime("%H:%M:%SZ")}",
|
|
420
|
+
reset_at: reset_at
|
|
421
|
+
)
|
|
422
|
+
end
|
|
423
|
+
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
|
|
424
|
+
raise
|
|
425
|
+
rescue => e
|
|
426
|
+
Kettle::Dev.debug_error(e, __method__)
|
|
427
|
+
nil
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# Check whether a commit SHA exists on GitHub for the given repository.
|
|
431
|
+
# Returns true when present, false on 404/422 (missing commit), or nil on unknown/network error.
|
|
432
|
+
# @param owner [String]
|
|
433
|
+
# @param repo [String]
|
|
434
|
+
# @param head_sha [String]
|
|
435
|
+
# @param token [String, nil]
|
|
436
|
+
# @return [Boolean, nil]
|
|
437
|
+
def github_commit_exists?(owner:, repo:, head_sha:, token: default_token, **options)
|
|
438
|
+
return nil unless owner && repo && head_sha && !head_sha.empty?
|
|
439
|
+
|
|
440
|
+
url = "https://api.github.com/repos/#{owner}/#{repo}/commits/#{URI.encode_www_form_component(head_sha)}"
|
|
441
|
+
res, _redirects = github_request(url, token: token)
|
|
442
|
+
return true if res.is_a?(Net::HTTPSuccess)
|
|
443
|
+
return false if res.is_a?(Net::HTTPNotFound) || res.is_a?(Net::HTTPUnprocessableEntity)
|
|
444
|
+
|
|
445
|
+
if res.is_a?(Net::HTTPUnauthorized)
|
|
446
|
+
raise(
|
|
447
|
+
Kettle::Dev::CIAuthError,
|
|
448
|
+
"GitHub API rejected the request (401: invalid or revoked token) for #{url}. " \
|
|
449
|
+
"Check GITHUB_TOKEN / GH_TOKEN."
|
|
450
|
+
)
|
|
451
|
+
elsif res.is_a?(Net::HTTPForbidden) && res["X-RateLimit-Remaining"].to_i.zero?
|
|
452
|
+
reset_at = Time.at(res["X-RateLimit-Reset"].to_i).utc
|
|
453
|
+
raise Kettle::Dev::CIRateLimitError.new(
|
|
454
|
+
"GitHub API rate limit exceeded; resets at #{reset_at.strftime("%H:%M:%SZ")}",
|
|
455
|
+
reset_at: reset_at
|
|
456
|
+
)
|
|
457
|
+
end
|
|
458
|
+
nil
|
|
459
|
+
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
|
|
460
|
+
raise
|
|
461
|
+
rescue => e
|
|
462
|
+
Kettle::Dev.debug_error(e, __method__)
|
|
463
|
+
nil
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
# Fetch GitHub Actions repository permissions (e.g. {"enabled" => true/false}).
|
|
467
|
+
# Returns nil when unavailable (e.g., 403/404 or network error).
|
|
468
|
+
# @param owner [String]
|
|
469
|
+
# @param repo [String]
|
|
470
|
+
# @param token [String, nil]
|
|
471
|
+
# @return [Hash, nil]
|
|
472
|
+
def github_actions_permissions(owner:, repo:, token: default_token, **options)
|
|
473
|
+
return nil unless owner && repo
|
|
474
|
+
|
|
475
|
+
github_get_json(
|
|
476
|
+
"https://api.github.com/repos/#{owner}/#{repo}/actions/permissions",
|
|
477
|
+
token: token
|
|
478
|
+
)
|
|
479
|
+
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
|
|
480
|
+
raise
|
|
481
|
+
rescue => e
|
|
482
|
+
Kettle::Dev.debug_error(e, __method__)
|
|
483
|
+
nil
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
# Fetch GitHub Actions workflow definitions registered on GitHub.
|
|
487
|
+
# Returns nil when unavailable.
|
|
488
|
+
# @param owner [String]
|
|
489
|
+
# @param repo [String]
|
|
490
|
+
# @param token [String, nil]
|
|
491
|
+
# @return [Array<Hash>, nil]
|
|
492
|
+
def github_actions_workflows(owner:, repo:, token: default_token, **options)
|
|
493
|
+
return nil unless owner && repo
|
|
494
|
+
|
|
495
|
+
data = github_get_json(
|
|
496
|
+
"https://api.github.com/repos/#{owner}/#{repo}/actions/workflows?per_page=100",
|
|
497
|
+
token: token
|
|
498
|
+
)
|
|
499
|
+
return nil unless data.is_a?(Hash) && data.key?("workflows")
|
|
500
|
+
|
|
501
|
+
Array(data["workflows"])
|
|
502
|
+
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
|
|
503
|
+
raise
|
|
504
|
+
rescue => e
|
|
505
|
+
Kettle::Dev.debug_error(e, __method__)
|
|
506
|
+
nil
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
# Rewrite a GitHub remote URL to point at a new owner/repo while preserving
|
|
510
|
+
# SSH vs HTTPS scheme and optional .git suffix.
|
|
511
|
+
# @param url [String]
|
|
512
|
+
# @param new_owner [String]
|
|
513
|
+
# @param new_repo [String]
|
|
514
|
+
# @return [String]
|
|
515
|
+
def rewrite_github_remote_url(url, new_owner, new_repo)
|
|
516
|
+
raw = url.to_s.strip
|
|
517
|
+
suffix = raw.end_with?(".git") ? ".git" : ""
|
|
518
|
+
if raw.start_with?("git@github.com:")
|
|
519
|
+
"git@github.com:#{new_owner}/#{new_repo}#{suffix}"
|
|
520
|
+
elsif raw =~ %r{\A((?:git\+)?ssh://[^/]+/)}
|
|
521
|
+
"#{Regexp.last_match(1)}#{new_owner}/#{new_repo}#{suffix}"
|
|
522
|
+
else
|
|
523
|
+
"https://github.com/#{new_owner}/#{new_repo}#{suffix}"
|
|
524
|
+
end
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
# Parse monitored local workflow YAML files and fail fast on syntax or structure errors.
|
|
528
|
+
# @param root [String]
|
|
529
|
+
# @param workflows [Array<String>]
|
|
530
|
+
# @return [Hash{String => Hash}] parsed workflow documents keyed by filename
|
|
531
|
+
def validate_workflow_yaml!(root:, workflows:, **options)
|
|
532
|
+
documents = {}
|
|
533
|
+
Array(workflows).each do |wf|
|
|
534
|
+
path = File.join(root.to_s, ".github", "workflows", wf)
|
|
535
|
+
next unless File.file?(path)
|
|
536
|
+
|
|
537
|
+
begin
|
|
538
|
+
doc = Kettle::Dev.safe_load_yaml(File.read(path), aliases: true)
|
|
539
|
+
rescue Psych::Exception => error
|
|
540
|
+
raise(
|
|
541
|
+
Kettle::Dev::CIConfigurationError,
|
|
542
|
+
"Workflow YAML syntax error in .github/workflows/#{wf}: #{error.message}. " \
|
|
543
|
+
"Fix the workflow file before releasing."
|
|
544
|
+
)
|
|
545
|
+
end
|
|
546
|
+
|
|
547
|
+
unless doc.is_a?(Hash)
|
|
548
|
+
raise(
|
|
549
|
+
Kettle::Dev::CIConfigurationError,
|
|
550
|
+
"Workflow .github/workflows/#{wf} is not a valid YAML mapping. " \
|
|
551
|
+
"Fix the workflow file before releasing."
|
|
552
|
+
)
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
documents[wf] = doc
|
|
556
|
+
end
|
|
557
|
+
documents
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# Validate that each parsed workflow document can actually trigger on the
|
|
561
|
+
# target branch. Raises CIConfigurationError when one or more workflows
|
|
562
|
+
# have incompatible triggers.
|
|
563
|
+
# @param documents [Hash{String => Hash}]
|
|
564
|
+
# @param branch [String]
|
|
565
|
+
# @param default_branch [String, nil]
|
|
566
|
+
# @return [void]
|
|
567
|
+
def validate_workflow_triggers!(documents:, branch:, default_branch: nil, **options)
|
|
568
|
+
mismatched = []
|
|
569
|
+
documents.each do |wf, doc|
|
|
570
|
+
next if workflow_can_trigger_for_branch?(doc, branch: branch, default_branch: default_branch)
|
|
571
|
+
|
|
572
|
+
triggers = workflow_triggers(doc)
|
|
573
|
+
mismatched << "#{wf} (#{describe_workflow_triggers(triggers)})"
|
|
574
|
+
end
|
|
575
|
+
return if mismatched.empty?
|
|
576
|
+
|
|
577
|
+
raise(
|
|
578
|
+
Kettle::Dev::CIConfigurationError,
|
|
579
|
+
"GitHub Actions workflow trigger mismatch for branch '#{branch}': #{mismatched.join(", ")}. " \
|
|
580
|
+
"Update the workflow `on:` triggers for '#{branch}' or select runnable workflows with --ci-workflows."
|
|
581
|
+
)
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
# Extract the `on:` trigger block from a parsed workflow document.
|
|
585
|
+
# Psych (YAML 1.1) parses an unquoted `on:` key as boolean `true`.
|
|
586
|
+
# @param document [Hash]
|
|
587
|
+
# @return [Object]
|
|
588
|
+
def workflow_triggers(document)
|
|
589
|
+
return nil unless document.is_a?(Hash)
|
|
590
|
+
|
|
591
|
+
document.key?("on") ? document["on"] : document[true]
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
# Whether a workflow document can trigger for the given branch.
|
|
595
|
+
# On the default branch, ReleaseCLI pushes directly without opening a PR or
|
|
596
|
+
# dispatching workflow_dispatch, so a matching `push` trigger is required.
|
|
597
|
+
# On non-default branches (or when default_branch is unknown), `pull_request`
|
|
598
|
+
# or `workflow_dispatch` may trigger CI as well.
|
|
599
|
+
# @param document [Hash]
|
|
600
|
+
# @param branch [String]
|
|
601
|
+
# @param default_branch [String, nil]
|
|
602
|
+
# @return [Boolean]
|
|
603
|
+
def workflow_can_trigger_for_branch?(document, branch:, default_branch: nil, **options)
|
|
604
|
+
triggers = workflow_triggers(document)
|
|
605
|
+
return false if triggers.nil?
|
|
606
|
+
return true if push_trigger_matches_branch?(triggers, branch)
|
|
607
|
+
|
|
608
|
+
on_default_branch = !default_branch.nil? && !default_branch.empty? && branch == default_branch
|
|
609
|
+
return false if on_default_branch
|
|
610
|
+
|
|
611
|
+
trigger_present?(triggers, "pull_request") || trigger_present?(triggers, "workflow_dispatch")
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
# @param triggers [Object]
|
|
615
|
+
# @param branch [String]
|
|
616
|
+
# @return [Boolean]
|
|
617
|
+
def push_trigger_matches_branch?(triggers, branch)
|
|
618
|
+
case triggers
|
|
619
|
+
when String, Symbol
|
|
620
|
+
triggers.to_s == "push"
|
|
621
|
+
when Array
|
|
622
|
+
triggers.any? { |t| t.to_s == "push" }
|
|
623
|
+
when Hash
|
|
624
|
+
return false unless triggers.key?("push") || triggers.key?(:push)
|
|
625
|
+
|
|
626
|
+
push_cfg = triggers.key?("push") ? triggers["push"] : triggers[:push]
|
|
627
|
+
return true if push_cfg.nil?
|
|
628
|
+
return true unless push_cfg.is_a?(Hash)
|
|
629
|
+
|
|
630
|
+
branches = push_cfg["branches"]
|
|
631
|
+
branches_ignore = push_cfg["branches-ignore"]
|
|
632
|
+
tags = push_cfg["tags"]
|
|
633
|
+
tags_ignore = push_cfg["tags-ignore"]
|
|
634
|
+
|
|
635
|
+
return false if branches.nil? && branches_ignore.nil? && (!tags.nil? || !tags_ignore.nil?)
|
|
636
|
+
return github_branch_patterns_match?(branch, Array(branches)) unless branches.nil?
|
|
637
|
+
return !github_branch_patterns_match?(branch, Array(branches_ignore)) unless branches_ignore.nil?
|
|
638
|
+
|
|
639
|
+
true
|
|
640
|
+
else
|
|
641
|
+
false
|
|
642
|
+
end
|
|
643
|
+
end
|
|
644
|
+
|
|
645
|
+
# @param triggers [Object]
|
|
646
|
+
# @param name [String]
|
|
647
|
+
# @return [Boolean]
|
|
648
|
+
def trigger_present?(triggers, name)
|
|
649
|
+
case triggers
|
|
650
|
+
when String, Symbol
|
|
651
|
+
triggers.to_s == name
|
|
652
|
+
when Array
|
|
653
|
+
triggers.any? { |t| t.to_s == name }
|
|
654
|
+
when Hash
|
|
655
|
+
triggers.key?(name) || triggers.key?(name.to_sym)
|
|
656
|
+
else
|
|
657
|
+
false
|
|
658
|
+
end
|
|
659
|
+
end
|
|
660
|
+
|
|
661
|
+
# Evaluate GitHub Actions branch glob patterns (including leading `!` negations).
|
|
662
|
+
# @param branch [String]
|
|
663
|
+
# @param patterns [Array<String>]
|
|
664
|
+
# @return [Boolean]
|
|
665
|
+
def github_branch_patterns_match?(branch, patterns)
|
|
666
|
+
matched = false
|
|
667
|
+
Array(patterns).each do |raw_pattern|
|
|
668
|
+
pattern = raw_pattern.to_s
|
|
669
|
+
if pattern.start_with?("!")
|
|
670
|
+
negated = pattern.sub(/\A!/, "")
|
|
671
|
+
matched = false if github_glob_to_regexp(negated).match?(branch)
|
|
672
|
+
elsif github_glob_to_regexp(pattern).match?(branch)
|
|
673
|
+
matched = true
|
|
674
|
+
end
|
|
675
|
+
end
|
|
676
|
+
matched
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
# Convert a GitHub Actions glob pattern (`**`, `*`, `?`) into an anchored Regexp.
|
|
680
|
+
# @param pattern [String]
|
|
681
|
+
# @return [Regexp]
|
|
682
|
+
def github_glob_to_regexp(pattern)
|
|
683
|
+
escaped = pattern.to_s.gsub(/(\*\*|\*|\?|[^*?]+)/) do |token|
|
|
684
|
+
case token
|
|
685
|
+
when "**" then ".*"
|
|
686
|
+
when "*" then "[^/]*"
|
|
687
|
+
when "?" then "[^/]"
|
|
688
|
+
else Regexp.escape(token)
|
|
689
|
+
end
|
|
690
|
+
end
|
|
691
|
+
/\A#{escaped}\z/
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# Human-readable summary of a workflow's configured `on:` triggers.
|
|
695
|
+
# @param triggers [Object]
|
|
696
|
+
# @return [String]
|
|
697
|
+
def describe_workflow_triggers(triggers)
|
|
698
|
+
case triggers
|
|
699
|
+
when nil
|
|
700
|
+
"missing `on:` triggers"
|
|
701
|
+
when String, Symbol
|
|
702
|
+
"triggers: #{triggers}"
|
|
703
|
+
when Array
|
|
704
|
+
"triggers: #{triggers.join(", ")}"
|
|
705
|
+
when Hash
|
|
706
|
+
parts = triggers.map do |key, value|
|
|
707
|
+
if key.to_s == "push" && value.is_a?(Hash) && value["branches"]
|
|
708
|
+
"push[branches: #{Array(value["branches"]).join(", ")}]"
|
|
709
|
+
elsif key.to_s == "push" && value.is_a?(Hash) && value["branches-ignore"]
|
|
710
|
+
"push[branches-ignore: #{Array(value["branches-ignore"]).join(", ")}]"
|
|
711
|
+
else
|
|
712
|
+
key.to_s
|
|
713
|
+
end
|
|
714
|
+
end
|
|
715
|
+
"triggers: #{parts.join(", ")}"
|
|
716
|
+
else
|
|
717
|
+
"invalid `on:` triggers"
|
|
718
|
+
end
|
|
719
|
+
end
|
|
720
|
+
|
|
334
721
|
# Whether a run has completed successfully.
|
|
335
722
|
# @param run [Hash, nil]
|
|
336
723
|
# @return [Boolean]
|
|
@@ -372,10 +759,9 @@ module Kettle
|
|
|
372
759
|
"html_url" => job["html_url"]
|
|
373
760
|
}
|
|
374
761
|
end
|
|
375
|
-
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError
|
|
376
|
-
# See latest_run: auth/rate-limit failures must abort or
|
|
377
|
-
# monitor, not degrade
|
|
378
|
-
# to "no jobs yet".
|
|
762
|
+
rescue Kettle::Dev::CIAuthError, Kettle::Dev::CIRateLimitError, Kettle::Dev::CIConfigurationError
|
|
763
|
+
# See latest_run: auth/configuration/rate-limit failures must abort or
|
|
764
|
+
# park the monitor, not degrade to "no jobs yet".
|
|
379
765
|
raise
|
|
380
766
|
rescue => e
|
|
381
767
|
Kettle::Dev.debug_error(e, __method__)
|
|
@@ -50,6 +50,7 @@ module Kettle
|
|
|
50
50
|
# @param restart_hint [String] guidance command shown on failure
|
|
51
51
|
# @return [Boolean] whether all configured CI providers passed
|
|
52
52
|
def monitor_all!(restart_hint: "bundle exec kettle-release --start-step 10", workflows: nil, keepalive: nil, event_recorder: nil, **options)
|
|
53
|
+
clear_warnings!
|
|
53
54
|
# Rate limiting is recoverable: when the GitHub monitor parks for the
|
|
54
55
|
# quota reset it returns :rate_limited and we re-enter it. GitLab has
|
|
55
56
|
# no equivalent, so only the GitHub result drives the retry.
|
|
@@ -66,6 +67,28 @@ module Kettle
|
|
|
66
67
|
results.all? { |result| result != false }
|
|
67
68
|
end
|
|
68
69
|
|
|
70
|
+
WARNINGS_THREAD_KEY = :kettle_dev_ci_monitor_warnings
|
|
71
|
+
|
|
72
|
+
def clear_warnings!
|
|
73
|
+
Thread.current[WARNINGS_THREAD_KEY] = []
|
|
74
|
+
end
|
|
75
|
+
module_function :clear_warnings!
|
|
76
|
+
|
|
77
|
+
def record_warning(kind:, message:)
|
|
78
|
+
warnings = (Thread.current[WARNINGS_THREAD_KEY] ||= [])
|
|
79
|
+
entry = {kind: kind.to_s, message: message.to_s}
|
|
80
|
+
warnings << entry unless warnings.include?(entry)
|
|
81
|
+
entry
|
|
82
|
+
end
|
|
83
|
+
module_function :record_warning
|
|
84
|
+
|
|
85
|
+
def take_warnings
|
|
86
|
+
warnings = Array(Thread.current[WARNINGS_THREAD_KEY]).dup
|
|
87
|
+
Thread.current[WARNINGS_THREAD_KEY] = []
|
|
88
|
+
warnings
|
|
89
|
+
end
|
|
90
|
+
module_function :take_warnings
|
|
91
|
+
|
|
69
92
|
def continue_ci_failures?
|
|
70
93
|
!!(Kettle::Dev::ENV_TRUE_RE =~ ENV.fetch("K_RELEASE_CI_CONTINUE", "false"))
|
|
71
94
|
end
|
|
@@ -304,6 +327,19 @@ module Kettle
|
|
|
304
327
|
head_sha = Kettle::Dev::CIHelpers.current_head_sha
|
|
305
328
|
abort("Could not determine local HEAD SHA for GitHub Actions checks.") unless head_sha && !head_sha.empty?
|
|
306
329
|
|
|
330
|
+
owner, repo = preflight_github_ci!(
|
|
331
|
+
root: root,
|
|
332
|
+
workflows: workflows,
|
|
333
|
+
gh_remote: gh_remote,
|
|
334
|
+
url: url,
|
|
335
|
+
owner: owner,
|
|
336
|
+
repo: repo,
|
|
337
|
+
branch: branch,
|
|
338
|
+
head_sha: head_sha,
|
|
339
|
+
restart_hint: restart_hint,
|
|
340
|
+
event_recorder: event_recorder
|
|
341
|
+
)
|
|
342
|
+
|
|
307
343
|
passed = {}
|
|
308
344
|
failed = {}
|
|
309
345
|
started = {}
|
|
@@ -549,9 +585,142 @@ module Kettle
|
|
|
549
585
|
)
|
|
550
586
|
sleep(wait)
|
|
551
587
|
:rate_limited
|
|
588
|
+
rescue Kettle::Dev::CIConfigurationError => error
|
|
589
|
+
pbar&.finish unless pbar&.finished?
|
|
590
|
+
emit_ci_monitor_event(
|
|
591
|
+
event_recorder,
|
|
592
|
+
action: "github_preflight",
|
|
593
|
+
status: "failed",
|
|
594
|
+
provider: "github",
|
|
595
|
+
head_sha: head_sha,
|
|
596
|
+
reason: error.message
|
|
597
|
+
)
|
|
598
|
+
abort(error.message)
|
|
552
599
|
end
|
|
553
600
|
module_function :monitor_github_internal!
|
|
554
601
|
|
|
602
|
+
# Run fast preflight checks before entering the 300s workflow-start poll
|
|
603
|
+
# loop so expected irrecoverable states (broken workflow YAML, unpushed
|
|
604
|
+
# commits, nonexistent 404 repo, redirected remote, branch trigger
|
|
605
|
+
# mismatch, disabled Actions or workflows) are handled immediately.
|
|
606
|
+
# Returns the canonical [owner, repo] pair (following permanent redirects).
|
|
607
|
+
def preflight_github_ci!(root:, workflows:, gh_remote:, url:, owner:, repo:, branch:, head_sha:, restart_hint:, event_recorder: nil, **options)
|
|
608
|
+
workflow_docs = Kettle::Dev::CIHelpers.validate_workflow_yaml!(root: root, workflows: workflows)
|
|
609
|
+
remote_commit_confirmed = check_github_commit_pushed!(gh_remote: gh_remote, branch: branch, head_sha: head_sha)
|
|
610
|
+
|
|
611
|
+
repo_info = Kettle::Dev::CIHelpers.github_repo_info(owner: owner, repo: repo)
|
|
612
|
+
if repo_info && repo_info["redirected"]
|
|
613
|
+
canonical_full_name = repo_info["full_name"].to_s
|
|
614
|
+
new_owner, new_repo = canonical_full_name.split("/", 2)
|
|
615
|
+
if new_owner && new_repo && !new_owner.empty? && !new_repo.empty? &&
|
|
616
|
+
canonical_full_name.casecmp("#{owner}/#{repo}") != 0
|
|
617
|
+
canonical_url = Kettle::Dev::CIHelpers.rewrite_github_remote_url(url, new_owner, new_repo)
|
|
618
|
+
fix_cmd = "git remote set-url #{gh_remote} #{canonical_url}"
|
|
619
|
+
msg = "Remote '#{gh_remote}' points to #{owner}/#{repo}, which permanently redirected to #{new_owner}/#{new_repo}. " \
|
|
620
|
+
"Update it with: #{fix_cmd}"
|
|
621
|
+
warn("WARNING: #{msg}")
|
|
622
|
+
record_warning(kind: "ci_remote_redirect", message: msg)
|
|
623
|
+
emit_ci_monitor_event(
|
|
624
|
+
event_recorder,
|
|
625
|
+
action: "github_remote_redirect",
|
|
626
|
+
status: "warning",
|
|
627
|
+
provider: "github",
|
|
628
|
+
remote: gh_remote,
|
|
629
|
+
from: "#{owner}/#{repo}",
|
|
630
|
+
to: "#{new_owner}/#{new_repo}",
|
|
631
|
+
recommended_command: fix_cmd,
|
|
632
|
+
reason: msg
|
|
633
|
+
)
|
|
634
|
+
owner = new_owner
|
|
635
|
+
repo = new_repo
|
|
636
|
+
end
|
|
637
|
+
end
|
|
638
|
+
|
|
639
|
+
default_branch = repo_info && repo_info["default_branch"]
|
|
640
|
+
Kettle::Dev::CIHelpers.validate_workflow_triggers!(
|
|
641
|
+
documents: workflow_docs,
|
|
642
|
+
branch: branch,
|
|
643
|
+
default_branch: default_branch
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
if repo_info
|
|
647
|
+
unless remote_commit_confirmed
|
|
648
|
+
commit_exists = Kettle::Dev::CIHelpers.github_commit_exists?(owner: owner, repo: repo, head_sha: head_sha)
|
|
649
|
+
if commit_exists == false
|
|
650
|
+
raise(
|
|
651
|
+
Kettle::Dev::CIConfigurationError,
|
|
652
|
+
"Commit #{head_sha[0, 12]} does not exist on GitHub (#{owner}/#{repo}). " \
|
|
653
|
+
"Push branch '#{branch}' to '#{gh_remote}' (or resume from step 9: bundle exec kettle-release --start-step 9) before monitoring CI."
|
|
654
|
+
)
|
|
655
|
+
end
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
perms = Kettle::Dev::CIHelpers.github_actions_permissions(owner: owner, repo: repo)
|
|
659
|
+
if perms.is_a?(Hash) && perms["enabled"] == false
|
|
660
|
+
raise(
|
|
661
|
+
Kettle::Dev::CIConfigurationError,
|
|
662
|
+
"GitHub Actions is disabled for #{owner}/#{repo}. " \
|
|
663
|
+
"Enable Actions in repository settings, then restart from CI validation with: #{restart_hint}"
|
|
664
|
+
)
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
remote_workflows = Kettle::Dev::CIHelpers.github_actions_workflows(owner: owner, repo: repo)
|
|
668
|
+
if remote_workflows.is_a?(Array)
|
|
669
|
+
by_path = {}
|
|
670
|
+
remote_workflows.each { |entry| by_path[entry["path"].to_s] = entry if entry.is_a?(Hash) }
|
|
671
|
+
disabled = workflows.each_with_object([]) do |wf, list|
|
|
672
|
+
entry = by_path[".github/workflows/#{wf}"]
|
|
673
|
+
next unless entry
|
|
674
|
+
|
|
675
|
+
state = entry["state"].to_s
|
|
676
|
+
list << "#{wf} (#{state})" if !state.empty? && state != "active"
|
|
677
|
+
end
|
|
678
|
+
unless disabled.empty?
|
|
679
|
+
raise(
|
|
680
|
+
Kettle::Dev::CIConfigurationError,
|
|
681
|
+
"GitHub Actions workflow(s) are disabled for #{owner}/#{repo}: #{disabled.join(", ")}. " \
|
|
682
|
+
"Re-enable them in GitHub Actions, then restart from CI validation with: #{restart_hint}"
|
|
683
|
+
)
|
|
684
|
+
end
|
|
685
|
+
end
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
[owner, repo]
|
|
689
|
+
end
|
|
690
|
+
module_function :preflight_github_ci!
|
|
691
|
+
|
|
692
|
+
# Check via git ls-remote + rev-list whether local HEAD has unpushed commits
|
|
693
|
+
# relative to gh_remote/branch. Returns true when remote_sha == head_sha,
|
|
694
|
+
# false when unknown, and raises CIConfigurationError when definitively ahead.
|
|
695
|
+
def check_github_commit_pushed!(gh_remote:, branch:, head_sha:)
|
|
696
|
+
adapter = Kettle::Dev::GitAdapter.new
|
|
697
|
+
out, ok = adapter.capture(["ls-remote", gh_remote, "refs/heads/#{branch}"])
|
|
698
|
+
return false unless ok
|
|
699
|
+
|
|
700
|
+
remote_sha = out.to_s.strip.split(/\s+/).first
|
|
701
|
+
return false unless remote_sha&.match?(/\A[0-9a-f]{40}\z/i)
|
|
702
|
+
return true if remote_sha == head_sha
|
|
703
|
+
|
|
704
|
+
ahead_out, ahead_ok = adapter.capture(["rev-list", "--count", "#{remote_sha}..#{head_sha}"])
|
|
705
|
+
ahead_count = ahead_out.to_s.strip.to_i
|
|
706
|
+
if ahead_ok && ahead_count.positive?
|
|
707
|
+
raise(
|
|
708
|
+
Kettle::Dev::CIConfigurationError,
|
|
709
|
+
"Local HEAD #{head_sha[0, 12]} is #{ahead_count} commit(s) ahead of #{gh_remote}/#{branch} " \
|
|
710
|
+
"(#{remote_sha[0, 12]}) and has not been pushed. " \
|
|
711
|
+
"Push your commits or resume from step 9 (bundle exec kettle-release --start-step 9) before monitoring CI."
|
|
712
|
+
)
|
|
713
|
+
end
|
|
714
|
+
|
|
715
|
+
false
|
|
716
|
+
rescue Kettle::Dev::CIConfigurationError
|
|
717
|
+
raise
|
|
718
|
+
rescue => error
|
|
719
|
+
Kettle::Dev.debug_error(error, __method__)
|
|
720
|
+
false
|
|
721
|
+
end
|
|
722
|
+
module_function :check_github_commit_pushed!
|
|
723
|
+
|
|
555
724
|
def monotonic_time
|
|
556
725
|
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
557
726
|
end
|
|
@@ -730,7 +899,7 @@ module Kettle
|
|
|
730
899
|
">"
|
|
731
900
|
when "ok", "skipped", "continued"
|
|
732
901
|
"."
|
|
733
|
-
when "failed"
|
|
902
|
+
when "failed", "warning"
|
|
734
903
|
"!"
|
|
735
904
|
else
|
|
736
905
|
"?"
|
|
@@ -615,6 +615,15 @@ module Kettle
|
|
|
615
615
|
# Fallback if detection fails for any reason
|
|
616
616
|
human_output.puts "\n🚀 Release v#{version || "unknown"} Complete 🚀"
|
|
617
617
|
end
|
|
618
|
+
print_release_warnings_summary!
|
|
619
|
+
end
|
|
620
|
+
|
|
621
|
+
def print_release_warnings_summary!
|
|
622
|
+
warnings = @diagnostics.select { |diag| diag[:severity].to_s == "warning" }
|
|
623
|
+
return if warnings.empty?
|
|
624
|
+
|
|
625
|
+
human_output.puts "\nWarnings:"
|
|
626
|
+
warnings.each { |diag| human_output.puts " - #{diag[:message]}" }
|
|
618
627
|
end
|
|
619
628
|
|
|
620
629
|
def normalize_appraisal_task(value)
|
|
@@ -1598,6 +1607,12 @@ module Kettle
|
|
|
1598
1607
|
rescue => error
|
|
1599
1608
|
emit_ci_monitor_event(action: "finish", status: "failed", workflows: @ci_workflows, restart_hint: restart_hint, reason: "#{error.class}: #{error.message}")
|
|
1600
1609
|
raise
|
|
1610
|
+
ensure
|
|
1611
|
+
if Kettle::Dev::CIMonitor.respond_to?(:take_warnings)
|
|
1612
|
+
Kettle::Dev::CIMonitor.take_warnings.each do |warning|
|
|
1613
|
+
record_diagnostic(warning[:kind], warning[:message], severity: "warning", blocking: false)
|
|
1614
|
+
end
|
|
1615
|
+
end
|
|
1601
1616
|
end
|
|
1602
1617
|
end
|
|
1603
1618
|
|
|
@@ -2588,35 +2603,64 @@ module Kettle
|
|
|
2588
2603
|
success = @git.push("all", branch)
|
|
2589
2604
|
unless success
|
|
2590
2605
|
warn("Normal push to 'all' failed; retrying with force push...")
|
|
2591
|
-
@git.push("all", branch, force: true)
|
|
2606
|
+
success = @git.push("all", branch, force: true)
|
|
2607
|
+
end
|
|
2608
|
+
return if success
|
|
2609
|
+
|
|
2610
|
+
remotes = individual_push_remotes
|
|
2611
|
+
if remotes.empty?
|
|
2612
|
+
abort("Failed to push #{branch} to remote 'all'. Fix remote connectivity/permissions and resume with: bundle exec kettle-release --start-step 9")
|
|
2592
2613
|
end
|
|
2614
|
+
|
|
2615
|
+
warn("Push to aggregate remote 'all' failed; falling back to active individual remotes: #{remotes.join(", ")}")
|
|
2616
|
+
push_individual_remotes!(remotes, branch)
|
|
2593
2617
|
return
|
|
2594
2618
|
end
|
|
2595
2619
|
|
|
2596
|
-
remotes =
|
|
2597
|
-
remotes << "origin" if has_remote?("origin") && !skipped_remote?("origin")
|
|
2598
|
-
remotes |= github_remote_candidates
|
|
2599
|
-
remotes |= gitlab_remote_candidates
|
|
2600
|
-
remotes |= codeberg_remote_candidates
|
|
2601
|
-
remotes.uniq!
|
|
2602
|
-
|
|
2620
|
+
remotes = individual_push_remotes
|
|
2603
2621
|
if remotes.empty?
|
|
2604
2622
|
puts "$ git push #{branch}"
|
|
2605
2623
|
success = @git.push(nil, branch)
|
|
2606
2624
|
unless success
|
|
2607
2625
|
warn("Normal push failed; retrying with force push...")
|
|
2608
|
-
@git.push(nil, branch, force: true)
|
|
2626
|
+
success = @git.push(nil, branch, force: true)
|
|
2609
2627
|
end
|
|
2610
|
-
return
|
|
2628
|
+
return if success
|
|
2629
|
+
|
|
2630
|
+
abort("Failed to push #{branch}. Fix remote connectivity/permissions and resume with: bundle exec kettle-release --start-step 9")
|
|
2611
2631
|
end
|
|
2612
2632
|
|
|
2633
|
+
push_individual_remotes!(remotes, branch)
|
|
2634
|
+
end
|
|
2635
|
+
|
|
2636
|
+
def individual_push_remotes
|
|
2637
|
+
remotes = []
|
|
2638
|
+
remotes << "origin" if has_remote?("origin") && !skipped_remote?("origin")
|
|
2639
|
+
remotes |= github_remote_candidates
|
|
2640
|
+
remotes |= gitlab_remote_candidates
|
|
2641
|
+
remotes |= codeberg_remote_candidates
|
|
2642
|
+
remotes.delete("all")
|
|
2643
|
+
remotes.uniq
|
|
2644
|
+
end
|
|
2645
|
+
|
|
2646
|
+
def push_individual_remotes!(remotes, branch)
|
|
2613
2647
|
remotes.each do |remote|
|
|
2614
2648
|
puts "$ git push #{remote} #{branch}"
|
|
2615
2649
|
success = @git.push(remote, branch)
|
|
2616
2650
|
unless success
|
|
2617
2651
|
warn("Push to #{remote} failed; retrying with force push...")
|
|
2618
|
-
@git.push(remote, branch, force: true)
|
|
2652
|
+
success = @git.push(remote, branch, force: true)
|
|
2653
|
+
end
|
|
2654
|
+
next if success
|
|
2655
|
+
|
|
2656
|
+
if required_remote?(remote)
|
|
2657
|
+
abort("Failed to push #{branch} to required remote '#{remote}'. Fix remote connectivity/permissions and resume with: bundle exec kettle-release --start-step 9")
|
|
2619
2658
|
end
|
|
2659
|
+
|
|
2660
|
+
@skip_remotes << remote unless @skip_remotes.include?(remote)
|
|
2661
|
+
message = "Failed to push #{branch} to optional remote '#{remote}'; skipping this remote for this release."
|
|
2662
|
+
warn(message)
|
|
2663
|
+
record_diagnostic("release_remote_skipped", message, severity: "warning", blocking: false)
|
|
2620
2664
|
end
|
|
2621
2665
|
end
|
|
2622
2666
|
|
|
@@ -2926,13 +2970,15 @@ module Kettle
|
|
|
2926
2970
|
|
|
2927
2971
|
def push_tags!
|
|
2928
2972
|
# After release, push tags to remotes according to policy:
|
|
2929
|
-
# 1) If a remote named "all" exists, push tags
|
|
2973
|
+
# 1) If a remote named "all" exists and no remotes were skipped, push tags to it;
|
|
2974
|
+
# if that fails (e.g. an optional mirror pushurl timed out), fall back to active individual remotes.
|
|
2930
2975
|
# 2) Otherwise, if other remotes exist, push tags to each of them.
|
|
2931
2976
|
# 3) If no remotes are configured, push tags using default remote.
|
|
2932
2977
|
if use_all_remote?
|
|
2933
2978
|
ok = @git.push_tags("all")
|
|
2934
|
-
|
|
2935
|
-
|
|
2979
|
+
return if ok
|
|
2980
|
+
|
|
2981
|
+
warn("Push tags to 'all' reported failure; falling back to active individual remotes...")
|
|
2936
2982
|
end
|
|
2937
2983
|
|
|
2938
2984
|
remotes = active_remotes
|
|
@@ -3027,7 +3073,7 @@ module Kettle
|
|
|
3027
3073
|
end
|
|
3028
3074
|
|
|
3029
3075
|
def active_remote_candidates(candidates)
|
|
3030
|
-
candidates.reject { |remote| skipped_remote?(remote) }
|
|
3076
|
+
candidates.reject { |remote| remote == "all" || skipped_remote?(remote) }
|
|
3031
3077
|
end
|
|
3032
3078
|
|
|
3033
3079
|
def use_all_remote?
|
|
@@ -3171,6 +3217,7 @@ module Kettle
|
|
|
3171
3217
|
abort(remote_fetch_failure_message(remote, detail))
|
|
3172
3218
|
end
|
|
3173
3219
|
|
|
3220
|
+
@skip_remotes << remote unless @skip_remotes.include?(remote)
|
|
3174
3221
|
message = optional_remote_fetch_failure_message(remote, detail)
|
|
3175
3222
|
warn(message)
|
|
3176
3223
|
emit_remote_parity_event(action: "skip", remote: remote, status: "skipped", attempts: attempts, required: false, reason: detail)
|
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.34"
|
|
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.
|
|
4
|
+
version: 3.1.34
|
|
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.
|
|
67
|
+
version: 0.3.22
|
|
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.
|
|
79
|
+
version: 0.3.22
|
|
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.
|
|
91
|
+
version: 0.1.25
|
|
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.
|
|
103
|
+
version: 0.1.25
|
|
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.
|
|
115
|
+
version: 0.1.22
|
|
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.
|
|
127
|
+
version: 0.1.22
|
|
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.
|
|
139
|
+
version: 2.0.31
|
|
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.
|
|
151
|
+
version: 2.0.31
|
|
152
152
|
- !ruby/object:Gem::Dependency
|
|
153
153
|
name: ruby-progressbar
|
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -476,10 +476,10 @@ licenses:
|
|
|
476
476
|
- AGPL-3.0-only
|
|
477
477
|
metadata:
|
|
478
478
|
homepage_uri: "https://kettle-dev.galtzo.com"
|
|
479
|
-
source_code_uri: "https://github.com/kettle-dev/kettle-dev/tree/v3.1.
|
|
480
|
-
changelog_uri: "https://github.com/kettle-dev/kettle-dev/blob/v3.1.
|
|
479
|
+
source_code_uri: "https://github.com/kettle-dev/kettle-dev/tree/v3.1.34"
|
|
480
|
+
changelog_uri: "https://github.com/kettle-dev/kettle-dev/blob/v3.1.34/CHANGELOG.md"
|
|
481
481
|
bug_tracker_uri: "https://github.com/kettle-dev/kettle-dev/issues"
|
|
482
|
-
documentation_uri: "https://www.rubydoc.info/gems/kettle-dev/3.1.
|
|
482
|
+
documentation_uri: "https://www.rubydoc.info/gems/kettle-dev/3.1.34"
|
|
483
483
|
funding_uri: "https://github.com/sponsors/pboling"
|
|
484
484
|
wiki_uri: "https://github.com/kettle-dev/kettle-dev/wiki"
|
|
485
485
|
news_uri: "https://www.railsbling.com/tags/kettle-dev"
|
metadata.gz.sig
CHANGED
|
Binary file
|