Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Validate -retry-count is not negative
Browse files Browse the repository at this point in the history
  • Loading branch information
itmecho committed Jun 8, 2022
1 parent 5e5bec0 commit 4e54051
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion container/go/cmd/pusher/pusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
format = flag.String("format", "", "The format of the uploaded image (Docker or OCI).")
clientConfigDir = flag.String("client-config-dir", "", "The path to the directory where the client configuration files are located. Overiddes the value from DOCKER_CONFIG.")
skipUnchangedDigest = flag.Bool("skip-unchanged-digest", false, "If set to true, will only push images where the digest has changed.")
retryCount = flag.Int("retry-count", 0, "Amount of times the push will be retried.")
retryCount = flag.Int("retry-count", 0, "Amount of times the push will be retried. This cannot be a negative number.")
layers utils.ArrayStringFlags
stampInfoFile utils.ArrayStringFlags
)
Expand Down Expand Up @@ -85,6 +85,9 @@ func main() {
if *imgTarball == "" && *imgConfig == "" {
log.Fatalln("Neither --tarball nor --config was specified.")
}
if *retryCount < 0 {
log.Fatalln("-retry-count cannot be a negative number.")
}

// If the user provided a client config directory, ensure it's a valid
// directory and instruct the keychain resolver to use it to look for the
Expand Down

0 comments on commit 4e54051

Please sign in to comment.