Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,10 @@ func main() {
Usage: "do not check whether the current version is latest during --version",
EnvVar: "SOPS_DISABLE_VERSION_CHECK",
},
cli.BoolFlag{
Name: "check-for-updates",
Usage: "do check whether the current version is latest during --version",
},
cli.StringFlag{
Name: "kms, k",
Usage: "comma separated list of KMS ARNs",
Expand Down
8 changes: 7 additions & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func PrintVersion(c *cli.Context) {

out.WriteString(fmt.Sprintf("%s %s", c.App.Name, c.App.Version))

if c.Bool("disable-version-check") {
if c.Bool("disable-version-check") && !c.Bool("check-for-updates") {
out.WriteString("\n")
} else {
upstreamVersion, upstreamURL, err := RetrieveLatestReleaseVersion()
Expand All @@ -47,6 +47,12 @@ func PrintVersion(c *cli.Context) {
}
}
}
if !c.Bool("check-for-updates") {
out.WriteString(
"\n[warning] Note that in a future version, sops will no longer check whether the current version is the latest when asking for sops' version." +
" If you want to explicitly check for the latest version, add the `--check-for-updates` option to `sops --version`." +
" This will hide this deprecation warning and will always check, even if the default behavior changes in the future.\n")
}
}
fmt.Fprintf(c.App.Writer, "%s", out.String())
}
Expand Down
Loading