Skip to content

Commit 20c7fda

Browse files
committed
frontend: allow 0 (default) value for healthcheck retries
0 is the default value, so should be ok to explicitly use. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 764e902 commit 20c7fda

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

frontend/dockerfile/instructions/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ func parseHealthcheck(req parseRequest) (*HealthCheckCommand, error) {
582582
if err != nil {
583583
return nil, err
584584
}
585-
if retries < 1 {
586-
return nil, fmt.Errorf("--retries must be at least 1 (not %d)", retries)
585+
if retries < 0 {
586+
return nil, fmt.Errorf("--retries cannot be negative (%d)", retries)
587587
}
588588
healthcheck.Retries = int(retries)
589589
} else {

frontend/dockerfile/parser/testfiles/health/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ HEALTHCHECK CMD
88
HEALTHCHECK CMD a b
99
HEALTHCHECK --timeout=3s CMD ["foo"]
1010
HEALTHCHECK CONNECT TCP 7000
11+
HEALTHCHECK --start-period=0s --interval=5s --timeout=0s --retries=0 CMD ["foo"]

frontend/dockerfile/parser/testfiles/health/result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
(healthcheck "CMD" "a b")
88
(healthcheck ["--timeout=3s"] "CMD" "foo")
99
(healthcheck "CONNECT" "TCP 7000")
10+
(healthcheck ["--start-period=0s" "--interval=5s" "--timeout=0s" "--retries=0"] "CMD" "foo")

0 commit comments

Comments
 (0)