mirror of
https://github.com/anchore/grype
synced 2024-11-14 00:07:08 +00:00
feat: introduce exit code failure option for db update check (#1463)
Signed-off-by: Felix Becker <git@felixbecker.name> Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com> Signed-off-by: Keith Zantow <kzantow@gmail.com> Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com> Co-authored-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
parent
b952d3808c
commit
a87e198e58
1 changed files with 7 additions and 0 deletions
|
@ -2,6 +2,7 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
|
@ -11,6 +12,10 @@ import (
|
|||
"github.com/anchore/grype/internal/bus"
|
||||
)
|
||||
|
||||
const (
|
||||
exitCodeOnDBUpgradeAvailable = 100
|
||||
)
|
||||
|
||||
func DBCheck(app clio.Application) *cobra.Command {
|
||||
opts := dbOptionsDefault(app.ID())
|
||||
|
||||
|
@ -51,5 +56,7 @@ func runDBCheck(opts options.Database) error {
|
|||
fmt.Printf("Updated DB URL: %s\n", updateDBEntry.URL.String())
|
||||
fmt.Println("You can run 'grype db update' to update to the latest db")
|
||||
|
||||
os.Exit(exitCodeOnDBUpgradeAvailable) //nolint:gocritic
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue