Repository navigation
feat(self): release channels via go-selfupdate - #11
Merged
Merged
Conversation
Replaces the hand-rolled GitHub lookup and semver comparison with github.com/sentiolabs/go-selfupdate and adds self channel.
Nightlies are tagged with the next patch version, so they sort above the current release under semver. A nightly tagged with the released version would never be offered.
A tag pushed with the default GITHUB_TOKEN doesn't start a new workflow run. workflow_dispatch is exempt from that rule, so the nightly job dispatches prerelease.yml directly.
Cobra handed every command context.Background(). Its nil Done channel stops exec.Cmd from watching for cancellation, so a cancelled context never reached the install pipeline behind self update. executeRoot exists so the deferred stop runs before os.Exit.
These commands built their own context.Background(), so the root signal handler swallowed Ctrl-C without cancelling the fetch. signalContext now releases the handler once the first signal lands, so a second Ctrl-C kills a command that ignores its context. commandContext falls back to context.Background() because tests call the RunE functions directly.
Calling stop() after the context cancelled did not restore the fatal default, so a second Ctrl-C was swallowed. signalContext now exits with 128 plus the signal number, the status a shell reports for a signal kill.
The root force exit called os.Exit on the second signal, which skipped runRun's deferred cleanup and orphaned the child. The run directory and its secret files were left on disk. Run releases the root handler once its own trap is registered, and the root context still cancels first without effect here.
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.
envctl self updatefollowed only the latest stable release, so nobody could opt into a release candidate. It now delegates to github.com/sentiolabs/go-selfupdate v0.1.1 and gainsenvctl self channel <stable|rc|nightly>. The channel persists in~/.config/envctl/config.yaml(0600 in a 0700 directory). A newer stable release always wins over an older rc or nightly.internal/cmd/self.gois 41 lines of wiring with no HTTP or semver code.Two new workflows. prerelease.yml builds
v*-rc*andv*-nightly*tags with goreleaser. nightly.yml tagsv<next patch>-nightly.<date>at 06:00 UTC when main moved and dispatches the build, since a tag pushed with GITHUB_TOKEN never triggers a workflow.The root command runs with a signal-aware context, so Ctrl-C aborts a slow secrets fetch.
envctl runkeeps forwarding signals to its child and removing the run dir.Verify:
make testandmake lint. README documents channels and rc tagging. Cutting the first rc tag is a separate decision.