Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: parse fractional arguments to flags #88

Conversation

m-ildefons
Copy link
Contributor

Parse fractional numbers as arguments to flags for the HEALTHCHECK instruction.

The HEALTHCHECK instruction can take an --interval, --timeout or --start-period flag specifying details to the healthcheck repetition behaviour. This can also be specified with fractions (of secods, minutes or hours), e.g.:

HEALTHCHECK \
  --interval=0.5s \
  CMD curl -f http://localhost

With the caveat that somewhere from parsing to conversion to a DiffTime some precision is lost (DiffTime has a precision of 10^-12s), this change adds support for the arguments to these interval flags to be specified as fractional numbers.

fixes: hadolint/hadolint#893
Signed-off-by: Moritz Röhrich moritz@ildefons.de

Parse fractional numbers as arguments to flags for the `HEALTHCHECK`
instruction.

The `HEALTHCHECK` instruction can take an `--interval`, `--timeout` or
`--start-period` flag specifying details to the healthcheck repetition
behaviour. This can also be specified with fractions (of secods, minutes
or hours), e.g.:

```Dockerfile
HEALTHCHECK \
  --interval=0.5s \
  CMD curl -f http://localhost
```

With the caveat that somewhere from parsing to conversion to a DiffTime
some precision is lost (DiffTime has a precision of 10^-12s), this
change adds support for the arguments to these interval flags to be
specified as fractional numbers.

fixes: hadolint/hadolint#893
Signed-off-by: Moritz Röhrich <moritz@ildefons.de>
@m-ildefons m-ildefons requested a review from lorenzo January 30, 2023 12:09
@lorenzo
Copy link
Member

lorenzo commented Jan 30, 2023

thanks again!

@lorenzo lorenzo merged commit e29aa11 into hadolint:master Jan 30, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Healthcheck fractionals not supported
2 participants