Thanks to visit codestin.com
Credit goes to github.com

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
3 changes: 2 additions & 1 deletion .github/workflows/build-scan-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
image-name: ${{ github.sha }}
severity-threshold: CRITICAL
env:
TRIVY_IGNORE_UNFIXED: true
TRIVY_IGNORE_UNFIXED: true
DOCKLE_HOST: "unix:///var/run/docker.sock"
5 changes: 5 additions & 0 deletions pkg/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ OPTIONS:
EnvVar: "NO_COLOR",
Usage: "suppress log output",
},
cli.BoolFlag{
Name: "version-check",
EnvVar: "DOCKLE_VERSION_CHECK",
Usage: "show an update notification",
},

// Registry flag
cli.DurationFlag{
Expand Down
17 changes: 10 additions & 7 deletions pkg/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ func Run(c *cli.Context) (err error) {
config.CreateFromCli(c)

cliVersion := "v" + c.App.Version
latestVersion, err := utils.FetchLatestVersion(ctx)

// check latest version
if err != nil {
log.Logger.Infof("Failed to check latest version. %s", err)
} else if cliVersion != latestVersion && c.App.Version != "dev" {
log.Logger.Warnf("A new version %s is now available! You have %s.", latestVersion, cliVersion)
if c.Bool("version-check") {
latestVersion, err := utils.FetchLatestVersion(ctx)
// check latest version
if err != nil {
log.Logger.Infof("Failed to check latest version. %s", err)
} else if cliVersion != latestVersion && c.App.Version != "dev" {
log.Logger.Warnf("A new version %s is now available! You have %s.", latestVersion, cliVersion)
}
} else {
log.Logger.Debug("Skipped update confirmation")
}

args := c.Args()
Expand Down