Skip to content

deploy: refactor shared release/rollback helpers#102

Merged
benvinegar merged 1 commit into
mainfrom
bentlegen/refactor-release-common
Feb 21, 2026
Merged

deploy: refactor shared release/rollback helpers#102
benvinegar merged 1 commit into
mainfrom
bentlegen/refactor-release-common

Conversation

@benvinegar
Copy link
Copy Markdown
Member

@benvinegar benvinegar commented Feb 21, 2026

Summary

  • add bin/lib/release-common.sh for shared release/rollback shell helpers
  • move duplicated has_systemd, verify_git_free_release, and atomic_symlink_swap helpers into the shared library
  • share systemd restart behavior via restart_baudbot_service_if_active and call it from both scripts

Validation

  • bash bin/update-release.test.sh
  • bash bin/rollback-release.test.sh
  • npm run test:shell

Notes

  • behavior remains backward compatible; this is an internal DRY refactor

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Feb 21, 2026

Greptile Summary

Refactored shared release/rollback shell helpers into a common library to eliminate code duplication. Extracted four helper functions (has_systemd, verify_git_free_release, atomic_symlink_swap, restart_baudbot_service_if_active) from both update-release.sh and rollback-release.sh into the new bin/lib/release-common.sh.

Key changes:

  • Created bin/lib/release-common.sh with shared helper functions
  • Both scripts now source the shared library instead of defining duplicate functions
  • Simplified restart logic by using the shared restart_baudbot_service_if_active function
  • Removed local was_active variable tracking as it's encapsulated in the shared function
  • The verify_git_free_release implementation from rollback-release.sh was chosen for the shared version (includes directory existence check), which is safe for both scripts

This is a clean DRY refactor with no functional changes to behavior.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • This is a pure refactoring PR that extracts duplicated code into a shared library without changing behavior. The functions are identical to their original implementations, proper sourcing is in place, and all dependencies (log, die) are defined before sourcing. Tests are included for validation.
  • No files require special attention

Important Files Changed

Filename Overview
bin/lib/release-common.sh New shared library extracting common helpers (has_systemd, verify_git_free_release, atomic_symlink_swap, restart_baudbot_service_if_active) from both scripts
bin/rollback-release.sh Removed duplicated helper functions and now sources them from release-common.sh, simplified restart logic by calling shared function
bin/update-release.sh Removed duplicated helper functions and now sources them from release-common.sh, simplified restart logic by calling shared function

Last reviewed commit: 21dfe7e

@benvinegar benvinegar merged commit 94d03e1 into main Feb 21, 2026
10 checks passed
@benvinegar benvinegar deleted the bentlegen/refactor-release-common branch February 21, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant