Update to latest tagged release instead of tracking main#2572
Update to latest tagged release instead of tracking main#2572f-barth wants to merge 2 commits intoethstaker:mainfrom
Conversation
Default updates (`ETH_DOCKER_TAG` empty or "latest") now fetch tags and check out the most recent one instead of pulling from main. This ensures production systems run tested, released versions rather than whatever happens to be on main at the time of update. Falls back to pulling main if no tags are found. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR changes ethd update so that when ETH_DOCKER_TAG is unset/empty or latest, it updates to the most recent Git tag (latest release) rather than pulling whatever is currently on main, with a fallback to main if no tags exist.
Changes:
- Default update path now fetches tags and checks out the newest tag by version sort.
- Adds a no-tags fallback message and falls back to pulling
main. - Leaves pinned-tag behavior (
ETH_DOCKER_TAG=<version>) as-is.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if [[ "${branch}" =~ ^tag-* ]]; then | ||
| git checkout main | ||
| ${__as_owner} git fetch origin --tags | ||
| __value=$(git tag --sort=-v:refname | head -1) |
There was a problem hiding this comment.
__value is computed via git tag ... without ${__as_owner}. When ethd update is run under sudo/root, this can hit Git's “dubious ownership” checks (or a different HOME/config) and result in an empty tag list, incorrectly triggering the “No tags found” fallback. Run the git tag pipeline via ${__as_owner} (and consider redirecting stderr / checking the fetch+tag exit codes) so the tag selection uses the same user context as the other git commands.
| __value=$(git tag --sort=-v:refname | head -1) | |
| __value=$(${__as_owner} bash -c 'git tag --sort=-v:refname 2>/dev/null | head -1') |
| ${__as_owner} git fetch origin --tags | ||
| __value=$(git tag --sort=-v:refname | head -1) | ||
| if [[ -z "${__value}" ]]; then | ||
| echo "No tags found, falling back to main branch" |
There was a problem hiding this comment.
In the no-tags fallback, the code runs git pull origin main without first ensuring the working branch is actually main. If the repo is currently on a different branch (or detached), this will merge origin/main into that branch instead of updating main. Consider checking out main (or resetting to origin/main) before pulling in this fallback path to guarantee the repo ends up on main.
| echo "No tags found, falling back to main branch" | |
| echo "No tags found, falling back to main branch" | |
| ${__as_owner} git checkout main || ${__as_owner} git checkout -B main origin/main |
Use ${__as_owner} for git tag to avoid dubious ownership issues
when run under sudo. Checkout main before pulling in the no-tags
fallback path to avoid merging into a detached or tag branch.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
"Production staking systems benefit from running tested, tagged releases rather than tracking main." Agreed. That is what Either
This half-way-between idea would, I fear, make things worse |
|
On further thought. Can you change your code so it picks up on Document the tag in default.env, keep |
|
This is a bit of an issue: That's why the curl idea. There might be a better way tbh - but |
Summary
ETH_DOCKER_TAGempty orlatest) now fetch tags and check out the most recent release instead ofgit pull origin mainETH_DOCKER_TAGset to a specific version) are unchangedmainif no tags existMotivation
Production staking systems benefit from running tested, tagged releases rather than tracking
main. Currently,ethd updatepulls whatever is onmainat the time, which may include untested or in-progress changes. By defaulting to the latest tagged release, operators get stable versions that have been explicitly cut as releases.The existing
ETH_DOCKER_TAGpinning mechanism already uses this exact pattern (fetch tags, checkout on a localtag-*branch) — this change simply applies it to the default path as well, automatically selecting the latest tag viagit tag --sort=-v:refname.Test plan
ethd updatewithETH_DOCKER_TAG=(default): should fetch tags and check out the latest one (currentlyv26.4.1)ethd updatewithETH_DOCKER_TAG=v26.3.0: should still pin to that specific tag (unchanged behavior)git pull origin main🤖 Generated with Claude Code