Loading
feat: add update subcommand for managed binaries
What does this MR do?
Closes #8570 (closed).
updatesubcommand onglab duo cliandglab orbit.glab duo cli updateused to be passed through to the Duo CLI binary, which rejected it. It now updates the managed binary, the same as--update, which keeps working. Neither binary has its ownupdatecommand (checked against Duo CLI 9.26.0 and Orbit 0.136.0). Only the first positional word is matched, soglab duo cli run --goal updatestill passes through.glab check-updatereports managed binaries. When the Duo CLI or Orbit CLI is installed, an explicitglab check-updatealso prints available updates for it. The automatic 24-hour check doesn't, because each binary already checks when it runs. Binaries that aren't installed, or that come from a custom binary path, are skipped without a request. A managed binary below the spec'sMinVersionis still reported, even thoughInstalledBinarycounts it as not installed.- The update hint now reads
Run 'glab duo cli update'(andglab orbit update).
Structure
- The Duo CLI and Orbit specs move from their command packages to
internal/binarymgr/binaries. The subcommands andcheck-updateboth need them, and importing the parent command packages would either cycle or break the layering rule. The spec tests move with them. Specgains aCommandfield, which replacesRunner.UpdateCommand.Runner.ReportUpdateis the exported, unthrottled update check.- Two Cobra details: both parents now set
Args: cobra.ArbitraryArgs, becauselegacyArgsrejects pass-through words once a command has children and no parent (as in tests). The Duo CLI help footer is now limited toglab duo cli, since subcommands inherit its help function. - binarymgr update notices now go to stderr, like glab's own
check-updatebanner. They used to go to stdout, which also put the automatic notice into redirectedglab duo cliandglab orbitoutput.
Also included
test(orbit): TestOrbitCredentialEnv_SkipsWhenUnauthenticated picked up a token from the developer's keyring and failed locally on main, which blocked pre-push. It now calls keyring.MockInit(), as auth/docker tests do.
Example output
From glab check-update with Duo CLI 9.6.0 and Orbit CLI 0.104.0 installed:
$ glab check-update
You are using the latest version of glab
• New GitLab Duo CLI version available: 9.6.0 → 9.27.0
Run 'glab duo cli update' to update to the latest version
• New Orbit CLI version available: 0.104.0 → 0.136.0
Run 'glab orbit update' to update to the latest versionHow to test
glab check-update # with an older Duo CLI installed, shows the Duo CLI update line
glab duo cli update
glab orbit update
glab duo cli --update # still worksEdited by Kai Armstrong