Skip to content

Commit a87e198

Browse files
devfbespiffcskzantow
authored
feat: introduce exit code failure option for db update check (#1463)
Signed-off-by: Felix Becker <[email protected]> Signed-off-by: Christopher Phillips <[email protected]> Signed-off-by: Keith Zantow <[email protected]> Co-authored-by: Christopher Phillips <[email protected]> Co-authored-by: Keith Zantow <[email protected]>
1 parent b952d38 commit a87e198

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/grype/cli/commands/db_check.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/spf13/cobra"
78

@@ -11,6 +12,10 @@ import (
1112
"github.com/anchore/grype/internal/bus"
1213
)
1314

15+
const (
16+
exitCodeOnDBUpgradeAvailable = 100
17+
)
18+
1419
func DBCheck(app clio.Application) *cobra.Command {
1520
opts := dbOptionsDefault(app.ID())
1621

@@ -51,5 +56,7 @@ func runDBCheck(opts options.Database) error {
5156
fmt.Printf("Updated DB URL: %s\n", updateDBEntry.URL.String())
5257
fmt.Println("You can run 'grype db update' to update to the latest db")
5358

59+
os.Exit(exitCodeOnDBUpgradeAvailable) //nolint:gocritic
60+
5461
return nil
5562
}

0 commit comments

Comments
 (0)