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

Adding basic support for --profile argument #592

Merged
merged 3 commits into from
Apr 10, 2023
Merged

Adding basic support for --profile argument #592

merged 3 commits into from
Apr 10, 2023

Conversation

dixonwhitmire
Copy link
Contributor

This PR adds support for the global --profile option .

High level updates include:



  • Support for “—profile” argument in _parse_args()
  • A new PodmanCompose method, _resolve_profiles, to resolve profile arguments against a compose file’s service definitions
  • Updated PodmanCompose to use _resolve_profiles where appropriate
  • New test cases for the Podman-compose config and up/down commands


I limited test case support to the config and up/down commands, since these are the commands I need for my specific use-case.

For my use-case I am using podman-compose as an interim solution while I migrate some of my project local development environments from docker compose to podman/k8s.

Additionally, I tried to align my changes to the current “style” of the repo with focused changes to make diff’ing reviews easier. 

From an implementation standpoint I focused on specific enablement using the “—profile” argument.

If this PR is accepted, I will do a follow-up PR to support the COMPOSE_PROFILES environment variable. We can also add additional test cases to ensure the “spec” is covered in light of podman-compose’s current support.

Test case output (I can add a marker to skip the up/down tests if needed)

================================================================== test session starts ===================================================================
platform darwin -- Python 3.10.5, pytest-7.2.0, pluggy-1.0.0
rootdir: /Users/dwhitmire/code/podman-compose
plugins: cov-4.0.0
collected 9 items                                                                                                                                        

pytests/test_volumes.py .                                                                                                                          [ 11%]
tests/test_podman_compose.py .                                                                                                                     [ 22%]
tests/test_podman_compose_config.py ....                                                                                                           [ 66%]
tests/test_podman_compose_up_down.py ...                                                                                                           [100%]

============================================================== 9 passed in 88.21s (0:01:28) ==============================================================

closes #430
Signed-off-by: Dixon Whitmire [email protected]

@lc-guy
Copy link

lc-guy commented Jan 16, 2023

Any update on this PR? Is it ready to merge? This would be immensely useful to disable select services, along with compose overrides for different environments (dev, staging, ...).

@dixonwhitmire
Copy link
Contributor Author

Any update on this PR? Is it ready to merge? This would be immensely useful to disable select services, along with compose overrides for different environments (dev, staging, ...).

@lc-guy - I don't have write access to this repo, but am still available to implement feedback on this PR if that's currently blocking it's acceptance.

kkharji added a commit to kkharji/podman-compose that referenced this pull request Jan 18, 2023
Co-authored-By: Dixon Whitmire <[email protected]>
Authored-By: Dixon Whitmire <[email protected]>
See: containers#592
@Steiniche
Copy link

Just gonna keep the discussion alive.

@dixonwhitmire do I understand correctly that this PR is ready to merge from your side?
Only thing we need is a maintainer to look into it and do the approval/merge process?

This feature would be of high value to us so if we can do anything to help move the process along we will gladly do so.

@dixonwhitmire
Copy link
Contributor Author

@Steiniche - Yes, that is correct. I believe that the PR is good to go, and just requires maintainer approval. Thanks!

@muayyad-alsadi muayyad-alsadi merged commit 252f1d5 into containers:devel Apr 10, 2023
@dixonwhitmire dixonwhitmire deleted the profile-support branch April 27, 2023 21:16
@dartagnanli
Copy link

really need this feature.

@firefart
Copy link

Any update on a PR regarding the COMPOSE_PROFILES env variable?

@Jmennius
Copy link

Jmennius commented Apr 1, 2024

@dixonwhitmire Can we get this released, the PR has been merged for a year now... 🥲

(hate to be this guy, sorry)

@dixonwhitmire
Copy link
Contributor Author

@dixonwhitmire Can we get this released, the PR has been merged for a year now... 🥲

(hate to be this guy, sorry)

Hello @Jmennius ! Unfortunately I am not a maintainer of this repo, and cannot create a release or merge a PR.

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.

Add --profile NAME option to support selectively enabling services
7 participants