From 698f53fb8eeea0c8b1150e2ac313c39412c734e4 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 14 Dec 2022 16:07:27 +0000 Subject: [PATCH 1/3] fix: improve the warning mismatch to display the release assets on windows Fixes #4226. --- cli/root.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/root.go b/cli/root.go index 654009e8cef7a..7b18312ed1301 100644 --- a/cli/root.go +++ b/cli/root.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "os" + "runtime" "strings" "text/template" "time" @@ -583,12 +584,17 @@ func checkVersions(cmd *cobra.Command, client *codersdk.Client) error { } fmtWarningText := `version mismatch: client %s, server %s -download the server version with: 'curl -L https://coder.com/install.sh | sh -s -- --version %s' ` + // Our installation script doesn't work on Windows, so instead we direct the user + // to the GitHub release page to download the latest installer. + if runtime.GOOS != "windows" { + fmtWarningText += `download the server version from: https://github.com/coder/coder/releases/tag/v%s` + } else { + fmtWarningText += `download the server version with: 'curl -L https://coder.com/install.sh | sh -s -- --version %s'` + } if !buildinfo.VersionsMatch(clientVersion, info.Version) { warn := cliui.Styles.Warn.Copy().Align(lipgloss.Left) - // Trim the leading 'v', our install.sh script does not handle this case well. _, _ = fmt.Fprintf(cmd.ErrOrStderr(), warn.Render(fmtWarningText), clientVersion, info.Version, strings.TrimPrefix(info.CanonicalVersion(), "v")) _, _ = fmt.Fprintln(cmd.ErrOrStderr()) } From 56992c65f4f8ff362fbd835aa51b3e414221f2a8 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 14 Dec 2022 10:11:16 -0600 Subject: [PATCH 2/3] Update cli/root.go Co-authored-by: Mathias Fredriksson --- cli/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/root.go b/cli/root.go index 7b18312ed1301..2125e57f3afd7 100644 --- a/cli/root.go +++ b/cli/root.go @@ -588,7 +588,7 @@ func checkVersions(cmd *cobra.Command, client *codersdk.Client) error { // Our installation script doesn't work on Windows, so instead we direct the user // to the GitHub release page to download the latest installer. if runtime.GOOS != "windows" { - fmtWarningText += `download the server version from: https://github.com/coder/coder/releases/tag/v%s` + fmtWarningText += `download the server version from: https://github.com/coder/coder/releases/v%s` } else { fmtWarningText += `download the server version with: 'curl -L https://coder.com/install.sh | sh -s -- --version %s'` } From 3165f396e4697a093f287b1b38282138c6fbc9e6 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 14 Dec 2022 10:11:39 -0600 Subject: [PATCH 3/3] Update cli/root.go Co-authored-by: Mathias Fredriksson --- cli/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/root.go b/cli/root.go index 2125e57f3afd7..e7d88600d87e5 100644 --- a/cli/root.go +++ b/cli/root.go @@ -587,7 +587,7 @@ func checkVersions(cmd *cobra.Command, client *codersdk.Client) error { ` // Our installation script doesn't work on Windows, so instead we direct the user // to the GitHub release page to download the latest installer. - if runtime.GOOS != "windows" { + if runtime.GOOS == "windows" { fmtWarningText += `download the server version from: https://github.com/coder/coder/releases/v%s` } else { fmtWarningText += `download the server version with: 'curl -L https://coder.com/install.sh | sh -s -- --version %s'`