Skip to content

Commit

Permalink
frontend: allow 0 (default) value for healthcheck retries
Browse files Browse the repository at this point in the history
0 is the default value, so should be ok to explicitly use.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Sep 7, 2022
1 parent 764e902 commit 20c7fda
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/dockerfile/instructions/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ func parseHealthcheck(req parseRequest) (*HealthCheckCommand, error) {
if err != nil {
return nil, err
}
if retries < 1 {
return nil, fmt.Errorf("--retries must be at least 1 (not %d)", retries)
if retries < 0 {
return nil, fmt.Errorf("--retries cannot be negative (%d)", retries)
}
healthcheck.Retries = int(retries)
} else {
Expand Down
1 change: 1 addition & 0 deletions frontend/dockerfile/parser/testfiles/health/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ HEALTHCHECK CMD
HEALTHCHECK CMD a b
HEALTHCHECK --timeout=3s CMD ["foo"]
HEALTHCHECK CONNECT TCP 7000
HEALTHCHECK --start-period=0s --interval=5s --timeout=0s --retries=0 CMD ["foo"]
1 change: 1 addition & 0 deletions frontend/dockerfile/parser/testfiles/health/result
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
(healthcheck "CMD" "a b")
(healthcheck ["--timeout=3s"] "CMD" "foo")
(healthcheck "CONNECT" "TCP 7000")
(healthcheck ["--start-period=0s" "--interval=5s" "--timeout=0s" "--retries=0"] "CMD" "foo")

0 comments on commit 20c7fda

Please sign in to comment.