Skip to content

Fix #1183 to enforce service_healthy condition #1184

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

schnell18
Copy link

@schnell18 schnell18 commented Apr 14, 2025

This PR fixes #1176, #1178, and #1183 by employing a create-and-start approach, where the containers are created in the
first pass, then they are started using the run_container() method to make sure the dependencies'
conditions are checked. The second improvement is to add a version check to skip "podman wait
--condition=healthy" in the check_dep_conditions() function to prevent podman-compose hang. BTW,
this PR also fixes a minor problem that podman-compose attempts to stop and remove the containers
defined in the compose file when the --force-recreate option is specified when there are no
running containers at all.

Specific changes are as follows:

  • Change compose-up to create then start container to enforce dependency condition check
  • Skip running compose-down when there are no active containers
  • Skip dependency health check to avoid compose-up hang for podman prior to 4.6.0, which doesn't support --condition healthy
  • Add relevant integration test case and run the healthy state validation only when systemd is available
  • Improve robustness for network, ulimit, extends etctest cases
  • Relax pylint rules for test code, disable duplicate code check

4.6.0 seems to be the first version to support --condition=healthy, as discovered by this script:

#!/bin/bash

# find supported wait conditions since v4.3.1 which is podman version used in
# github actions of podman-compose project
for ver in $(git tag -l | sed -e '/-rc[0-9]\+$/d' -e '/^v[0-3]/d' -e '/^v4.[0-2]/d' -e '/v4.3.0/d'); do
  echo $ver
  git show $ver:cmd/podman/common/completion.go | grep -A 3 "func AutocompleteWaitCondition"
done

Finally, there are a few integration test cases mentioning this bug:

Copy link
Collaborator

@p12tic p12tic left a comment

Choose a reason for hiding this comment

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

Overall looks good, thank you very much. I had several comments.

@p12tic
Copy link
Collaborator

p12tic commented Apr 21, 2025

Please add release note to the newsfragments directory (you can look here for inspiration on how release note looks like).

@schnell18 schnell18 force-pushed the main branch 2 times, most recently from 294f6a1 to ddd4b8a Compare April 22, 2025 06:20
- Change compose-up to create then start container to avoid
  double-execution and enforce dependency condition check
- Skip dependency health check to avoid compose-up hang for podman prior
  to 4.6.0, which doesn't support --condition healthy
- Skip running compose-down when there are no active containers
- Add relevant integration test case

Signed-off-by: Justin Zhang <[email protected]>
@schnell18
Copy link
Author

@p12tic Thanks for your insightful reviews. You comments have been addressed with the amended commit. Could you please take another look at your earliest convenience?

Tons of thanks!

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.

Detached mode executes entrypoint twice
2 participants