fix: harden release scripts with shared library and validation#125
Draft
fix: harden release scripts with shared library and validation#125
Conversation
…potency Extract duplicated logic into release/lib.sh and fix 13 issues found during release-script audit. Verified with dry-run of fictional 26.3.1 patch release across docker-images, airflow-operator, and commons-operator. | # | Finding | Fix | |----|------------------------------------------|------------------------------------------------------------| | 1 | Partial failure with no recovery | PR branch resume, idempotent changelog, no-diff re-runs | | 3 | -w not validated | validate_what() in lib.sh, all 5 scripts | | 4 | Tag/branch format validation inconsistent| Shared validate_tag() / validate_release(), consistent regex| | 5 | Inconsistent dependency checks | check_build_dependencies() vs check_basic_dependencies() | | 6 | Branch-existence grep is loose | ls-remote --heads (no local refs); anchored regex fallback | | 7 | git commit -sam captures unintended files| Explicit git add in create-rc for products and operators | | 8 | No dirty-index check | require_clean_worktree in lib.sh, called in 3 functions | | 10 | cd without return / cwd drift | All per-repo functions wrapped in subshells (...) | | 12 | check_tag_is_valid implicit cwd | Takes explicit repo_dir parameter; all callers updated | | 13 | Stale branch lists in tag script | ls-remote --heads replaces fetch + local branch inspection | | 15 | Minor inconsistencies | REPOSITORY→REMOTE, usage strings, validate_tag in merge-rc | | 17 | create-release-branch ignores existing | warn_if_branch_exists + check_existing_branches | | 18 | libgit2 dynamic linking | LIBGIT2_NO_PKG_CONFIG=1 in create-rc | | 19 | git fetch destroys local tags | All fetch+inspect replaced with git ls-remote | Additional: verify_release (8 pre-commit checks), for_each_operator, idempotent update_changelog, ensure_clone/ensure_temp_folder, derive_tag_vars/derive_branch_vars, opensearch-operator in image-checks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
release/lib.sh(validation, helpers, iteration, verification)verify_releasepre-commit checks (8 verification types) to catch release transformation errors before committing-wnot validatedvalidate_what()in lib.sh, all 5 scriptsvalidate_tag()/validate_release(), consistent regexcheck_build_dependencies()vscheck_basic_dependencies()ls-remote --heads(no local refs); anchored regex fallbackgit commit -samcaptures unintended filesgit addin create-rc for products and operatorsrequire_clean_worktreein lib.sh, called in 3 functionscdwithout return / cwd drift(...)check_tag_is_validimplicit cwdrepo_dirparameter; all callers updatedls-remote --headsreplaces fetch + local branch inspectionREPOSITORY→REMOTE, usage strings,validate_tagin merge-rccreate-release-branchignores existingwarn_if_branch_exists+check_existing_brancheslibgit2dynamic linkingLIBGIT2_NO_PKG_CONFIG=1in create-rcgit fetchdestroys local tagsgit ls-remoteTest plan
verify_releasepasses all 8 check types across all 3 repos in both runslib.shshared functions for correctnessshellcheckpasses on all scripts🤖 Generated with Claude Code