Skip to content

Commit 4e54051

Browse files
committed
Validate -retry-count is not negative
1 parent 5e5bec0 commit 4e54051

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

container/go/cmd/pusher/pusher.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var (
4444
format = flag.String("format", "", "The format of the uploaded image (Docker or OCI).")
4545
clientConfigDir = flag.String("client-config-dir", "", "The path to the directory where the client configuration files are located. Overiddes the value from DOCKER_CONFIG.")
4646
skipUnchangedDigest = flag.Bool("skip-unchanged-digest", false, "If set to true, will only push images where the digest has changed.")
47-
retryCount = flag.Int("retry-count", 0, "Amount of times the push will be retried.")
47+
retryCount = flag.Int("retry-count", 0, "Amount of times the push will be retried. This cannot be a negative number.")
4848
layers utils.ArrayStringFlags
4949
stampInfoFile utils.ArrayStringFlags
5050
)
@@ -85,6 +85,9 @@ func main() {
8585
if *imgTarball == "" && *imgConfig == "" {
8686
log.Fatalln("Neither --tarball nor --config was specified.")
8787
}
88+
if *retryCount < 0 {
89+
log.Fatalln("-retry-count cannot be a negative number.")
90+
}
8891

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

0 commit comments

Comments
 (0)