Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add healthcheck start-interval option #848

Conversation

x4rd0o1Vtx
Copy link
Contributor

@x4rd0o1Vtx x4rd0o1Vtx commented May 8, 2024

SUMMARY

Add new healthcheck start-interval docker option.
https://docs.docker.com/reference/dockerfile/#healthcheck

/!\ This option requires Docker Engine version 25.0 or later.

ex:

healthcheck:
  test: ["CMD", "test"]
  start_interval: 5s
  • Actual behavior

Unsupported parameter

  • New behavior
"Healthcheck" {
  "Test": ["CMD", "test"],
  "StartInterval": 5000000000
}
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

docker_container
docker_swarm_service

ADDITIONAL INFORMATION

Only docker_container module was tested.
Not sure about modify unit tests for docker_swarm_service at tests/integration/targets/docker_swarm_service/tasks/tests/options.yml.
Don't know the good way to protect this option for Docker Engine version <25.0. (I think not necessary because older versions seems to ignore it)

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Unfortunately the option for docker_swarm_service cannot be added at the moment, since Docker SDK for Python does not yet support it. For docker_container it is possible (since we directly talk to the API).

Please note that you also have to add a changelog fragment. Thanks.

plugins/modules/docker_container.py Outdated Show resolved Hide resolved
plugins/modules/docker_container.py Show resolved Hide resolved
plugins/modules/docker_swarm_service.py Outdated Show resolved Hide resolved
plugins/modules/docker_swarm_service.py Outdated Show resolved Hide resolved
plugins/modules/docker_swarm_service.py Outdated Show resolved Hide resolved
plugins/module_utils/module_container/base.py Show resolved Hide resolved
@x4rd0o1Vtx x4rd0o1Vtx force-pushed the feature/healthcheck-start-interval branch from 921350a to 9c99104 Compare May 9, 2024 10:13
@x4rd0o1Vtx x4rd0o1Vtx marked this pull request as draft May 9, 2024 10:24
@x4rd0o1Vtx x4rd0o1Vtx force-pushed the feature/healthcheck-start-interval branch 2 times, most recently from a33efb3 to 597c0b2 Compare May 9, 2024 11:14
@x4rd0o1Vtx x4rd0o1Vtx marked this pull request as ready for review May 9, 2024 11:20
@x4rd0o1Vtx
Copy link
Contributor Author

Thanks for your feedbacks, I've updated the PR but not sure about the good way to check the API version and not really familiar with some failing tests.

@x4rd0o1Vtx x4rd0o1Vtx force-pushed the feature/healthcheck-start-interval branch from 3be4bf6 to d507851 Compare May 9, 2024 18:10
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I'm currently looking at the CI failures, they seem to be unrelated.

@felixfontein
Copy link
Collaborator

All tests pass except CentOS 7, but that's totally unrelated to this PR (ansible/ansible#83225).

@felixfontein felixfontein merged commit a4a05e7 into ansible-collections:main May 9, 2024
124 of 130 checks passed
@felixfontein
Copy link
Collaborator

@x4rd0o1Vtx thanks a lot for your contribution!

@x4rd0o1Vtx
Copy link
Contributor Author

Thanks for your help and the quick review!

@x4rd0o1Vtx x4rd0o1Vtx deleted the feature/healthcheck-start-interval branch May 18, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants