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:

@schnell18 schnell18 force-pushed the main branch 4 times, most recently from 77f02e0 to ac97fdf Compare April 15, 2025 14:22
- 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
- Relax the pylint rules for test code

Signed-off-by: Justin Zhang <[email protected]>
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
1 participant