You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make btcpay-update.sh work from a non-interactive shell - #1189
Fixes#1188. Running btcpay-update.sh from a non-interactive shell (cron, ssh host 'cd … && ./btcpay-update.sh', pct exec) fails in two places, both because that shell's PATH is usually /sbin:/bin:/usr/sbin:/usr/bin:
After git pull, the script re-executes itself with exec "btcpay-update.sh", which is only found if /usr/local/bin (where the symlink lives) is on PATH.
docker_compose_update installs /usr/local/bin/docker-compose, and the later docker-compose calls in helpers.sh can't find it. The command -v docker-compose check also misses it, so the binary is reinstalled on every run.
Implementation
btcpay-update.sh re-executes ./btcpay-update.sh. The script has already changed into $BTCPAY_BASE_DIRECTORY/btcpayserver-docker, so this runs the freshly pulled copy, as before.
helpers.sh puts /usr/local/bin at the front of PATH when it isn't there. That covers btcpay-update.sh, btcpay-setup.sh and the other scripts that source it, and the tools install_tooling links into that directory.
tests/environment-test.sh sources helpers.sh in a clean environment with PATH=/usr/bin:/bin and checks that /usr/local/bin ends up on it.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 73c53a50-9885-4e68-af39-c63ea2422071
📥 Commits
Reviewing files that changed from the base of the PR and between cc57300 and e368dea.
📒 Files selected for processing: 3
btcpay-update.sh
helpers.sh
tests/environment-test.sh
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
📝 Walkthrough
The update script now invokes itself through a relative path. helpers.sh adds /usr/local/bin to PATH when it is missing, and an environment test checks this behavior in a clean shell.
Changes: Non-interactive update fixes
Layer / File(s)
Summary
Recursive update invocation btcpay-update.sh
The recursive update command now invokes ./btcpay-update.sh.
PATH setup and regression test helpers.sh, tests/environment-test.sh
helpers.sh prepends /usr/local/bin to PATH only when it is absent. The environment test checks that sourcing helpers.sh adds the directory when the shell starts with a restricted PATH.
The non-interactive update path makes /usr/local/bin available before Compose operations, with no actionable merge risk established in the reviewed changes.
Pre-merge checks: 5
Passed checks: 5 passed
Check name
Status
Explanation
Description check
The description clearly explains the non-interactive shell failures and the changes that fix them.
Title check
The title clearly summarizes the primary change: making btcpay-update.sh work from non-interactive shells.
Linked Issues check
The changes satisfy the coding requirements in [#1188]. btcpay-update.sh changes the post-git pull self-reexecution to exec ./btcpay-update.sh --skip-git-pull after changing to the repository di…
Out of Scope Changes check
The reviewed changes stay within [#1188]. The self-reexecution fix, PATH initialization, and the environment test directly address non-interactive update execution. No unrelated behavior or files are …
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
I’m a rabbit with a patch to share, I hop through PATH and find tools there. The script can call itself once more, And tests check paths from shell to door. I nibble carrots, pleased with the change, Then bound away across the range.
Comment @coderabbitai help to get the list of available commands.
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
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.
Why
Fixes #1188. Running
btcpay-update.shfrom a non-interactive shell (cron,ssh host 'cd … && ./btcpay-update.sh',pct exec) fails in two places, both because that shell'sPATHis usually/sbin:/bin:/usr/sbin:/usr/bin:git pull, the script re-executes itself withexec "btcpay-update.sh", which is only found if/usr/local/bin(where the symlink lives) is onPATH.docker_compose_updateinstalls/usr/local/bin/docker-compose, and the laterdocker-composecalls inhelpers.shcan't find it. Thecommand -v docker-composecheck also misses it, so the binary is reinstalled on every run.Implementation
btcpay-update.shre-executes./btcpay-update.sh. The script has already changed into$BTCPAY_BASE_DIRECTORY/btcpayserver-docker, so this runs the freshly pulled copy, as before.helpers.shputs/usr/local/binat the front ofPATHwhen it isn't there. That coversbtcpay-update.sh,btcpay-setup.shand the other scripts that source it, and the toolsinstall_toolinglinks into that directory.tests/environment-test.shsourceshelpers.shin a clean environment withPATH=/usr/bin:/binand checks that/usr/local/binends up on it.