v0.x: rollback and pin¶
update can roll back to an earlier release and pin a tool to one
(spec 0104). A tool picks
this up with the gtb release that ships it; nothing in a tool's code changes unless it implements update.Updater.
What changes¶
- An attended downgrade asks first.
update --version <tag>naming a release older than the running one used to install it without a word. At a terminal it now asks "Roll back … ? This installs an older release.", and a decline exits non-zero withsetup.ErrDowngradeNotConfirmed. Unattended (CI, or no terminal), it proceeds as before.--forceskips the question. update.UpdatergainsReleaseBefore(ctx, current string) (string, error). It is how the command finds the release before the running one.*setup.SelfUpdaterimplements it.update.UpdateResultgainsRolledBackandPinned.--output jsoncarriesrolled_backand, when the tool is pinned,pinned.updaterefuses positional arguments.update --rollback v1.1.0used to ignore the version. It now fails and says to write--rollback=v1.1.0.
What to do¶
- A test double or a custom implementation of
update.Updater: addReleaseBefore. Returning""and an error is enough where rollback is not exercised. - A script that runs
update --version <older tag>at a terminal and expects no prompt: pass--force, or run it unattended.