clientupdate: abort if current version is newer than latest (#9733)

This is only relevant for unstable releases and local builds. When local
version is newer than upstream, abort release.

Also, re-add missing newlines in output that were missed in
https://github.com/tailscale/tailscale/pull/9694.

Updates #cleanup

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
pull/9099/merge
Andrew Lytvynov 1 year ago committed by GitHub
parent 7f08bddfe1
commit 677d486830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,6 +30,7 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"tailscale.com/clientupdate/distsign" "tailscale.com/clientupdate/distsign"
"tailscale.com/types/logger" "tailscale.com/types/logger"
"tailscale.com/util/cmpver"
"tailscale.com/util/winutil" "tailscale.com/util/winutil"
"tailscale.com/version" "tailscale.com/version"
"tailscale.com/version/distro" "tailscale.com/version/distro"
@ -211,9 +212,13 @@ func Update(args Arguments) error {
} }
func (up *Updater) confirm(ver string) bool { func (up *Updater) confirm(ver string) bool {
if version.Short() == ver { switch cmpver.Compare(version.Short(), ver) {
case 0:
up.Logf("already running %v; no update needed", ver) up.Logf("already running %v; no update needed", ver)
return false return false
case 1:
up.Logf("installed version %v is newer than the latest available version %v; no update needed", version.Short(), ver)
return false
} }
if up.Confirm != nil { if up.Confirm != nil {
return up.Confirm(ver) return up.Confirm(ver)

@ -63,7 +63,7 @@ func runUpdate(ctx context.Context, args []string) error {
err := clientupdate.Update(clientupdate.Arguments{ err := clientupdate.Update(clientupdate.Arguments{
Version: ver, Version: ver,
AppStore: updateArgs.appStore, AppStore: updateArgs.appStore,
Logf: printf, Logf: func(f string, a ...any) { printf(f+"\n", a...) },
Stdout: Stdout, Stdout: Stdout,
Stderr: Stderr, Stderr: Stderr,
Confirm: confirmUpdate, Confirm: confirmUpdate,

@ -158,7 +158,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep
tailscale.com/types/views from tailscale.com/tailcfg+ tailscale.com/types/views from tailscale.com/tailcfg+
tailscale.com/util/clientmetric from tailscale.com/net/netcheck+ tailscale.com/util/clientmetric from tailscale.com/net/netcheck+
tailscale.com/util/cloudenv from tailscale.com/net/dnscache+ tailscale.com/util/cloudenv from tailscale.com/net/dnscache+
W tailscale.com/util/cmpver from tailscale.com/net/tshttpproxy tailscale.com/util/cmpver from tailscale.com/net/tshttpproxy+
tailscale.com/util/cmpx from tailscale.com/cmd/tailscale/cli+ tailscale.com/util/cmpx from tailscale.com/cmd/tailscale/cli+
L 💣 tailscale.com/util/dirwalk from tailscale.com/metrics L 💣 tailscale.com/util/dirwalk from tailscale.com/metrics
tailscale.com/util/dnsname from tailscale.com/cmd/tailscale/cli+ tailscale.com/util/dnsname from tailscale.com/cmd/tailscale/cli+

@ -331,7 +331,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de
tailscale.com/types/views from tailscale.com/ipn/ipnlocal+ tailscale.com/types/views from tailscale.com/ipn/ipnlocal+
tailscale.com/util/clientmetric from tailscale.com/control/controlclient+ tailscale.com/util/clientmetric from tailscale.com/control/controlclient+
tailscale.com/util/cloudenv from tailscale.com/net/dns/resolver+ tailscale.com/util/cloudenv from tailscale.com/net/dns/resolver+
LW tailscale.com/util/cmpver from tailscale.com/net/dns+ tailscale.com/util/cmpver from tailscale.com/net/dns+
tailscale.com/util/cmpx from tailscale.com/derp/derphttp+ tailscale.com/util/cmpx from tailscale.com/derp/derphttp+
💣 tailscale.com/util/deephash from tailscale.com/ipn/ipnlocal+ 💣 tailscale.com/util/deephash from tailscale.com/ipn/ipnlocal+
L 💣 tailscale.com/util/dirwalk from tailscale.com/metrics+ L 💣 tailscale.com/util/dirwalk from tailscale.com/metrics+

Loading…
Cancel
Save