407 Commits

Author SHA1 Message Date
9cbc4c1dcd Release 1.3.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-07 21:16:01 +02:00
c63d678887 Merge pull request #1100 from p12tic/release
Preparation for release
2025-01-07 21:15:30 +02:00
6de335beb2 Release notes for 1.3.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-07 21:10:54 +02:00
23799245bd Add documentation for how to create a release
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-07 21:06:45 +02:00
eda4815715 scripts: Add script to make new release
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-07 21:06:44 +02:00
cbb0cab814 scripts: Add script to create release notes
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-07 21:06:43 +02:00
7c8696b2b2 Merge pull request #1099 from p12tic/python-3.13
Declare compatibility with Python 3.13
2025-01-05 13:20:47 +02:00
483103ac3a Declare compatibility with Python 3.13
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2025-01-05 13:12:43 +02:00
e9f1029406 Merge pull request #1092 from flixman/main
Provide support for cache_from and cache_to fields
2025-01-05 13:11:53 +02:00
804852b218 Provide support for cache_from and cache_to fields
Signed-off-by: Felix Rubio <felix@kngnt.org>
2025-01-05 12:35:30 +02:00
0e3b372a29 Merge pull request #1098 from whym/readline
Fixes #1096: read log output by chunks if a line is too long
2025-01-05 12:32:51 +02:00
f11e08eaac Read log output by chunks if a line is too long
Fixes #1096.

Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Yusuke Matsubara <whym@whym.org>
2025-01-05 12:28:13 +02:00
62789a2358 Merge pull request #1094 from p12tic/build-args-test
Add unit tests for image building
2024-12-30 01:04:16 +02:00
35cf4bcb72 tests: Add test for container_to_build_args()
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-30 00:55:19 +02:00
9964604b17 Extract container_to_build_args()
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-30 00:52:45 +02:00
61fa24bf21 Merge pull request #1093 from lisongmin/add-network-level-mac_address-attr
Support network level mac_address attribute
2024-12-29 18:58:33 +02:00
ac7ec5c166 Support network level mac_address attribute
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-29 22:59:58 +08:00
75d7be2b7b Merge pull request #1087 from lisongmin/feat-support-network-scoped-aliases
Support network scoped service aliases
2024-12-22 00:54:26 +02:00
346f7a57f0 Ignore creating networks on network_mode=bridge.
When using bridge mode, podman-compose will use the default `podman` network.
We do not need to create this network, so just return as other network_mode.

Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-21 22:52:37 +02:00
55642247e3 Add integration test for network scoped aliases
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-21 22:52:37 +02:00
978a1381bc Support network scoped service aliases
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-21 22:52:37 +02:00
4a232f5e32 Merge single and multi network handling in get_net_args_from_networks()
The behavior has not changed, single-network has a special case.

Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 20:00:17 +02:00
aa8c6fd598 Simplify network handling in get_net_args_from_networks()
Note that multiple_nets is now guaranteed to be not empty in processing
stage.

Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 20:00:15 +02:00
fb0bbd6fe1 Cleanup network alias processing
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 20:00:13 +02:00
b324029f25 Simplify network name processing when there is single network
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 20:00:11 +02:00
590c371db2 Move network alias processing to common location
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 20:00:06 +02:00
16196a1f6d Simplify ip address processing in get_net_args_from_networks()
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-18 19:59:28 +02:00
2dfbb59097 Extract multiple network handling in get_net_args_from_networks()
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 19:59:27 +02:00
a34d1d1a31 Remove unused ip_assignments in get_net_args_from_networks()
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 19:59:26 +02:00
d6da65e6c9 Extract get_net_args_from_networks()
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 19:59:25 +02:00
de2c33d7ae Simplify get_net_args_from_network_mode()
This commit takes into account that network_mode won't have networks
attribute set, accordingly get_net_args_from_network_mode() can
calculate complete net_args easily.

Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 19:59:24 +02:00
2891be01d7 Ensure that network_mode and networks are not present at the same time
See
https://docs.docker.com/reference/compose-file/services/#network_mode

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-18 19:59:23 +02:00
a023dc145b Extract get_net_args_from_network_mode()
Modified-by: Povilas Kanapickas <povilas@radix.lt>
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 19:59:22 +02:00
d803c4c3e8 Merge pull request #1088 from lisongmin/feat-default-net-behavior-compat
Support docker-compose like default network behavior
2024-12-18 18:01:50 +02:00
420d19daf4 Add integration test for default network behavior
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 13:21:29 +08:00
2cfc617f9e Support docker-compose like default network behavior
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-12-18 08:48:21 +08:00
376f0817e6 Merge pull request #1085 from jeremyvisser/fix-device-cgroup-rules
Add device_cgroup_rules support
2024-12-06 11:02:16 +02:00
054c66b568 Add device_cgroup_rules support
"device_cgroup_rules: []" is defined in the Compose file specification,
and corresponds to "podman run --device-cgroup-rule="

Signed-off-by: Jeremy Visser <jeremy@visser.name>
2024-12-06 08:19:54 +11:00
d9fc8e91f2 Merge pull request #1082 from flixman/main
Provide support for conditional dependencies
2024-12-02 22:18:53 +02:00
145ae47c48 Simplified statements to retrieve keys from dictionaries
Signed-off-by: Felix Rubio <felix@kngnt.org>
2024-12-02 22:13:10 +02:00
a67fa0beb5 Adding support for conditional dependencies
Signed-off-by: Felix Rubio <felix@kngnt.org>
2024-12-02 22:13:10 +02:00
3ba0396e7a Normalize depends_on service property
Signed-off-by: Felix Rubio <felix@kngnt.org>
Modified-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-02 22:08:48 +02:00
973e15ba23 Wrap dependencies within a class
Signed-off-by: Felix Rubio <felix@kngnt.org>
Modified-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-02 22:08:48 +02:00
002c2e400b Extract run_container()
Signed-off-by: Felix Rubio <felix@kngnt.org>
Modified-by: Povilas Kanapickas <povilas@radix.lt>
2024-12-02 22:00:59 +02:00
626e278794 Merge pull request #1068 from jrnorth/patch-1
Fix Dockerfile link in readme
2024-11-18 22:05:35 +02:00
a358890d54 Merge pull request #1069 from containers/dependabot/github_actions/softprops/action-gh-release-2
build(deps): bump softprops/action-gh-release from 1 to 2
2024-11-11 21:14:11 +02:00
9f3251ff3d Merge pull request #1070 from containers/dependabot/github_actions/actions/checkout-4
build(deps): bump actions/checkout from 2 to 4
2024-11-11 21:13:14 +02:00
a9cfdb6704 build(deps): bump actions/checkout from 2 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 21:47:54 +00:00
c0dc3e47fd build(deps): bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 21:47:51 +00:00
41e69be201 Fix Dockerfile link in readme 2024-11-04 09:51:12 -07:00
4ae6ccb5c0 Merge pull request #1043 from iruzo/main
Download and build podman-compose using docker/podman locally
2024-11-03 15:42:05 +02:00
4203f799ee add release.yml workflow 2024-11-03 15:35:42 +02:00
69e95be2f6 add Dockerfile and related scripts 2024-11-03 15:35:42 +02:00
122a914b9b Merge pull request #1062 from tdgroot/down_removes_network
podman-compose down removes networks
2024-10-21 23:45:26 +03:00
db0aad97bd podman-compose down removes networks
Fixes #490

Signed-off-by: Timon de Groot <timon.degroot@hypernode.com>
2024-10-21 08:31:09 +02:00
a3fb4b373a Merge pull request #1058 from banditopazzo/705-ssh-key-support-in-build
feat: add support for ssh property in the build command
2024-10-15 03:18:41 +03:00
ab33954f6c add ssh support for build command
Fixes #705: Add support for ssh property in the build command

Signed-off-by: Domenico Salvatore <banditopazzo@gmail.com>
2024-10-15 00:35:10 +02:00
4660feb04a Merge pull request #1060 from tdgroot/podman_no_hosts_extension
Add x-podman.no_hosts extension
2024-10-14 18:05:25 +03:00
90f54b9ca5 Add x-podman.no_hosts extension
Signed-off-by: Timon de Groot <timon.degroot@hypernode.com>
2024-10-14 17:02:36 +02:00
7090de3bce Merge pull request #1049 from mokibit/automate-nets_test2
tests/integration: Automate manual `nets_test2` test
2024-10-04 04:10:31 +03:00
df8fa588a5 tests/integration: Automate manual 'nets_test2' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-10-01 12:26:42 +03:00
e2ae8bee04 Merge pull request #1048 from mokibit/automate-nets_test1
tests/integration: Automate manual `nets_test1` test
2024-09-29 15:04:40 +03:00
5c81bbfcb7 tests/integration: Automate manual 'nets_test1' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-29 14:44:17 +03:00
22b0c4b348 Merge pull request #1040 from mokibit/automate-ipam-default-test
tests/integration: Automate manual `ipam_default` test
2024-09-26 21:41:49 +03:00
380cf42dcd Merge pull request #1047 from mokibit/delete-netprio-test
tests/integration: Delete `netprio` test
2024-09-26 21:37:50 +03:00
deed4d51b0 tests/integration: Automate manual 'ipam_default' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-26 20:23:26 +03:00
08b3ac2633 tests/integration: Delete 'netprio' test
This functionality is not implemented in podman-compose so the test is
unneeded.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-26 20:10:37 +03:00
f8ea85e3af Merge pull request #1045 from mokibit/automate-multicompose-test
tests/integration: Automate manual `multicompose` test
2024-09-24 19:56:24 +03:00
0de7e13f1a tests/integration: Automate manual 'multicompose' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-24 19:38:33 +03:00
da7fd4fe86 Merge pull request #1044 from mokibit/automate-nethost-test
tests/integration: Automate manual `nethost` test
2024-09-24 19:37:58 +03:00
cb294d7519 tests/integration: Automate manual 'nethost' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-24 19:35:06 +03:00
351858dbec Merge pull request #1034 from mokibit/automate-interpolation-tests
tests/integration: Automate manual `interpolation` test
2024-09-24 19:32:16 +03:00
8d0dd214ae tests/integration: Automate manual 'interpolation' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-10 14:47:56 +03:00
229650cba8 Merge pull request #1032 from shuckc/main
Revert "Use defined environment variables in the image build process"
2024-09-07 00:13:36 +03:00
ab832d23c7 Merge pull request #1031 from mokibit/relocate-filesystem-test
tests/integration: Relocate `filesystem` test
2024-09-06 23:12:37 +03:00
4a7329b9e3 Revert "Use defined environment variables in the image build process"
This reverts commit 901adf47d0.
fixes #985 and #931

Signed-off-by: Chris Shucksmith <chris@shucksmith.co.uk>
2024-09-06 23:12:09 +03:00
de3f93c491 tests/integration: Relocate 'filesystem' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-06 20:08:13 +03:00
54cc055a5c Merge pull request #1029 from mokibit/automate-extends-with-file-subdir
tests/integration: Automate manual `extends_w_file_subdir` test
2024-09-06 20:07:51 +03:00
f4bf69b68e tests/integration: Automate manual 'extends_w_file_subdir' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-06 19:47:14 +03:00
5297b004af Merge pull request #1028 from mokibit/automate-extends-with-file
tests/integration: Automate manual `extends_w_file` test
2024-09-06 19:46:59 +03:00
fd1fc833b0 Merge pull request #1026 from mokibit/automate-extends-empty-service-test
tests/integration: Automate manual `extends_w_empty_service` test
2024-09-06 19:45:30 +03:00
124879a7b9 tests/integration: Automate manual 'extends_w_file' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-05 15:25:33 +03:00
368efe2ee3 tests/integration: Automate manual 'extends_w_empty_service' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-09-05 13:16:38 +03:00
eeefd37996 Merge pull request #1016 from legobeat/refactor-resolvable-type-checks
fix: improve type resolutions
2024-08-03 17:01:13 +03:00
b7514a0647 Merge pull request #1018 from legobeat/drop-python-3.8
Minimum Python version 3.9
2024-08-03 17:00:02 +03:00
561094954d test: Use stable apt-get cli for package installation
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 01:24:36 +00:00
ea239c4b77 Simplify secrets assignment
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 01:01:16 +00:00
9fdee76858 Initialize default values in PodmanCompose constructor
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 01:01:08 +00:00
0a6e0a35e1 Fix services replicas type
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 01:00:40 +00:00
26e6651d6c Type hints via annotations
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 01:00:36 +00:00
462603383c Remove is_dict,is_str for better pyright inference
When support for python3.8 and python3.9 has been dropped, it will be possible to eat the cak and
have it due to PEP-647.

Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 01:00:30 +00:00
8411db49d1 Minimum Python version 3.9
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-03 00:50:26 +00:00
fc90f60bf1 Merge pull request #1014 from legobeat/refactor-redundant-vars
refactor: clean up redundant proj_name, net vars
2024-08-02 10:22:28 +03:00
ed58ac0879 clean up redundant default_net variable
Signed-off-by: legobt <6wbvkn0j@anonaddy.me>
2024-08-01 23:16:13 +00:00
305f25b4d6 clean up redundant proj_name
- remove unutilized proj_name parameter from volume_ls

Signed-off-by: legobt <6wbvkn0j@anonaddy.me>

proj_name
2024-08-01 23:16:13 +00:00
edadf73d82 Merge pull request #1017 from mokibit/automate-extends-tests
tests/integration: Automate manual 'extends' test
2024-08-01 21:41:30 +03:00
dc04108b3e tests/integration: Automate manual 'extends' test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-08-01 21:29:43 +03:00
348461ca77 Merge pull request #1007 from mokibit/automate-env-tests
tests/integration: Automate manual `env` tests
2024-07-30 14:09:55 +03:00
92dbd3690e tests/integration: Automate 'env-file-tests' manual tests
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-30 12:46:13 +02:00
a1e9a82693 Merge pull request #1012 from mokibit/automate-exit-from-tests
tests/integration: Automate manual `exit-from` tests
2024-07-30 11:16:17 +03:00
9e11c6bfbc tests/integration: Automate manual 'exit-from' tests
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-30 09:40:20 +02:00
0d24c41afb tests/integration: Automate 'env-tests' manual test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-29 10:39:49 +02:00
585d344d0a Merge pull request #1004 from lisongmin/substitution-with-service-environment
Substitution with service environment
2024-07-27 00:06:46 +03:00
3aa6d4d158 Merge pull request #1009 from bkueng/platform_build_cmd
podman_compose.py: support "platform" property in the build command
2024-07-27 00:04:54 +03:00
34f5268e37 Add unittest for rec_subs
Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-07-27 00:04:06 +03:00
b5eaf314ad Support variable substitution with service's environment
This commit introduces the ability to substitute environment variables
within the 'environment' section of the service definition.

This allows for more dynamic configuration of services.

Signed-off-by: Songmin Li <lisongmin@protonmail.com>
2024-07-27 00:04:06 +03:00
b3c49df6eb podman_compose.py: support "platform" property in the build command
This was already added to container_to_args() in https://github.com/containers/podman-compose/pull/470
which is used for the 'up' and 'run' commands.

Definition in the schema: https://github.com/compose-spec/compose-spec/blob/main/schema/compose-spec.json#L329

Signed-off-by: Beat Küng <beat-kueng@gmx.net>
2024-07-26 23:58:11 +03:00
dbbd695463 Merge pull request #1008 from mokibit/automate-deps-test
tests/integration: Automate manual `deps` test
2024-07-23 23:12:17 +03:00
1b1d3d8c25 Merge pull request #1010 from jasonchuanet/docs_uidmaps_gidmaps
Update docs+messages to reflect uidmaps/gidmaps code
2024-07-23 23:11:00 +03:00
7d7e64fe5a Update docs+messages to reflect uidmaps/gidmaps code
Signed-off-by: Jason Chua <jasonc1804@gmail.com>
2024-07-22 20:54:41 -07:00
3c9c18c6e0 tests/integration: Automate deps manual test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-22 15:19:34 +02:00
d0a2a44442 Merge pull request #1003 from njhanley/remove-branch-names-from-contrib-docs
Remove references to nonexistent devel and stable branches
2024-07-19 19:11:48 +03:00
1e66c28bbb Remove references to nonexistent devel and stable branches
Closes #894

Signed-off-by: Nick Hanley <nicholasjhanley@gmail.com>
2024-07-18 21:41:59 -04:00
b6eadd56b1 Merge pull request #1002 from nerilex/main
Add `--network=none` if `network_mode: none` is set
2024-07-17 05:19:19 +03:00
d95b4d026b Add newsfragment
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-17 01:43:45 +03:00
bg
e2eb883709 Add --network=none if network_mode: none is set; fixes #1001.
Signed-off-by: bg <bg@nerilex.org>
2024-07-17 01:41:04 +03:00
0866492a7e Merge pull request #1000 from zoumingzhe/main
Support python direct call _parse_args or run
2024-07-15 18:48:39 +03:00
85050097e5 Support python direct call _parse_args or run
For example:
```
>>> from podman_compose import podman_compose
>>> podman_compose._parse_args(['version'])
>>> podman_compose.run(['help'])
```

Signed-off-by: Mingzhe Zou <zoumingzhe@qq.com>
2024-07-15 12:04:39 +08:00
daab93b762 Merge pull request #997 from mokibit/automate-build-tests
Automate manual `build` tests
2024-07-08 22:42:00 +03:00
9fe30387ee tests/integration: Automate 'build_fail' manual test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-08 21:37:29 +02:00
0f8348bea7 tests/integration: Automate 'build' manual test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-08 21:36:29 +02:00
55ab3fa7f7 Merge pull request #994 from swick/wip/build-labels
Pass build description labels to podman build
2024-07-08 19:20:22 +03:00
2091ade7b1 Add newsfragment
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-08 19:15:16 +03:00
ca58d7cd58 Pass build description labels to podman build
The Compose Specification supports adding labels to the build image
which is also used in practice. Support this and pass the labels to
`podman build`.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-07-08 19:15:16 +03:00
3296c8d34f Merge pull request #993 from p12tic/compose-file-links
Don't resolve links to compose file
2024-07-06 19:35:18 +03:00
dab6b1b98d Merge pull request #992 from p12tic/docker-compose-name-compat
Add a way to remove dashes in default network names
2024-07-06 18:56:25 +03:00
5bf4c0fdbe Add a way to remove dashes in default network names
This is the behavior exhibited by docker compose. The network names are
user-visible through external networks, so previously anyone who
migrated from docker-compose needed to change their configuration. Now
it is possible to select compatibility via a flag in x-podman global
dictionary.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-06 18:50:25 +03:00
67c5352c3a Extract default_network_name_for_project()
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-06 18:32:09 +03:00
5e0f7e5e19 Merge pull request #990 from p12tic/tests-single-container-up
tests: Add integration tests for up -d with single container at a time
2024-07-06 01:06:23 +03:00
5040a37d47 tests: Add integration tests for up -d with single container at a time
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-06 00:59:50 +03:00
c82859b89f Merge pull request #989 from p12tic/github-install-requirements-unconditionally
github: Install requirements unconditionally
2024-07-04 09:19:30 +03:00
29195be77c github: Install requirements unconditionally
This makes tests less brittle as any renames to requirements files will
be noticed.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-04 09:17:27 +03:00
1c74d6cd11 Merge pull request #988 from p12tic/tests-discovery
Discover tests instead of passing a list of files to unittest
2024-07-03 19:52:56 +03:00
9a4af0ce62 Discover tests instead of passing a list of files to unittest
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-03 19:50:13 +03:00
0517b9e34c Merge pull request #987 from p12tic/check-if-pod-exists-before-creating
Check whether pod exists before trying to create one
2024-07-03 19:35:28 +03:00
24038dace3 Check whether pod exists before trying to create one
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-07-03 19:31:13 +03:00
0ea4cbe091 Merge pull request #984 from mokibit/reduce-path-calculation-duplication
tests/integration: Reduce base path calculation duplication
2024-07-03 09:13:49 +03:00
2056e703d5 tests/integration: Reduce base path calculation duplication
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-03 09:09:25 +03:00
137c6207b2 Merge pull request #981 from mokibit/add-unittests-for-secrets
unittests: Added unit tests for podman-compose secrets
2024-07-02 20:52:34 +03:00
4ec57c1013 unittests: Added unit tests for podman-compose secrets
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-07-02 20:26:58 +03:00
d9a3572461 Merge pull request #978 from PlugNPush/main
Restore support for alt dockerfiles (removing hardcoded "Dockerfile")
2024-06-26 21:39:42 +03:00
fa3e0a7772 Alt Dockerfile names fix
Signed-off-by: Michaël Nass - PlugN <michael.nass@free.fr>
2024-06-26 19:09:20 +02:00
0bcf0799b6 Merge pull request #976 from p12tic/tests-move-around
Move all tests to single directory "tests"
2024-06-26 11:30:21 +03:00
18472b53ac Move all tests to single directory "tests"
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-06-26 11:28:16 +03:00
d38b26bb01 Release 1.2.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-06-26 10:43:28 +03:00
22a4ad5806 Merge pull request #975 from p12tic/changelog
Add release notes for v1.2.0
2024-06-26 10:41:59 +03:00
37e2cb28d4 Add release notes for v1.2.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-06-26 10:39:48 +03:00
0cd3902c5f Merge pull request #974 from p12tic/newsfragments
Use newsfragments pattern for the release notes
2024-06-26 10:37:54 +03:00
6ef759c6fd Use newsfragments pattern for the release notes
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-06-26 10:21:03 +03:00
16cbcf4152 Merge pull request #956 from Genzer/fix/loading-.env-breaking-since-1.1.0
Load .env from Compose file's directory and cwd
2024-06-24 23:37:33 +03:00
67ce900885 Commit .env in tests/env-file-tests, bypassing root .gitignore
This commit adds a .gitignore in tests/env-file-tests to allow .env files
to be committed.

Fix: #937
Signed-off-by: Genzer <732937+Genzer@users.noreply.github.com>
2024-06-24 23:29:57 +03:00
4e9f76768c Load .env from Compose file's directory and cwd
This commit loads dotenv `.env` (exactly that name) from the following location (the later takes
precedence):

- The `.env` file in the Compose file's directory.
- The `.env` file in the current working directory (invoking podman-compose).

This preserves the behavior prior to 1.1.0 and to match with Docker Compose CLI.

Fix: https://github.com/containers/podman-compose/issues/937
Signed-off-by: Genzer <732937+Genzer@users.noreply.github.com>
2024-06-24 23:29:56 +03:00
84f7fdd7da Merge pull request #971 from mokibit/type-env-secret-support
Add support for environment variable secrets
2024-06-24 23:17:34 +03:00
405001b990 Fix comment
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-06-24 21:24:34 +03:00
6b1aeff55f Add unittests for type=env secret
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-06-24 21:24:34 +03:00
f06975b346 Update tests for type=env secret
Signed-off-by: Brett Calliss <brett@obligatory.email>
2024-06-24 20:12:44 +03:00
546cad5171 Add type=env secret support
Signed-off-by: Brett Calliss <brett@obligatory.email>
2024-06-24 20:12:44 +03:00
e07c28d127 Merge pull request #771 from wgnathanael/environment-precedence
Fix environment variable precedents
2024-06-22 20:00:08 +03:00
935029dc33 Fix environment variable precedents
Per https://docs.docker.com/compose/environment-variables/envvars-precedence/#advanced-example

Signed-off-by: nathanael.noblet <nathanael.noblet@willowglensystems.com>
2024-06-22 19:58:02 +03:00
80b2aa6ed0 Merge pull request #964 from mokibit/set-custom-in_pod-in-compose-file
Allow providing custom in_pod argument as a global compose file variable
2024-06-20 09:45:41 +03:00
360b85bf2d Allow providing custom in_pod argument as a global compose file variable
Default command line argument `in_pod` was set to True, but this breaks
the compose file for users who want to use `--userns` argument. This
commit sets default `in_pod` value to None, and later resolves whether
to create a pod by checking compose file, as new argument in compose
file x-podman is now available. Now it is convenient for users to pass
custom `in_pod` value (True or False) as a compose file argument when
command line value of `in_pod` is not provided.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-06-20 09:42:22 +03:00
650a835eca Merge pull request #966 from ArthoPacini/enhance/stdin-docker-compose-support
Add ability to input docker-compose.yaml via stdin
2024-06-19 20:06:15 +03:00
82740cc311 Add ability to input docker-compose.yaml via stdin
Signed-off-by: Artho Pacini <eu@arthopacini.com>
2024-06-18 00:05:31 +03:00
0f645e4c70 Add ability to input docker-compose.yaml via stdin
Signed-off-by: Artho Pacini <eu@arthopacini.com>
2024-06-18 00:05:31 +03:00
3b15170ccf Changed the global parser help message for file input, to reflect changes for reading from stdin
Signed-off-by: Artho Pacini <eu@arthopacini.com>
2024-06-18 00:05:31 +03:00
3359380ec6 Add ability to input docker-compose.yaml via stdin
Signed-off-by: Artho Pacini <eu@arthopacini.com>
2024-06-18 00:05:31 +03:00
14f39e5b86 Merge pull request #965 from mokibit/fix-gidmap-typo
Fix x-podman.gidmap typo
2024-06-17 10:08:17 +03:00
e799a0b0ea Fix x-podman.gidmap typo
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-06-14 17:31:55 +03:00
6d8d3e94fe Merge pull request #960 from mokibit/github-verbose-integration-tests
github: Add verbose option to integration tests
2024-06-08 20:15:13 +03:00
65d1fdeaa3 github: Add verbose option to integration tests
Currently it is not possible to see which test output corresponds to
which test exactly. Now before each new test its test name is printed.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-06-08 20:05:12 +03:00
d905a7c638 Merge pull request #949 from mokibit/multiline-env-file
Add support for multi-line environment files
2024-05-29 00:47:58 +03:00
2e8ed2f924 pytests: Add test for object required but path non existent
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-05-29 00:09:22 +03:00
040b73adab pytests: Add tests for several multi-line environment files
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-05-29 00:09:15 +03:00
f3e9a96c96 Fixes #908: Add support for multi-line environment files
Signed-off-by: Hedayat Vatankhah <hedayat.fwd@gmail.com>
2024-05-28 23:43:15 +03:00
04b107805a Merge pull request #954 from mokibit/fix-codespelling-update
github/workflows: Fix automatic codespelling update
2024-05-28 23:40:59 +03:00
2c5d00d3e7 github/workflows: Add codespellignore file to address false positives
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
2024-05-28 20:20:33 +03:00
cac90f69b8 Merge pull request #946 from charliemirabile/selinux_tests
Missing SELinux tests
2024-05-22 10:17:05 +03:00
b513f50f30 test: add missing unit tests for selinux in verbose mount
Support for setting the selinux flags on a bind mount specified using
the verbose syntax was merged as part of #911, but at that time the PR
lacked unit tests. This commit adds the missing tests

Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
2024-05-21 19:43:03 -04:00
8f618b6fab Merge pull request #763 from otto-liljalaakso-nt/additional_contexts
Support additional_contexts
2024-05-21 19:49:23 +03:00
cac836b0f5 Support additional_contexts
Signed-off-by: Otto Liljalaakso <otto.liljalaakso@novatron.fi>
2024-05-21 19:44:37 +03:00
3bb305cef4 Merge pull request #945 from p12tic/split-gpu-test
test: Split test_gpu test
2024-05-21 12:25:11 +03:00
09034a0c38 test: Split test_gpu test
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-05-21 12:04:32 +03:00
e668a339ce Merge pull request #943 from HernandoR/fix/multi-sub-composes
Fix the test_include for multi subcomposes
2024-05-21 11:32:17 +03:00
0065082db9 refine the test_include for multi subcomposes
Signed-off-by: Zhen Liu <lzhen.dev@outlook.com>
2024-05-21 11:28:27 +03:00
5d4de80ab7 Merge pull request #911 from charliemirabile/selinux
Add support for selinux in verbose bind mount specification
2024-05-19 11:13:45 +03:00
23ad5c3ef7 Merge pull request #920 from mokeyish/gpu
Add supoort for enabling GPU access
2024-05-19 11:12:34 +03:00
45efe461b0 Merge pull request #941 from HernandoR/patch-1
Update podman_compose.py
2024-05-19 11:10:39 +03:00
4f73f2b79e fix: add include test file, edit the assertion
Signed-off-by: Zhen Liu <lzhen.dev@outlook.com>
2024-05-18 21:23:43 +08:00
1d64f2cf8c Update podman_compose.py
fix #940

Signed-off-by: Zhen Liu <lzhen.dev@outlook.com>
2024-05-18 20:33:10 +08:00
2ce6d1a1e7 Merge pull request #933 from hedayat/fix-build-error-log
Fix logging build error message
2024-05-13 16:24:15 +03:00
4e22faefd6 Fix logging build error message
Signed-off-by: Hedayat Vatankhah <hedayat.fwd@gmail.com>
2024-05-13 15:13:40 +03:00
7a2da76ab8 Merge pull request #724 from hedayat/fix-merge-depends-on
Fixes #723: merge short & long syntax of depends_on dependencies
2024-05-08 17:57:44 +03:00
79865c2e13 Add support for enabling GPU access
Signed-off-by: YISH <mokeyish@hotmail.com>
2024-05-07 10:32:24 +08:00
33d7d35a4d Merge pull request #851 from fccagou/fix-ipam-driver-default
fix(ipam_driver): do not pass --ipam-driver option when value set to …
2024-05-06 17:31:59 +03:00
c23a8b2cbd Do not pass --ipam-driver option when value set to default
fixes #852.

Signed-off-by: fccagou <me@fccagou.fr>
2024-05-06 17:00:17 +03:00
36a3d3c207 Merge pull request #925 from GerkinDev/feat/env-file-object
Fixes #897: support `env_file` as objects
2024-05-06 16:57:25 +03:00
b202a09501 Add support for env_file as objects
Fixes: https://github.com/containers/podman-compose/issues/897

Signed-off-by: Alexandre Germain <nihilivin@gmail.com>
2024-05-06 14:13:37 +03:00
35cbc49160 Merge pull request #928 from schugabe/patch-1
add await for create_pods call
2024-05-06 14:00:29 +03:00
5c4aa40032 add await for create_pods call
fixes log output podman_compose.py:2527: RuntimeWarning: coroutine 'create_pods' was never awaited

Signed-off-by: Johannes Kasberger <schugabe@gmx.at>
2024-05-06 11:02:45 +02:00
0ee7c2630a Merge pull request #641 from DaniruKun/devel
Add instructions on install from Homebrew
2024-05-04 18:03:43 +03:00
cef1785cd5 Add instructions on install from Homebrew
Signed-off-by: Daniils Petrovs <thedanpetrov@gmail.com>
2024-05-04 17:50:06 +03:00
b4cfef12e9 Merge pull request #926 from p12tic/cleanup-tests
Cleanup tests
2024-05-04 17:32:00 +03:00
b761050b0b tests: Merge multiple compose merging tests into single test class
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-05-04 17:30:09 +03:00
e1d0ea7b4e tests: Move normalize_service tests to a separate test class
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-05-04 17:29:04 +03:00
1430578568 tests: Simplify command and entrypoint normalization tests
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-05-04 17:28:59 +03:00
8f41cd3cdb Merge pull request #731 from g2p/patch-1
README: explain that netavark is an alternative to the dnsname plugin
2024-05-01 21:16:27 +03:00
a73dac2e39 Merge pull request #923 from winston-yallow/remove-sideeffect-from-systemd-registration
Don't create pods/container when registering systemd unit
2024-05-01 21:05:13 +03:00
d31a8b124d Don't create pods/container when registering systemd unit
Signed-off-by: Winston <44872771+winston-yallow@users.noreply.github.com>
2024-05-01 20:03:14 +02:00
5df4e786ee README: explain that netavark is an alternative to the dnsname plugin
This is a useful hint when the dnsname plugin is not packaged.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
2024-05-01 15:13:29 +02:00
27e27e9fe9 Merge pull request #918 from p12tic/fix-in-pod
Fix handling of --in-pod argument
2024-04-28 21:33:50 +03:00
70a0e2d003 Fix handling of --in-pod argument
Currently --in-pod handling is broken because the only way to set False
is by providing empty argument like "--in-pod=". As of Python 3.7 the
solution is to accept string and parse manually.

Co-authored-by: Randolph Sapp <res.sapp@gmail.com>
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-04-28 21:16:34 +03:00
58641f0545 Merge pull request #716 from Tayeh/images_cmd
add `podman-compose images` command
2024-04-28 20:37:07 +03:00
eea8bac496 Add images command
Signed-off-by: Mohammed Tayeh <m.tayeh94@gmail.com>
2024-04-28 19:04:23 +03:00
09a8a3edf9 Merge pull request #917 from p12tic/x-podman-keys
Migrate x-podman dictionary on container root to x-podman.* fields
2024-04-28 18:29:33 +03:00
a6c4263738 Add tests for x-podman.uidmaps and x-podman.gidmaps
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-04-28 18:25:04 +03:00
9599cc039e Migrate x-podman dictionary to x-podman.* fields in container root
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-04-28 18:24:37 +03:00
0a6c057486 Merge pull request #737 from ftyghome/feat_rootfs
Support podman's external rootfs management
2024-04-28 18:04:37 +03:00
2b4ecee082 Add docs for podman specific compose file extensions
Signed-off-by: GnSight <ftyg@live.com>
2024-04-28 17:55:39 +03:00
77f2e8e5b0 Support podman's external rootfs management
Signed-off-by: GnSight <ftyg@live.com>
2024-04-28 17:55:39 +03:00
12d46ca836 Merge pull request #916 from beledouxdenis/main-run-implement-publish
implement --publish in docker-compose run
2024-04-28 17:33:56 +03:00
72a94d5185 implement --publish in docker-compose run
Signed-off-by: Denis Ledoux <dle@odoo.com>
2024-04-28 00:54:35 +02:00
2681566580 Release 1.1.0 2024-04-19 12:37:30 +03:00
62ce087c6e Merge pull request #914 from p12tic/release-notes
Add release notes for v1.1.0
2024-04-17 20:26:52 +03:00
c97f003732 Add release notes for v1.1.0
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-04-17 20:23:48 +03:00
c88558b4ec Merge pull request #913 from p12tic/network-mac-address-vendor-prefix
Use x- prefix for x-podman.mac_address
2024-04-17 20:21:56 +03:00
131010bc9d Use x- prefix for x-podman.mac_address
Docker compose documents x- prefix as standard vendor prefix.

https://github.com/compose-spec/compose-spec/pull/18

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-04-17 20:16:03 +03:00
1da2f85a90 Merge pull request #906 from camspiers/fixes/ulimit-build-args
Fix, use "service.build.ulimits" when it is present instead of "service.ulimits"
2024-04-17 19:48:55 +03:00
cdcedeb6b2 Use "service.build.ulimits" when present instead of "service.ulimits"
Signed-off-by: Cam Spiers <camspiers@gmail.com>
2024-04-17 19:45:34 +03:00
3e1f7d554b add tests for selinux with verbose bind mount
based on seccomp test. Without the selinux option, visiting localhost:8080
will give a 404 error because httpd cannot access the file, but with selinux: z
the context for the file will be appropriately updated so httpd can access it

Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
2024-04-10 15:29:03 -04:00
d7cf0966d3 add support for selinux in verbose mount
This corresponds to specifying the `z` or `Z` option in the third
portion of a terse mount specification (i.e. src:trg:z)

Signed-off-by: charliemirabile <46761267+charliemirabile@users.noreply.github.com>
2024-04-10 15:29:03 -04:00
e893d06313 Merge pull request #867 from baszoetekouw/fix-networks
Fix multiple networks with separately specified ip and mac
2024-04-08 23:21:38 +03:00
1f35c00694 Add unit test for depends_on normalization as a dict
Signed-off-by: Hedayat Vatankhah <hedayat.fwd@gmail.com>
2024-04-08 23:31:41 +03:30
9a5b43907f Merge pull request #905 from acotty/main
FIX issue https://github.com/containers/podman-compose/issues/704 - Windows fix sock not working.
2024-04-07 12:43:43 +03:00
6c09ce710e FIX issue https://github.com/containers/podman-compose/issues/704 - Windows fix sock not working. 2024-04-07 16:28:45 +10:00
953534a71a Support and document all podman-specific network_modes
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
6feff244db slirp4netns can be used without options
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
9fd4cf43c1 Add unit tests for network_mode
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
65849c95e2 add comment about per-network aliases
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
9baea704d7 use preferred format of podman command line options
Specifically:
  - use "--network=foo" instead of "--network foo"
  - specify "--network-alias" multiple times instead of concatenating values

Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
bdff78dcba Ignore files generated by tests
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
45ca1f994f Support podman-specific per-network mac_address specifiation
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
91fbea3d89 Add unit tests for get_net_args()
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
2743d690d2 Fix support for multiple networks with explicitly specified ipv4/ipv6 addresses
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
dd34a90068 Add testcase for failing network config
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-28 16:09:43 +02:00
6103df78fb Merge pull request #777 from wiehe/build-secrets
Pass file secrets to "podman build" via parameter "--secret"
2024-03-28 00:40:12 +02:00
07128f6b37 Merge pull request #779 from jbaptperez/lint-fixes-and-enhancements
Lint fixes and enhancements
2024-03-28 00:36:50 +02:00
f0bae1e2d9 Don't resolve links to compose file
docker-compose uses the path to the compose file even if it's symlink to
get the context directory.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-25 08:18:52 +02:00
81d81fb303 Formats CONTRIBUTING.md
Signed-off-by: Jean-Baptiste Perez <jbaptperez@gmail.com>
2024-03-17 19:31:47 +01:00
b263dc1a7d Fixes typos and enhances CONTRIBUTING.md
Signed-off-by: Jean-Baptiste Perez <jbaptperez@gmail.com>
2024-03-17 19:31:47 +01:00
078ee7b649 Updates Signed-off-by link in CONTRIBUTING.md
The initial link was related to GPG signature in commits (--gpg-sign or
-S git-commit option) as the required signature is actually a
"Signed-off-by" trailer at the end of the commit message (--signoff or
-s git-commit option).

Signed-off-by: Jean-Baptiste Perez <jbaptperez@gmail.com>
2024-03-17 19:31:47 +01:00
a6e3ae7b31 Fixes invalid name of test package in setup.py
Signed-off-by: Jean-Baptiste Perez <jbaptperez@gmail.com>
2024-03-17 19:31:47 +01:00
1e9cf1dff0 Pass file secrets to "podman build" via parameter "--secret"
to make them available for "RUN --mount=type=secret" statements inside the
Dockerfile.

Keep using --volume to pass file secrets to "podman run".

Signed-off-by: wiehe <28457227+wiehe@users.noreply.github.com>
2024-03-12 17:23:40 +01:00
d704622522 Merge pull request #890 from containers/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2024-03-12 15:27:34 +02:00
bbfff78e25 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 21:44:23 +00:00
abb0cb1649 Merge pull request #888 from aripollak/fix-test-class-names
Rename test classes to match filenames
2024-03-10 00:21:20 +02:00
d53df307f8 Merge pull request #889 from aripollak/add-coverage-to-job-summary
Add coverage to Github Action summary
2024-03-10 00:20:50 +02:00
c351f99da5 Add coverage to Github Action summary
Signed-off-by: Ari Pollak <ajp@aripollak.com>
2024-03-09 17:10:14 -05:00
829cde0de9 Rename test classes to match filenames
Signed-off-by: Ari Pollak <ajp@aripollak.com>
2024-03-09 16:34:06 -05:00
f18c8092cc Merge pull request #887 from baszoetekouw/fix-oldpython
Fix support for older python versions
2024-03-09 23:29:32 +02:00
43059dc16f Merge pull request #783 from ChuJiani/devel
Fix #782: add support for `http-proxy` option of podman
2024-03-09 23:27:22 +02:00
da63048775 Don't spellcheck requirementfiles
As some python module names are not proper english words

Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:36 +01:00
7987a7185e Merge pull request #861 from aripollak/remove-implemented-from-missing
Remove implemented commands from Missing Commands
2024-03-09 23:26:36 +02:00
5e55df890c fix python < 3.9 compatibility
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:36 +01:00
fde7995cb8 Fix python < 3.11 compatibility
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:36 +01:00
c592596a5e Split out the different tests into separate CI steps
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:36 +01:00
688ee9a104 Fix pylint issues
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:35 +01:00
c3a152e68f Enable pylint, because it catches stuff that ruff misses
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:35 +01:00
bd60bc9f21 Run tests on all supported python versions
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:35 +01:00
9d8b0b8632 add editorconfig
Signed-off-by: Bas Zoetekouw <bas.zoetekouw@surf.nl>
2024-03-09 22:26:32 +01:00
ee013316c0 Merge pull request #860 from aripollak/fix-env-vars-with-equals
Allow run/exec -e with equals sign in value
2024-03-09 23:25:56 +02:00
f2f5483a74 Extract compose_run args parsing and add unit tests
Signed-off-by: Ari Pollak <ajp@aripollak.com>
2024-03-09 16:18:13 -05:00
c4fa8f7a16 Split exec args parsing into new function and add unit tests for it
Signed-off-by: Ari Pollak <ajp@aripollak.com>
2024-03-09 16:02:47 -05:00
4c270b9116 Allow run/exec -e with equals sign in value
Fixes: #798
Signed-off-by: Ari Pollak <ajp@aripollak.com>
2024-03-09 14:35:08 -05:00
c5f7f550f9 Remove implemented commands from Missing Commands
Signed-off-by: Ari Pollak <ajp@aripollak.com>
2024-03-09 14:32:29 -05:00
c98cbaaaf0 Fix #782: add support for http_proxy
Signed-off-by: ChuJiani <archet@chujiani.top>
2024-03-09 17:10:09 +00:00
f2f2f15a3b Merge pull request #765 from timocov/devel
Added handling `pid` option
2024-03-09 18:30:48 +02:00
91d316ff1f Added handling pid option
Fixes #554

Signed-off-by: Evgeniy Timokhov <timocov@gmail.com>
2024-03-09 16:10:37 +00:00
121b5f6ea1 Merge pull request #749 from maxi0604/more-network-options
Add support for enable_ipv6
2024-03-09 13:03:27 +02:00
969edb88d0 Add support for enable_ipv6
Signed-off-by: Maximilian R <maxi.rostock@outlook.de>
2024-03-09 13:01:41 +02:00
bba1f33d51 Factor out arg creation for "network create". Add unit tests.
Signed-off-by: Maximilian R <public@complexvector.space>
2024-03-09 13:00:09 +02:00
970e4ac4ab Merge pull request #764 from lemmi/sysctls-dict
Handle sysctls maps
2024-03-09 12:47:10 +02:00
a9c335bf82 Handle sysctls maps
- Add support to handle sysctls maps.
- Directly raise an error if sysctls is neither an array nor map instead
  of letting podman fail with an unhelpful message.

Support for sysctls arrays was added in #261.

Fixes #754: sysctls only works with arrays, not maps

Signed-off-by: lemmi <lemmi@nerd2nerd.org>
2024-03-09 12:44:55 +02:00
e67c52f2c4 test_container_to_args: handle async tests
Signed-off-by: lemmi <lemmi@nerd2nerd.org>
2024-03-09 12:44:55 +02:00
e0fc9a7546 Merge pull request #696 from dkull/devel
Fix stop/restart args stacking
2024-03-09 12:42:54 +02:00
2cdfb3e6d4 Fix stop/restart args stacking
Signed-off-by: Tanel Liiv <tanel.liiv@reconeyez.com>
Signed-off-by: Tanel Liiv <liivtanel@gmail.com>
2024-03-09 12:39:53 +02:00
60137eb7f9 Merge pull request #741 from maurerle/quiet-output
Output: use logging, remove verbose output by default
2024-03-09 12:35:00 +02:00
a7a993faef Merge pull request #886 from p12tic/github-pr-template
github: Add PR template
2024-03-09 12:27:17 +02:00
8ec5e0372a github: Add PR template
Adding a link to related part of compose spec is much easier for the
contributors, because they're already working on the feature. This saves
reviewer time.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-09 12:18:19 +02:00
da520e299b switch to % string lazy formatting
* fix black and pylint issues

Signed-off-by: Florian Maurer <f.maurer@outlook.de>
2024-03-09 10:40:24 +01:00
1e9e2ee776 Output: use logging, remove garbage output by default
Fixes #489.

Introduces a --verbose flag if you want to see all the noise that
was previously printed by default.

Signed-off-by: James O'Beirne <james.obeirne@pm.me>
Signed-off-by: Florian Maurer <f.maurer@outlook.de>
2024-03-09 10:36:20 +01:00
dcb6cdb55a Merge pull request #858 from breca/asyncio_compat
Replaces asyncio timeout with bespoke timeout function
2024-03-09 11:05:17 +02:00
0f693ee584 Replaces asyncio timeout with bespoke timeout function
Signed-off-by: Brett Calliss <brett@obligatory.email>
2024-03-09 19:02:32 +11:00
d468f85fd1 Merge pull request #755 from yarikoptic/enh-codespell
Add codespell config (to ignore loved "poped") and github workflow to prevent future typos
2024-03-09 01:47:25 +02:00
cf90ab2858 Run codespell throughout fixing typos automagically
Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
2024-03-08 18:41:03 -05:00
d2fa80196f ignore poped (not sure why not to make it popped)
Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
2024-03-08 18:41:03 -05:00
247774822c Add pre-commit definition for codespell
Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
2024-03-08 18:41:03 -05:00
6e65a73ab9 Add rudimentary codespell config
Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
2024-03-08 18:41:03 -05:00
f95ca7aca7 Add github action to codespell devel on push and PRs
Signed-off-by: Yaroslav Halchenko <debian@onerussian.com>
2024-03-08 18:41:03 -05:00
cdf5961bf2 Merge pull request #758 from containers/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2024-03-09 01:09:28 +02:00
0c0e77c246 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-08 22:51:44 +00:00
e6fc585702 Merge pull request #884 from p12tic/lint-fixes
Fix unsorted imports
2024-03-08 23:59:06 +02:00
bb2338e447 Fix unsorted imports
This is a logical merge conflict that has been caused by several PRs
landing in parallel.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:54:48 +02:00
a8db898ac6 Merge pull request #883 from p12tic/lint-fixes
Enable ruff check and fix lint errors
2024-03-08 23:51:25 +02:00
1ba1c364b9 Merge pull request #819 from p12tic/service-runtime
Add support for runtime service configuration key
2024-03-08 23:51:17 +02:00
15ae2140d4 Add support for runtime service configuration key
https://docs.docker.com/compose/compose-file/05-services/#runtime

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:48:55 +02:00
ed39523342 github: Enable ruff check
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:47:13 +02:00
4e43606df3 Shorten too long lines
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:46:24 +02:00
91052cb2d9 Fix ambiguous variable name
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:46:23 +02:00
a6e0092627 Remove unused variable
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:46:22 +02:00
59a1fa3942 Use 'not in' for membership test
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:46:21 +02:00
36139fb282 Remove unused f-string
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:46:20 +02:00
b0da6f82d3 Fix import formatting
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 23:46:19 +02:00
b1e4324d41 Merge pull request #882 from p12tic/readme-fix-badge-status
README: fix status badges
2024-03-08 16:26:23 +02:00
94df95acea README: Fix link to tests badge
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 16:09:15 +02:00
3a5a283cf6 README: Remove link to pylint test badge
This is an internal metric that the users don't need to care about at
all.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 16:09:11 +02:00
16a90e2bce Merge pull request #873 from p12tic/github-run-container
github: Run actions on python:3.11-bookworm
2024-03-08 15:58:18 +02:00
7c81044860 github: Run actions on python:3.11-bookworm
This ensures a stable environment for tests even when ubuntu-latest
changes. Also, the dependency on setup-python action has been
removed. That action supports only Ubuntu and limited architectures.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 15:56:30 +02:00
5b571942e0 Merge pull request #880 from p12tic/fix-test-names
github: Fix test names
2024-03-08 15:56:01 +02:00
de8f545f07 Merge pull request #881 from p12tic/test-fix-teardown
tests: Properly tear down containers in extends_w_file_subdir test
2024-03-08 15:55:54 +02:00
1a24cde608 tests: Properly tear down containers in extends_w_file_subdir test
podman rmi does not guarantee that the container itself is shut down.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 15:52:40 +02:00
a90da4dfaf github: Fix test names
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 15:51:24 +02:00
6841619b9c Merge pull request #879 from p12tic/tests-debug-output
tests: Add verbose debug option via env variable
2024-03-08 15:50:58 +02:00
27c8cebbdc tests: Add verbose debug option via env variable
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 15:34:00 +02:00
c84b4c33fc Merge pull request #878 from p12tic/tests-decoded-output
tests: Print decoded subprocess output in case of failure
2024-03-08 15:15:24 +02:00
0614687840 tests: Print decoded subprocess output in case of failure
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 15:11:25 +02:00
a494f20e15 Merge pull request #877 from p12tic/tests-faster
tests: Optimize speed by using dumb-init to handle SIGTERM signal
2024-03-08 14:49:25 +02:00
6af7a2d691 tests: Optimize speed by using dumb-init to handle SIGTERM signal
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 14:45:53 +02:00
872664b727 Merge pull request #876 from p12tic/tests-print-subprocess-errors
tests: Print output in case subprocess returns unexpected code
2024-03-08 14:41:23 +02:00
f4dc5f3b93 tests: Print output in case subprocess returns unexpected code
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 13:14:02 +02:00
ac5034065d Merge pull request #875 from p12tic/spdx-identifiers
Add SPDX license identifiers to each source file
2024-03-08 12:35:02 +02:00
b34f699adb Add SPDX license identifiers to each source file
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 12:19:51 +02:00
3d68d2432d Merge pull request #874 from p12tic/github-tests-on-all-branches
github: Run tests on all branches
2024-03-08 12:09:57 +02:00
2c6c1be197 github: Run tests on all branches
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 12:02:06 +02:00
f81cbe39b5 Merge pull request #872 from containers/dependabot/github_actions/actions/setup-python-5
Bump actions/setup-python from 4 to 5
2024-03-08 11:43:49 +02:00
91737ee0a6 Bump actions/setup-python from 4 to 5
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-08 09:41:46 +00:00
9d1407ba90 Merge pull request #871 from p12tic/unittest
Migrate tests to unittest
2024-03-08 11:39:20 +02:00
b65d4a3916 github: Fix ruff job setup
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 11:36:57 +02:00
23fe9e7e1d Migrate tests to unittest
unittest is much more straightforward without any magic. In a small
project like podman-compose being easy to understand is more important
than features.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 11:33:17 +02:00
7539257ee8 requirements: Install . for tests
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-08 11:00:33 +02:00
9e29891aa7 Merge pull request #870 from p12tic/ruff
Use ruff for formatting
2024-03-07 18:28:52 +02:00
a967cab02b Format codebase with ruff
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-07 18:28:06 +02:00
a5c354d60b Replace flake8, black, pylint with ruff
For now pylint checks are disabled.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-07 18:28:05 +02:00
e4e5b7d461 Make test requirements reproducible
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2024-03-07 18:28:04 +02:00
e0edd5dac1 Fix package installation
Signed-off-by: Brett Calliss <brett@obligatory.email>
2024-02-25 01:25:28 +03:00
831caa6276 remove recursion 2024-02-06 00:23:14 +03:00
9ac33392a0 Fix issue #831
Signed-off-by: Ben Plessinger <Benjamin.Plessinger@roswellpark.org>
2024-02-06 00:20:11 +03:00
c5be5bae90 Fixup tests
Signed-off-by: Falmarri <463948+Falmarri@users.noreply.github.com>
2024-02-04 10:11:57 +03:00
c6a1c4c432 Add tests to make sure all async paths are covered
Not at 100% yet. But upped code coverage significantly and covered major
async calls.

Signed-off-by: Falmarri <463948+Falmarri@users.noreply.github.com>
2024-02-04 10:11:57 +03:00
3c9628b462 Fix a couple issues and update docs
Signed-off-by: Falmarri <463948+Falmarri@users.noreply.github.com>
2024-02-04 10:11:57 +03:00
38b13a34ea Use asyncio for subprocess calls
Removes the threads from compose_up and manages it using async. Also
uses async processing to format the log messages instead of piping
through sed. This should work on windows without having sed installed

Adds --parallel to support pull and build in parallel, same as docker
compose

Signed-off-by: Falmarri <463948+Falmarri@users.noreply.github.com>
2024-02-04 10:11:57 +03:00
bce40c2db3 Change "an key-value" to "a key-value" 2023-08-08 18:05:58 +03:00
78f8cad7c4 Fix typos
Found via `codespell -L poped`
2023-08-08 18:05:25 +03:00
7942a540cd fix styling errors
Signed-off-by: Mohammed Tayeh <m.tayeh94@gmail.com>
2023-08-08 18:05:02 +03:00
cb9cf6002f add stats command
Signed-off-by: Mohammed Tayeh <info@tayeh.me>
2023-08-08 18:05:02 +03:00
06587c1dca rm redundant tests
Signed-off-by: Evedel <svbiriukov@gmail.com>
2023-08-02 14:19:15 +03:00
bc9168b039 add no-normalize flag
Signed-off-by: Evedel <svbiriukov@gmail.com>
2023-08-02 14:19:15 +03:00
57c527c2c9 add edits from review
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-08-02 14:19:15 +03:00
d1f5ac9edc convert build context path to absolute during final normalisation
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-08-02 14:19:15 +03:00
0164c1db56 Simplify the fix using or.
Signed-off-by: Natanael Arndt <arndtn@gmail.com>
2023-07-26 17:32:14 +03:00
e5cdce4e7d default to an empty dict for the from service if the service is None
Signed-off-by: Natanael Arndt <arndtn@gmail.com>
2023-07-26 17:32:14 +03:00
280f1770bf Add a test to extend using an empty service (placeholder)
Signed-off-by: Natanael Arndt <arndtn@gmail.com>
2023-07-26 17:32:14 +03:00
f75d12af21 broken in py 3.7 2023-07-18 13:23:55 +03:00
5454c3ad0f Add 'links' aliases to container aliases
Signed-off-by: Hedayat Vatankhah <hedayat.fwd@gmail.com>
2023-07-18 13:14:57 +03:00
901adf47d0 Use defined environment variables in the image build process
Build images with service environment variables defined so that they can be
used in the build process

Signed-off-by: Hedayat Vatankhah <hedayat.fwd@gmail.com>
2023-07-18 13:13:33 +03:00
bf07e91163 Implement include from compose-spec
Signed-off-by: Mahmoud Abduljawad <mahmoud@masaar.com>
2023-07-18 13:05:46 +03:00
c31b4e2816 Fixes #723: merge short & long syntax of depends_on dependencies
Signed-off-by: Hedayat Vatankhah <hedayat.fwd@gmail.com>
2023-07-08 04:10:43 +03:30
3890eacf57 Merge branch 'Evedel-allow-config-to-merge-strings-and-dicts-in-build' into devel 2023-05-29 11:47:41 +03:00
cfd24cc2e8 Merge branch 'devel' into allow-config-to-merge-strings-and-dicts-in-build
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-05-06 18:14:44 +10:00
79bfad103c move logic from rec_merge to normalize_service
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-05-06 10:42:44 +03:00
d1509468c3 allow empty list to be a command/entrypoint
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-05-06 10:42:44 +03:00
9011e9faa1 add tests, dry up code, use shlex.split instead of str.split
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-05-06 10:42:44 +03:00
517aeba330 Allow config to merge strings and lists in command and entrypoint
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-05-06 10:42:44 +03:00
85d5d5dcc9 move logic from rec_merge to normalize_service
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-05-06 15:17:54 +10:00
1ffd24dcf9 Python version support: sync verified and advertised versions
There are differences with regards to the versions of Python that are
verified (somehow) through Pylint, and the ones that are advertised.

Given that there's no pinning of Pylint versions, it shouldn't be
possible to use it on Python versions such as 3.5 and 3.6 (latest
Pylint doesn't support those).  With that, let's cover all the
currently supported Python versions.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
2023-05-06 00:28:13 +03:00
8c66b1cda7 add test case for when build is a complex dictionary
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-04-30 15:37:52 +10:00
a0005db474 add code implementing build value merge
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-04-29 13:52:19 +10:00
221cf14501 add tests for build value merge
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-04-29 13:17:43 +10:00
a61945b516 fix format
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-04-21 20:47:53 +03:00
6b6330c587 add build subcommand and --build arg to compose_run
Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
2023-04-21 20:47:53 +03:00
5d279c4948 Build-fail test example
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-12 22:25:33 +03:00
5a3bdbf89b Exit code managed at PodmanCompose.run()
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-12 22:25:33 +03:00
1eb166445b Linting fixes
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-12 22:25:33 +03:00
82182b7bc6 Finish execution in compose_build only on command=build calls
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-12 22:25:33 +03:00
3f4618866b Update project-1.env 2023-04-10 14:14:14 +03:00
91bc6ebdb4 Keep chdir after loading env file
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 14:14:14 +03:00
59a59c1a3a Fixes #636: env-file shall be resolved relative to the CWD
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 14:14:14 +03:00
620f5d7473 pre-commit black config: run in check only mode
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 14:13:00 +03:00
6f902faed0 Fix linting issues
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 14:12:32 +03:00
ccdf01e9b0 Revert "Use SELinux mount flag for secrets"
This reverts commit 874192568f.
2023-04-10 12:26:53 +03:00
e6b1eabe4c Revert "Use more lenient SELinux mount flag for secrets"
This reverts commit 75de39c239.
2023-04-10 12:26:53 +03:00
75de39c239 Use more lenient SELinux mount flag for secrets
Signed-off-by: Henry Reed <60915078+henryreed@users.noreply.github.com>
2023-04-10 12:25:53 +03:00
874192568f Use SELinux mount flag for secrets
Signed-off-by: Henry Reed <github.69ofd@simplelogin.com>
2023-04-10 12:25:53 +03:00
0b853f29f4 Ignore access mode when merging volumes short syntax
The target path inside the container is treated as a key. Ref:
https://github.com/compose-spec/compose-spec/blob/master/spec.md#merging-service-definitions

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
2023-04-10 12:25:05 +03:00
847f01a6c6 Add a docker-compose test file for uidmaps/gidmaps
Add a simple docker-compose.yml test to use the x-podman extension with
uidmaps and gitmaps
2023-04-10 12:22:25 +03:00
e511e6420f FIXES #228: Add support for uidmap and gidmap
Implement an x-podman extension on the level of the individual services
to handle `--uidmap` and `--gidmap`
2023-04-10 12:22:25 +03:00
a9723ec1cf Added a way to start containers with multiple ips and nets
Signed-off-by: KuhnChris <kuhnchris@kuhnchris.eu>
2023-04-10 12:16:54 +03:00
1cb608d8a7 allow project name to be fetched from dotenv
Look for project name in `self.environ` which includes both `os.environ`
and dotenv variables so that the project name can also be defined in an
environment file.

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
2023-04-10 12:13:23 +03:00
252f1d57a5 updating black formatting for podman-compose.py
Signed-off-by: Dixon Whitmire <dixonwh@gmail.com>
2023-04-10 12:12:18 +03:00
13856d2e9c updating black formatting
Signed-off-by: Dixon Whitmire <dixonwh@gmail.com>
2023-04-10 12:12:18 +03:00
8d8df0bc28 Adding basic support for --profile argument
Signed-off-by: Dixon Whitmire <dixonwh@gmail.com>
2023-04-10 12:12:18 +03:00
bc5f0123d9 add option to start podman in existing network namespace 2023-04-10 12:11:02 +03:00
9a08f85ffd FIXES #586: preserve exit code for podman-compose build
Signed-off-by: Roman Blanco <rblanco@redhat.com>
2023-04-10 12:10:16 +03:00
8625d7a4e8 add ipam-driver support
Signed-off-by: Benedikt Braunger <bb@emlix.com>
2023-04-10 12:02:47 +03:00
016c97fd1e Fixes #663 - Fixes linting/pylint errors
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 11:53:47 +03:00
2df11674c4 Fixes #661 - Fixes linting/flake8 errors
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 11:53:47 +03:00
5eff38e743 Fixes #659: fix permissions when installing OS packages for linting/black
Signed-off-by: BugFest <bugfest.dev@pm.me>
2023-04-10 11:28:07 +03:00
7f5ce26b1b start version 1.0.7 and default with pod enabled by default 2023-04-09 14:08:54 +03:00
227 changed files with 9113 additions and 1309 deletions

1
.codespellignore Normal file
View File

@ -0,0 +1 @@
assertIn

4
.codespellrc Normal file
View File

@ -0,0 +1,4 @@
[codespell]
skip = .git,*.pdf,*.svg,requirements.txt,test-requirements.txt
# poped - loved variable name
ignore-words-list = poped

2
.coveragerc Normal file
View File

@ -0,0 +1,2 @@
[run]
parallel=True

19
.editorconfig Normal file
View File

@ -0,0 +1,19 @@
root = true
[*]
indent_style = space
indent_size = tab
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[*.py]
indent_style = space

View File

@ -13,8 +13,6 @@ A clear and concise description of what the bug is.
Please make sure it's not a bug in podman (in that case report it to podman)
or your understanding of docker-compose or how rootless containers work (for example, it's normal for rootless container not to be able to listen for port less than 1024 like 80)
please try to reproduce the bug in latest devel branch
**To Reproduce**
Steps to reproduce the behavior:
1. what is the content of the current working directory (ex. `docker-compose.yml`, `.env`, `Dockerfile`, ...etc.)

10
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,10 @@
## Contributor Checklist:
If this PR adds a new feature that improves compatibility with docker-compose, please add a link
to the exact part of compose spec that the PR touches.
For any user-visible change please add a release note to newsfragments directory, e.g.
newsfragments/my_feature.feature. See newsfragments/README.md for more details.
All changes require additional unit tests.

22
.github/workflows/codespell.yml vendored Normal file
View File

@ -0,0 +1,22 @@
---
name: Codespell
on:
push:
pull_request:
permissions:
contents: read
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
ignore_words_file: .codespellignore

View File

@ -1,41 +0,0 @@
name: Pylint
on:
- push
- pull_request
jobs:
lint-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install psf/black requirements
run: |
apt-get update
apt-get install -y python3 python3-venv
- uses: psf/black@stable
with:
options: "--check --verbose"
version: "~= 23.3"
lint-pylint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pylint
- name: Analysing the code with pylint
run: |
python -m compileall podman_compose.py
pylint podman_compose.py
# pylint $(git ls-files '*.py')

View File

@ -1,36 +0,0 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: PyTest
on:
push:
branches: [ devel ]
pull_request:
branches: [ devel ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest ./pytests

27
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Build and Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build binary
run: |
mkdir -p release/
docker build -t podman-compose-bin -v "$PWD/release:/result" .
mv "$PWD/release/podman-compose" "$PWD/release/podman-compose-linux-x86"
- name: Upload release asset
uses: softprops/action-gh-release@v2
with:
files: ./release/podman-compose-linux-x86
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

25
.github/workflows/static-checks.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Static checks
on:
- push
- pull_request
jobs:
static-checks:
runs-on: ubuntu-latest
container:
image: docker.io/library/python:3.11-bookworm
# cgroupns needed to address the following error:
# write /sys/fs/cgroup/cgroup.subtree_control: operation not supported
options: --privileged --cgroupns=host
steps:
- uses: actions/checkout@v4
- name: Analysing the code with ruff
run: |
set -e
pip install -r test-requirements.txt
ruff format --check
ruff check
- name: Analysing the code with pylint
run: |
pylint podman_compose.py

40
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Tests
on:
push:
pull_request:
jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
runs-on: ubuntu-latest
container:
image: "docker.io/library/python:${{ matrix.python-version }}-bookworm"
# cgroupns needed to address the following error:
# write /sys/fs/cgroup/cgroup.subtree_control: operation not supported
options: --privileged --cgroupns=host
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
set -e
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y podman
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Run integration tests
run: |
python -m unittest discover -v tests/integration
env:
TESTS_DEBUG: 1
- name: Run unit tests
run: |
coverage run --source podman_compose -m unittest discover tests/unit
- name: Report coverage
run: |
coverage combine
coverage report --format=markdown | tee -a $GITHUB_STEP_SUMMARY

5
.gitignore vendored
View File

@ -47,6 +47,8 @@ coverage.xml
*.cover
.hypothesis/
.pytest_cache/
test-compose.yaml
test-compose-?.yaml
# Translations
*.mo
@ -103,3 +105,6 @@ venv.bak/
# mypy
.mypy_cache/
.vscode

View File

@ -9,6 +9,9 @@ repos:
# https://pre-commit.com/#top_level-default_language_version
language_version: python3.10
types: [python]
args: [
"--check", # Don't apply changes automatically
]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
@ -27,3 +30,7 @@ repos:
"-sn", # Don't display the score
"--rcfile=.pylintrc", # Link to your config file
]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell

View File

@ -1,114 +1,135 @@
# Contributing to podman-compose
## Who can contribute?
## Who can contribute?
- Users that found a bug
- Users that wants to propose new functionalities or enhancements
- Users that want to help other users to troubleshoot their environments
- Developers that want to fix bugs
- Developers that want to implement new functionalities or enhancements
## Branches
Please request your PR to be merged into the `devel` branch.
Changes to the `stable` branch are managed by the repository maintainers.
- Users that found a bug,
- Users that want to propose new functionalities or enhancements,
- Users that want to help other users to troubleshoot their environments,
- Developers that want to fix bugs,
- Developers that want to implement new functionalities or enhancements.
## Development environment setup
Note: Some steps are OPTIONAL but all are RECOMMENDED.
1. Fork the project repo and clone it
```shell
$ git clone https://github.com/USERNAME/podman-compose.git
$ cd podman-compose
```
1. (OPTIONAL) Create a python virtual environment. Example using [virtualenv wrapper](https://virtualenvwrapper.readthedocs.io/en/latest/):
```shell
mkvirtualenv podman-compose
```
2. Install the project runtime and development requirements
```shell
$ pip install '.[devel]'
```
3. (OPTIONAL) Install `pre-commit` git hook scripts (https://pre-commit.com/#3-install-the-git-hook-scripts)
```shell
$ pre-commit install
```
4. Create a new branch, develop and add tests when possible
5. Run linting & testing before commiting code. Ensure all the hooks are passing.
```shell
$ pre-commit run --all-files
```
6. Commit your code to your fork's branch.
- Make sure you include a `Signed-off-by` message in your commits. Read [this guide](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) to learn how to sign your commits
- In the commit message reference the Issue ID that your code fixes and a brief description of the changes. Example: `Fixes #516: allow empty network`
7. Open a PR to `containers/podman-compose:devel` and wait for a maintainer to review your work.
1. Fork the project repository and clone it:
```shell
$ git clone https://github.com/USERNAME/podman-compose.git
$ cd podman-compose
```
2. (OPTIONAL) Create a Python virtual environment. Example using
[virtualenv wrapper](https://virtualenvwrapper.readthedocs.io/en/latest/):
```shell
$ mkvirtualenv podman-compose
```
3. Install the project runtime and development requirements:
```shell
$ pip install '.[devel]'
```
4. (OPTIONAL) Install `pre-commit` git hook scripts
(https://pre-commit.com/#3-install-the-git-hook-scripts):
```shell
$ pre-commit install
```
5. Create a new branch, develop and add tests when possible.
6. Run linting and testing before committing code. Ensure all the hooks are passing.
```shell
$ pre-commit run --all-files
```
7. Run code coverage:
```shell
$ coverage run --source podman_compose -m unittest discover tests/unit
$ python3 -m unittest discover tests/integration
$ coverage combine
$ coverage report
$ coverage html
```
8. Commit your code to your fork's branch.
- Make sure you include a `Signed-off-by` message in your commits.
Read [this guide](https://github.com/containers/common/blob/main/CONTRIBUTING.md#sign-your-prs)
to learn how to sign your commits.
- In the commit message, reference the Issue ID that your code fixes and a brief description of
the changes.
Example: `Fixes #516: Allow empty network`
9. Open a pull request to `containers/podman-compose` and wait for a maintainer to review your work.
## Adding new commands
To add a command you need to add a function that is decorated
with `@cmd_run` passing the compose instance, command name and
description. the wrapped function should accept two arguments
the compose instance and the command-specific arguments (resulted
from python's `argparse` package) inside that command you can
run PodMan like this `compose.podman.run(['inspect', 'something'])`
and inside that function you can access `compose.pods`
and `compose.containers` ...etc.
Here is an example
To add a command, you need to add a function that is decorated with `@cmd_run`.
```
The decorated function must be declared `async` and should accept two arguments: The compose
instance and the command-specific arguments (resulted from the Python's `argparse` package).
In this function, you can run Podman (e.g. `await compose.podman.run(['inspect', 'something'])`),
access `compose.pods`, `compose.containers` etc.
Here is an example:
```python
@cmd_run(podman_compose, 'build', 'build images defined in the stack')
def compose_build(compose, args):
compose.podman.run(['build', 'something'])
async def compose_build(compose, args):
await compose.podman.run(['build', 'something'])
```
## Command arguments parsing
Add a function that accept `parser` which is an instance from `argparse`.
In side that function you can call `parser.add_argument()`.
The function decorated with `@cmd_parse` accepting the compose instance,
and command names (as a list or as a string).
You can do this multiple times.
To add arguments to be parsed by a command, you need to add a function that is decorated with
`@cmd_parse` which accepts the compose instance and the command's name (as a string list or as a
single string).
Here is an example
The decorated function should accept a single argument: An instance of `argparse`.
```
In this function, you can call `parser.add_argument()` to add a new argument to the command.
Note you can add such a function multiple times.
Here is an example:
```python
@cmd_parse(podman_compose, 'build')
def compose_build_parse(parser):
parser.add_argument("--pull",
help="attempt to pull a newer version of the image", action='store_true')
parser.add_argument("--pull-always",
help="attempt to pull a newer version of the image, Raise an error even if the image is present locally.", action='store_true')
help="Attempt to pull a newer version of the image, "
"raise an error even if the image is present locally.",
action='store_true')
```
NOTE: `@cmd_parse` should be after `@cmd_run`
NOTE: `@cmd_parse` should be after `@cmd_run`.
## Calling a command from inside another
## Calling a command from another one
If you need to call `podman-compose down` from inside `podman-compose up`
do something like:
If you need to call `podman-compose down` from `podman-compose up`, do something like:
```
```python
@cmd_run(podman_compose, 'up', 'up desc')
def compose_up(compose, args):
compose.commands['down'](compose, args)
async def compose_up(compose, args):
await compose.commands['down'](compose, args)
# or
compose.commands['down'](argparse.Namespace(foo=123))
await compose.commands['down'](argparse.Namespace(foo=123))
```
## Missing Commands (help needed)
```
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
events Receive real time events from containers
images List images
logs View output from containers
port Print the public port for a port binding
ps List containers
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
top Display the running processes
```

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
# Use a base image with necessary build tools
FROM python:3.11-slim AS builder
# Install required packages for building
RUN apt-get update && apt-get install -y \
gcc \
musl-dev \
build-essential \
python3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy the application code
COPY . .
# Install PyInstaller
RUN pip install pyinstaller
RUN pip install -r requirements.txt
# Create a binary with PyInstaller
RUN pyinstaller --onefile --clean podman_compose.py
# Create /result dir in case it is not mounted
RUN mkdir -p /result
# Export binary
RUN cp /app/dist/podman_compose /result/podman-compose

View File

@ -1,6 +1,5 @@
# Podman Compose
## [![Pylint Test: ](https://github.com/containers/podman-compose/actions/workflows/pylint.yml/badge.svg)](https://github.com/containers/podman-compose/actions/workflows/pylint.yml) [![Unit tests PyTest](https://github.com/containers/podman-compose/actions/workflows/pytest.yml/badge.svg)](https://github.com/containers/podman-compose/actions/workflows/pytest.yml)
## [![Tests](https://github.com/containers/podman-compose/actions/workflows/test.yml/badge.svg)](https://github.com/containers/podman-compose/actions/workflows/test.yml)
An implementation of [Compose Spec](https://compose-spec.io/) with [Podman](https://podman.io/) backend.
This project focuses on:
@ -11,7 +10,11 @@ This project focuses on:
This project only depends on:
* `podman`
* [podman dnsname plugin](https://github.com/containers/dnsname): It is usually found in the `podman-plugins` or `podman-dnsname` distro packages, those packages are not pulled by default and you need to install them. This allows containers to be able to resolve each other if they are on the same CNI network.
* [podman dnsname plugin](https://github.com/containers/dnsname): It is usually found in
the `podman-plugins` or `podman-dnsname` distro packages, those packages are not pulled
by default and you need to install them. This allows containers to be able to resolve
each other if they are on the same CNI network. This is not necessary when podman is using
netavark as a network backend.
* Python3
* [PyYAML](https://pyyaml.org/)
* [python-dotenv](https://pypi.org/project/python-dotenv/)
@ -49,9 +52,11 @@ like `hostnet`. If you desire that behavior, pass it the standard way like `netw
## Installation
### Pip
Install the latest stable version from PyPI:
```
```bash
pip3 install podman-compose
```
@ -59,14 +64,39 @@ pass `--user` to install inside regular user home without being root.
Or latest development version from GitHub:
```
pip3 install https://github.com/containers/podman-compose/archive/devel.tar.gz
```bash
pip3 install https://github.com/containers/podman-compose/archive/main.tar.gz
```
### Homebrew
```bash
brew install podman-compose
```
### Generate binary using docker/podman locally
This script will download the repo, generate the binary using [this Dockerfile](https://github.com/containers/podman-compose/blob/main/Dockerfile), and place the binary in the directory where you called this script.
```bash
sh -c "$(curl -sSL https://raw.githubusercontent.com/containers/podman-compose/main/scripts/download_and_build_podman-compose.sh)"
```
### Manual
```bash
curl -o /usr/local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/main/podman_compose.py
chmod +x /usr/local/bin/podman-compose
```
or inside your home
```bash
curl -o ~/.local/bin/podman-compose https://raw.githubusercontent.com/containers/podman-compose/main/podman_compose.py
chmod +x ~/.local/bin/podman-compose
```
or install from Fedora (starting from f31) repositories:
```
```bash
sudo dnf install podman-compose
```
@ -75,10 +105,9 @@ sudo dnf install podman-compose
We have included fully functional sample stacks inside `examples/` directory.
You can get more examples from [awesome-compose](https://github.com/docker/awesome-compose).
A quick example would be
```
```bash
cd examples/busybox
podman-compose --help
podman-compose up --help
@ -103,11 +132,11 @@ There is also AWX 17.1.0
Inside `tests/` directory we have many useless docker-compose stacks
that are meant to test as many cases as we can to make sure we are compatible
### Unit tests with pytest
run a pytest with following command
### Unit tests with unittest
run a unittest with following command
```shell
python -m pytest pytests
python3 -m unittest discover tests/unit
```
# Contributing guide

47
RELEASING.md Normal file
View File

@ -0,0 +1,47 @@
Creating a release
==================
This file contains instructions for maintainers on how to release new versions of podman-compose.
Step 1: Initialize variables for subsequent steps
-------------------------------------------------
```
export VERSION=1.2.3
```
Step 2: Release notes PR
------------------------
Open a new branch (e.g. `release`) and run the following:
```
./scripts/make_release_notes.sh $VERSION
```
This collects the release notes using the `towncrier` tool and then commits the result.
This step is done as a PR so that CI can check for spelling errors and similar issues.
Certain file names are not properly supported by the `towncrier` tool and it ignores them.
Check `newsfragments` directory for any forgotten release notes
Step 3: Merge the release notes PR
----------------------------------
Step 4: Perform actual release
------------------------------
Pull the merge commit created on the `main` branch during the step 2.
Then run:
```
./scripts/make_release.sh
```
This will create release commit, tag and push everything.
Step 5: Create a release on Github
----------------------------------
The release notes must be added manually by drafting a release on the GitHub UI at
https://github.com/containers/podman-compose/releases.

33
docs/Changelog-1.1.0.md Normal file
View File

@ -0,0 +1,33 @@
Version v1.1.0 (2024-04-17)
===========================
Bug fixes
---------
- Fixed support for values with equals sign in `-e` argument of `run` and `exec` commands.
- Fixed duplicate arguments being emitted in `stop` and `restart` commands.
- Removed extraneous debug output. `--verbose` flag has been added to preserve verbose output.
- Links aliases are now added to service aliases.
- Fixed image build process to use defined environmental variables.
- Empty list is now allowed to be `COMMAND` and `ENTRYPOINT`.
- Environment files are now resolved relative to current working directory.
- Exit code of container build is now preserved as return code of `build` command.
New features
------------
- Added support for `uidmap`, `gidmap`, `http_proxy` and `runtime` service configuration keys.
- Added support for `enable_ipv6` network configuration key.
- Added `--parallel` option to support parallel pulling and building of images.
- Implemented support for maps in `sysctls` container configuration key.
- Implemented `stats` command.
- Added `--no-normalize` flag to `config` command.
- Added support for `include` global configuration key.
- Added support for `build` command.
- Added support to start containers with multiple networks.
- Added support for `profile` argument.
- Added support for starting podman in existing network namespace.
- Added IPAM driver support.
- Added support for file secrets being passed to `podman build` via `--secret` argument.
- Added support for multiple networks with separately specified IP and MAC address.
- Added support for `service.build.ulimits` when building image.

40
docs/Changelog-1.2.0.md Normal file
View File

@ -0,0 +1,40 @@
Version v1.2.0 (2024-06-26)
===========================
Bug fixes
---------
- Fixed handling of `--in-pod` argument. Previously it was hard to provide false value to it.
- podman-compose no longer creates pods when registering systemd unit.
- Fixed warning `RuntimeWarning: coroutine 'create_pods' was never awaited`
- Fixed error when setting up IPAM network with default driver.
- Fixed support for having list and dictionary `depends_on` sections in related compose files.
- Fixed logging of failed build message.
- Fixed support for multiple entries in `include` section.
- Fixed environment variable precedence order.
Changes
-------
- `x-podman` dictionary in container root has been migrated to `x-podman.*` fields in container root.
New features
------------
- Added support for `--publish` in `podman-compose run`.
- Added support for Podman external root filesystem management (`--rootfs` option).
- Added support for `podman-compose images` command.
- Added support for `env_file` being configured via dictionaries.
- Added support for enabling GPU access.
- Added support for selinux in verbose mount specification.
- Added support for `additional_contexts` section.
- Added support for multi-line environment files.
- Added support for passing contents of `podman-compose.yml` via stdin.
- Added support for specifying the value for `--in-pod` setting in `podman-compose.yml` file.
- Added support for environmental secrets.
Documentation
-------------
- Added instructions on how to install podman-compose on Homebrew.
- Added explanation that netavark is an alternative to dnsname plugin

38
docs/Changelog-1.3.0.md Normal file
View File

@ -0,0 +1,38 @@
Version 1.3.0 (2025-01-07)
==========================
Bug fixes
---------
- Fixed support for de-facto alternative `Dockerfile` names (e.g. `Containerfile`)
- Fixed a bug that caused attempts to create already existing pods multiple times.
- Fixed compatibility with docker-compose in how symlinks to docker-compose.yml are handled.
- Fixed freeze caused by too long log lines without a newline.
- Fixed support for `network_mode: none`.
- Improved error detection by rejecting service definitions that contain both `network_mode` and
`networks` keys, which is not allowed.
Features
--------
- Added support for build labels.
- Added support for "platform" property in the build command.
- Added support for "ssh" property in the build command.
- Added support for cache_from and cache_to fields in build section.
- Added support for honoring the condition in the depends_on section of the service, if stated.
- Added `x-podman.no_hosts` setting to pass `--no-hosts` to podman run
- Added support for compatibility with docker compose for default network behavior when no network
defined in service. This is controlled via `default_net_behavior_compat` feature flag.
- Added a way to get compatibility of default network names with docker compose.
This is selected by setting `default_net_name_compat: true` on `x-podman` global dictionary.
- Added support for the `device_cgroup_rules` property in services.
- Added support for removing networks in `podman-compose down`.
- Added support for network scoped service aliases.
- Added support for network level `mac_address` attribute.
- Added ability to substitute variables with the environment of the service.
Misc
----
- Declared compatibility with Python 3.13.

156
docs/Extensions.md Normal file
View File

@ -0,0 +1,156 @@
# Podman specific extensions to the docker-compose format
Podman-compose supports the following extension to the docker-compose format. These extensions
are generally specified under fields with "x-podman" prefix in the compose file.
## Container management
The following extension keys are available under container configuration:
* `x-podman.uidmaps` - Run the container in a new user namespace using the supplied UID mapping.
* `x-podman.gidmaps` - Run the container in a new user namespace using the supplied GID mapping.
* `x-podman.rootfs` - Run the container without requiring any image management; the rootfs of the
container is assumed to be managed externally.
* `x-podman.no_hosts` - Run the container without creating /etc/hosts file
For example, the following docker-compose.yml allows running a podman container with externally managed rootfs.
```yml
version: "3"
services:
my_service:
command: ["/bin/busybox"]
x-podman.rootfs: "/path/to/rootfs"
```
For explanations of these extensions, please refer to the [Podman Documentation](https://docs.podman.io/).
## Per-network MAC-addresses
Generic docker-compose files support specification of the MAC address on the container level. If the
container has multiple network interfaces, the specified MAC address is applied to the first
specified network.
Podman-compose in addition supports the specification of MAC addresses on a per-network basis. This
is done by adding a `x-podman.mac_address` key to the network configuration in the container. The
value of the `x-podman.mac_address` key is the MAC address to be used for the network interface.
Note that the [compose spec](https://github.com/compose-spec/compose-spec/blob/main/05-services.md#mac_address)
now supports `mac_address` on the network level, so we recommend using
the standard `mac_address` key for setting the MAC address. The
`x-podman.mac_address` is still supported for backwards compatibility.
Specifying a MAC address for the container and for individual networks at the same time is not
supported.
Example:
```yaml
---
version: "3"
networks:
net0:
driver: "bridge"
ipam:
config:
- subnet: "192.168.0.0/24"
net1:
driver: "bridge"
ipam:
config:
- subnet: "192.168.1.0/24"
services:
webserver
image: "busybox"
command: ["/bin/busybox", "httpd", "-f", "-h", "/etc", "-p", "8001"]
networks:
net0:
ipv4_address: "192.168.0.10"
x-podman.mac_address: "02:aa:aa:aa:aa:aa"
net1:
ipv4_address: "192.168.1.10"
mac_address: "02:bb:bb:bb:bb:bb" # mac_address is supported
```
## Podman-specific network modes
Generic docker-compose supports the following values for `network-mode` for a container:
- `bridge`
- `host`
- `none`
- `service`
- `container`
In addition, podman-compose supports the following podman-specific values for `network-mode`:
- `slirp4netns[:<options>,...]`
- `ns:<options>`
- `pasta[:<options>,...]`
- `private`
The options to the network modes are passed to the `--network` option of the `podman create` command
as-is.
## Compatibility of default network names between docker-compose and podman-compose
Current versions of podman-compose may produce different default external network names than
docker-compose under certain conditions. Specifically, docker-compose removes dashes (`-` character)
from project name.
To enable compatibility between docker-compose and podman-compose, specify
`default_net_name_compat: true` under global `x-podman` key:
```
x-podman:
default_net_name_compat: true
```
By default `default_net_name_compat` is `false`. This will change to `true` at some point and the
setting will be removed.
## Compatibility of default network behavior between docker-compose and podman-compose
When there is no network defined (neither network-mode nor networks) in service,
The behavior of default network in docker-compose and podman-compose are different.
| Top-level networks | podman-compose | docker-compose |
| ------------------------------ | -------------------------- | -------------- |
| No networks | default | default |
| One network named net0 | net0 | default |
| Two networks named net0, net1 | podman(`--network=bridge`) | default |
| Contains network named default | default | default |
To enable compatibility between docker-compose and podman-compose, specify
`default_net_behavior_compat: true` under global `x-podman` key:
```yaml
x-podman:
default_net_behavior_compat: true
```
## Custom pods management
Podman-compose can have containers in pods. This can be controlled by extension key x-podman in_pod.
It allows providing custom value for --in-pod and is especially relevant when --userns has to be set.
For example, the following docker-compose.yml allows using userns_mode by overriding the default
value of --in-pod (unless it was specifically provided by "--in-pod=True" in command line interface).
```yml
version: "3"
services:
cont:
image: nopush/podman-compose-test
userns_mode: keep-id:uid=1000
command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-p", "8080"]
x-podman:
in_pod: false
```

View File

@ -1,7 +1,7 @@
---
- name: Manage AWX Container Images
block:
- name: Export Docker awx image if it isnt local and there isnt a registry defined
- name: Export Docker awx image if it isn't local and there isn't a registry defined
docker_image:
name: "{{ awx_image }}"
tag: "{{ awx_version }}"

View File

@ -7,6 +7,6 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "-m", "App.web" ]
CMD [ "python", "-m", "app.web" ]
EXPOSE 8080

View File

@ -1,5 +1,7 @@
# pylint: disable=import-error
# pylint: disable=unused-import
import asyncio # noqa: F401
import os
import asyncio
import aioredis
from aiohttp import web
@ -14,13 +16,13 @@ routes = web.RouteTableDef()
@routes.get("/")
async def hello(request):
async def hello(request): # pylint: disable=unused-argument
counter = await redis.incr("mycounter")
return web.Response(text=f"counter={counter}")
@routes.get("/hello.json")
async def hello_json(request):
async def hello_json(request): # pylint: disable=unused-argument
counter = await redis.incr("mycounter")
data = {"counter": counter}
return web.json_response(data)

View File

@ -0,0 +1,11 @@
services:
test:
image: nvidia/cuda:12.3.1-base-ubuntu20.04
command: nvidia-smi
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

13
newsfragments/README.txt Normal file
View File

@ -0,0 +1,13 @@
This is the directory for news fragments used by towncrier: https://github.com/hawkowl/towncrier
You create a news fragment in this directory when you make a change, and the file gets removed from
this directory when the news is published.
towncrier has a few standard types of news fragments, signified by the file extension. These are:
.feature: Signifying a new feature.
.bugfix: Signifying a bug fix.
.doc: Signifying a documentation improvement.
.removal: Signifying a deprecation or removal of public API.
.change: Signifying a change of behavior
.misc: Miscellaneous change

File diff suppressed because it is too large Load Diff

55
pyproject.toml Normal file
View File

@ -0,0 +1,55 @@
[tool.ruff]
line-length = 100
target-version = "py38"
[tool.ruff.lint]
select = ["W", "E", "F", "I"]
ignore = [
]
[tool.ruff.lint.isort]
force-single-line = true
[tool.ruff.format]
preview = true # needed for quote-style
quote-style = "preserve"
[tool.towncrier]
package = "podman_compose"
package_dir = "master"
directory = "newsfragments"
filename = "docs/Changelog-new.md"
template = "scripts/Changelog-template.jinja"
title_format = "Version {version} ({project_date})"
[[tool.towncrier.section]]
path = ""
[[tool.towncrier.type]]
directory = "feature"
name = "Features"
showcontent = true
[[tool.towncrier.type]]
directory = "change"
name = "Changes"
showcontent = true
[[tool.towncrier.type]]
directory = "bugfix"
name = "Bug fixes"
showcontent = true
[[tool.towncrier.type]]
directory = "doc"
name = "Improved Documentation"
showcontent = true
[[tool.towncrier.type]]
directory = "removal"
name = "Deprecations and Removals"
showcontent = true
[[tool.towncrier.type]]
directory = "misc"
name = "Misc"
showcontent = true

View File

@ -1,20 +0,0 @@
import pytest
from podman_compose import parse_short_mount
@pytest.fixture
def multi_propagation_mount_str():
return "/foo/bar:/baz:U,Z"
def test_parse_short_mount_multi_propagation(multi_propagation_mount_str):
expected = {
"type": "bind",
"source": "/foo/bar",
"target": "/baz",
"bind": {
"propagation": "U,Z",
},
}
assert parse_short_mount(multi_propagation_mount_str, "/") == expected

View File

@ -0,0 +1,33 @@
{% for section, _ in sections|dictsort(by='key') %}
{% set underline = "-" %}
{% if section %}
{{section}}
{{ underline * section|length }}{% set underline = "~" %}
{% endif %}
{% if sections[section] %}
{% for category, val in definitions|dictsort if category in sections[section]%}
{{ definitions[category]['name'] }}
{{ underline * definitions[category]['name']|length }}
{% for text, values in sections[section][category]|dictsort(by='value') %}
- {{ text }}
{% endfor %}
{% if sections[section][category]|length == 0 %}
No significant changes.
{% else %}
{% endif %}
{% endfor %}
{% else %}
No significant changes.
{% endif %}
{% endfor %}
(venv) p12@exec-desktop:~/cod

View File

@ -0,0 +1,16 @@
#!/bin/sh
# Delete repository dir
rm -rf podman-compose-src
# Clone repository
git clone https://github.com/containers/podman-compose podman-compose-src
# Generate binary
sh podman-compose-src/scripts/generate_binary_using_dockerfile.sh
# Move binary outside repo's dir
mv podman-compose-src/podman-compose .
# Delete repository dir
rm -rf podman-compose-src

View File

@ -0,0 +1,57 @@
#!/bin/sh
# Find an available container tool (docker or podman)
find_container_tool() {
if command -v docker > /dev/null 2>&1; then
echo "sudo docker"
elif command -v podman > /dev/null 2>&1; then
echo "podman"
else
echo "Error: Neither docker nor podman is available." >&2
exit 1
fi
}
# Determine which container tool to use
CONTAINER_TOOL=$(find_container_tool)
# Locate the directory containing dockerfile (root)
PROJECT_ROOT_DIR="$(cd "$(dirname "$0")" && pwd)/.."
# Check SELinux status and set appropriate mount option
check_selinux() {
if command -v getenforce > /dev/null 2>&1; then
SELINUX_STATUS=$(getenforce)
if [ "$SELINUX_STATUS" = "Enforcing" ] || [ "$SELINUX_STATUS" = "Permissive" ]; then
echo ":z"
else
echo ""
fi
elif [ -f /sys/fs/selinux/enforce ]; then
if [ "$(cat /sys/fs/selinux/enforce)" = "1" ]; then
echo ":z"
else
echo ""
fi
else
echo ""
fi
}
# Get the SELinux option for volume mounts if SELinux is enforcing or permissive
SELINUX=$(check_selinux)
# Build binary
$CONTAINER_TOOL image rm build-podman-compose
if expr "$CONTAINER_TOOL" : '.*docker.*' >/dev/null; then
$CONTAINER_TOOL build -t build-podman-compose "$PROJECT_ROOT_DIR"
$CONTAINER_TOOL run --name build-podman-compose build-podman-compose
$CONTAINER_TOOL cp build-podman-compose:/result/podman-compose "$PROJECT_ROOT_DIR/podman-compose"
$CONTAINER_TOOL container stop build-podman-compose
$CONTAINER_TOOL container rm -f build-podman-compose
else
$CONTAINER_TOOL build -v "$PROJECT_ROOT_DIR:/result$SELINUX" -t build-podman-compose "$PROJECT_ROOT_DIR"
fi
$CONTAINER_TOOL image rm python:3.11-slim
$CONTAINER_TOOL image rm build-podman-compose

View File

@ -1,6 +1,18 @@
#!/usr/bin/env bash
./scripts/uninstall.sh
./scripts/clean_up.sh
python3 setup.py register
python3 setup.py sdist bdist_wheel
twine upload dist/*
#!/bin/bash
set -e
if [ $# -ne 1 ]; then
echo "Usage: make_release.sh VERSION"
exit 1
fi
VERSION=$1
sed "s/__version__ = .*/__version__ = \"$VERSION\"/g" -i podman_compose.py
git add podman_compose.py
git commit -m "Release $VERSION"
git tag "v$VERSION" -m "v$VERSION" -s
git push ssh://github.com/containers/podman-compose main "v$VERSION"

14
scripts/make_release_notes.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
if [ $# -ne 1 ]; then
echo "Usage: make_release_notes.sh VERSION"
exit 1
fi
VERSION=$1
towncrier build --version "$VERSION" --yes
git mv "docs/Changelog-new.md" "docs/Changelog-$VERSION.md"
git add "newsfragments/"
git commit -m "Release notes for $VERSION"

6
scripts/make_release_upload.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
./scripts/uninstall.sh
./scripts/clean_up.sh
python3 setup.py register
python3 setup.py sdist bdist_wheel
twine upload dist/*

View File

@ -3,3 +3,7 @@ universal = 1
[metadata]
version = attr: podman_compose.__version__
[flake8]
# The GitHub editor is 127 chars wide
max-line-length=127

View File

@ -1,25 +1,27 @@
# SPDX-License-Identifier: GPL-2.0
import os
from setuptools import setup
try:
readme = open(os.path.join(os.path.dirname(__file__), "README.md")).read()
except:
readme = ""
README = open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8").read()
except: # noqa: E722 # pylint: disable=bare-except
README = ""
setup(
name="podman-compose",
description="A script to run docker-compose.yml using podman",
long_description=readme,
long_description=README,
long_description_content_type="text/markdown",
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Development Status :: 3 - Alpha",
@ -38,19 +40,10 @@ setup(
"pyyaml",
"python-dotenv",
],
extras_require={
"devel": [
"flake8",
"black",
"pylint",
"pre-commit",
]
}
extras_require={"devel": ["ruff", "pre-commit", "coverage", "parameterized"]},
# test_suite='tests',
# tests_require=[
# 'coverage',
# 'pytest-cov',
# 'pytest',
# 'tox',
# ]
)

View File

@ -1,9 +1,34 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
-e .
coverage==7.4.3
parameterized==0.9.0
pytest==8.0.2
tox==4.13.0
ruff==0.3.1
pylint==3.1.0
coverage
pytest-cov
pytest
tox
black
# The packages below are transitive dependencies of the packages above and are included here
# to make testing reproducible.
# To refresh, create a new virtualenv and do:
# pip install -r requirements.txt -r test-requirements.txt
# pip freeze > test-requirements.txt
# and edit test-requirements.txt to add this comment
astroid==3.1.0
cachetools==5.3.3
chardet==5.2.0
colorama==0.4.6
dill==0.3.8
distlib==0.3.8
filelock==3.13.1
iniconfig==2.0.0
isort==5.13.2
mccabe==0.7.0
packaging==23.2
platformdirs==4.2.0
pluggy==1.4.0
pyproject-api==1.6.1
python-dotenv==1.0.1
PyYAML==6.0.1
requests
tomlkit==0.12.4
virtualenv==20.25.1

View File

@ -1,25 +0,0 @@
# Test podman-compose with build
```
podman-compose build
podman-compose up -d
curl http://localhost:8080/index.txt
curl http://localhost:8000/index.txt
podman inspect my-busybox-httpd2
podman-compose down
```
expected output would be something like
```
2019-09-03T15:16:38+0000
ALT buildno=2 port 8000 2019-09-03T15:16:38+0000
{
...
}
```
as you can see we were able to override buildno to be 2 instead of 1,
and httpd_port to 8000.
NOTE: build labels are not passed to `podman build`

View File

@ -1,4 +0,0 @@
```
podman-compose run --rm sleep /bin/sh -c 'wget -O - http://localhost:8000/hosts'
```

View File

@ -1,24 +0,0 @@
version: "3.7"
services:
web:
image: busybox
command: ["/bin/busybox", "httpd", "-f", "-h", "/etc/", "-p", "8000"]
tmpfs:
- /run
- /tmp
sleep:
image: busybox
command: ["/bin/busybox", "sh", "-c", "sleep 3600"]
depends_on: "web"
tmpfs:
- /run
- /tmp
sleep2:
image: busybox
command: ["/bin/busybox", "sh", "-c", "sleep 3600"]
depends_on:
- sleep
tmpfs:
- /run
- /tmp

View File

@ -1,5 +0,0 @@
running the following command should give myval2
```
podman_compose run -l monkey -e ZZVAR1=myval2 env-test
```

View File

@ -1,15 +0,0 @@
We have service named sh1 that exits with code 1 and sh2 that exists with code 2
```
podman-compose up --exit-code-from=sh1
echo $?
```
the above should give 1.
```
podman-compose up --exit-code-from=sh2
echo $?
```
the above should give 2.

View File

@ -1,21 +0,0 @@
version: "3"
services:
too_long:
image: busybox
command: ["/bin/busybox", "sh", "-c", "sleep 3600; exit 0"]
tmpfs:
- /run
- /tmp
sh1:
image: busybox
command: ["/bin/busybox", "sh", "-c", "sleep 5; exit 1"]
tmpfs:
- /run
- /tmp
sh2:
image: busybox
command: ["/bin/busybox", "sh", "-c", "sleep 5; exit 2"]
tmpfs:
- /run
- /tmp

View File

@ -1 +0,0 @@
FROM busybox as base

View File

@ -0,0 +1,12 @@
import os
import subprocess
def create_base_test_image():
subprocess.check_call(
['podman', 'build', '-t', 'nopush/podman-compose-test', '.'],
cwd=os.path.join(os.path.dirname(__file__), "base_image"),
)
create_base_test_image()

View File

@ -0,0 +1,14 @@
# Test podman-compose with build.additional_contexts
```
podman-compose build
podman-compose up
podman-compose down
```
expected output would be
```
[dict] | Data for dict
[list] | Data for list
```

View File

@ -0,0 +1 @@
Data for dict

View File

@ -0,0 +1 @@
Data for list

View File

@ -0,0 +1,3 @@
FROM busybox
COPY --from=data data.txt /data/data.txt
CMD ["busybox", "cat", "/data/data.txt"]

View File

@ -0,0 +1,12 @@
version: "3.7"
services:
dict:
build:
context: .
additional_contexts:
data: ../data_for_dict
list:
build:
context: .
additional_contexts:
- data=../data_for_list

View File

@ -0,0 +1,6 @@
FROM docker.io/library/debian:bookworm-slim
RUN apt-get update \
&& apt-get install -y \
dumb-init \
busybox \
wget

View File

@ -0,0 +1,3 @@
FROM busybox
RUN this_command_does_not_exist
CMD ["sh"]

View File

@ -0,0 +1,5 @@
version: "3"
services:
test:
build: ./context
image: build-fail-img

View File

@ -0,0 +1 @@
FROM busybox

View File

@ -0,0 +1,22 @@
version: "3"
services:
test_build_labels_map:
build:
context: ./context
dockerfile: Dockerfile
labels:
com.example.description: "Accounting webapp"
com.example.department: "Finance"
com.example.label-with-empty-value: ""
image: my-busybox-build-labels-map
command: env
test_build_labels_array:
build:
context: ./context
dockerfile: Dockerfile
labels:
- "com.example.description=Accounting webapp"
- "com.example.department=Finance"
- "com.example.label-with-empty-value"
image: my-busybox-build-labels-array
command: env

View File

@ -0,0 +1,60 @@
# SPDX-License-Identifier: GPL-2.0
import json
import os
import unittest
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path
from tests.integration.test_utils import RunSubprocessMixin
class TestBuildLabels(unittest.TestCase, RunSubprocessMixin):
def test_build_labels(self):
"""The build context can contain labels which should be added to the resulting image. They
can be either an array or a map.
"""
compose_path = os.path.join(test_path(), "build_labels/docker-compose.yml")
try:
self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_path,
"build",
"test_build_labels_map",
"test_build_labels_array",
])
expected_labels = {
"com.example.department": "Finance",
"com.example.description": "Accounting webapp",
"com.example.label-with-empty-value": "",
}
out, _ = self.run_subprocess_assert_returncode([
"podman",
"inspect",
"my-busybox-build-labels-map",
"my-busybox-build-labels-array",
])
images = json.loads(out)
self.assertEqual(len(images), 2)
labels_map = images[0].get("Config", {}).get("Labels", {})
labels_array = images[1].get("Config", {}).get("Labels", {})
for k, v in expected_labels.items():
self.assertIn(k, labels_map)
self.assertEqual(labels_map[k], v)
self.assertIn(k, labels_array)
self.assertEqual(labels_array[k], v)
finally:
self.run_subprocess_assert_returncode([
"podman",
"rmi",
"my-busybox-build-labels-map",
"my-busybox-build-labels-array",
])

View File

@ -0,0 +1,9 @@
FROM busybox
RUN --mount=type=secret,required=true,id=build_secret \
ls -l /run/secrets/ && cat /run/secrets/build_secret
RUN --mount=type=secret,required=true,id=build_secret,target=/tmp/secret \
ls -l /run/secrets/ /tmp/ && cat /tmp/secret
CMD [ 'echo', 'nothing here' ]

View File

@ -0,0 +1,22 @@
version: "3.8"
services:
test:
image: test
secrets:
- run_secret # implicitly mount to /run/secrets/run_secret
- source: run_secret
target: /tmp/run_secret2 # explicit mount point
build:
context: .
secrets:
- build_secret # can be mounted in Dockerfile with "RUN --mount=type=secret,id=build_secret"
- source: build_secret
target: build_secret2 # rename to build_secret2
secrets:
build_secret:
file: ./my_secret
run_secret:
file: ./my_secret

View File

@ -0,0 +1,18 @@
version: "3.8"
services:
test:
image: test
build:
context: .
secrets:
# invalid target argument
#
# According to https://github.com/compose-spec/compose-spec/blob/master/build.md, target is
# supposed to be the "name of a *file* to be mounted in /run/secrets/". Not a path.
- source: build_secret
target: /build_secret
secrets:
build_secret:
file: ./my_secret

View File

@ -0,0 +1,16 @@
# Base image
FROM alpine:latest
# Install OpenSSH client
RUN apk add openssh
# Test the SSH agents during the build
RUN echo -n "default: " >> /result.log
RUN --mount=type=ssh ssh-add -L >> /result.log
RUN echo -n "id1: " >> /result.log
RUN --mount=type=ssh,id=id1 ssh-add -L >> /result.log
RUN echo -n "id2: " >> /result.log
RUN --mount=type=ssh,id=id2 ssh-add -L >> /result.log

View File

@ -0,0 +1,26 @@
version: "3"
services:
test_build_ssh_map:
build:
context: ./context
dockerfile: Dockerfile
ssh:
default:
id1: "./id_ed25519_dummy"
id2: "./agent_dummy.sock"
image: my-alpine-build-ssh-map
command:
- cat
- /result.log
test_build_ssh_array:
build:
context: ./context
dockerfile: Dockerfile
ssh:
- default
- "id1=./id_ed25519_dummy"
- "id2=./agent_dummy.sock"
image: my-alpine-build-ssh-array
command:
- cat
- /result.log

View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBWELzfWvraCAeo0rOM2OxTGqWZx7fNBCglK/1oS8FLpgAAAJhzHuERcx7h
EQAAAAtzc2gtZWQyNTUxOQAAACBWELzfWvraCAeo0rOM2OxTGqWZx7fNBCglK/1oS8FLpg
AAAEAEIrYvY3jJ2IvAnUa5jIrVe8UG+7G7PzWzZqqBQykZllYQvN9a+toIB6jSs4zY7FMa
pZnHt80EKCUr/WhLwUumAAAADnJpbmdvQGJuZHRib3gyAQIDBAUGBw==
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1,246 @@
# SPDX-License-Identifier: GPL-2.0
import os
import socket
import struct
import threading
import unittest
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from tests.integration.test_podman_compose import podman_compose_path
from tests.integration.test_podman_compose import test_path
from tests.integration.test_utils import RunSubprocessMixin
expected_lines = [
"default: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFYQvN9a+toIB6jSs4zY7FMapZnHt80EKCUr/WhLwUum",
"id1: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFYQvN9a+toIB6jSs4zY7FMapZnHt80EKCUr/WhLwUum",
"id2: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFYQvN9a+toIB6jSs4zY7FMapZnHt80EKCUr/WhLwUum",
]
class TestBuildSsh(unittest.TestCase, RunSubprocessMixin):
def test_build_ssh(self):
"""The build context can contain the ssh authentications that the image builder should
use during image build. They can be either an array or a map.
"""
compose_path = os.path.join(test_path(), "build_ssh/docker-compose.yml")
sock_path = os.path.join(test_path(), "build_ssh/agent_dummy.sock")
private_key_file = os.path.join(test_path(), "build_ssh/id_ed25519_dummy")
agent = MockSSHAgent(private_key_file)
try:
# Set SSH_AUTH_SOCK because `default` expects it
os.environ['SSH_AUTH_SOCK'] = sock_path
# Start a mock SSH agent server
agent.start_agent(sock_path)
self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_path,
"build",
"test_build_ssh_map",
"test_build_ssh_array",
])
for test_image in [
"test_build_ssh_map",
"test_build_ssh_array",
]:
out, _ = self.run_subprocess_assert_returncode([
podman_compose_path(),
"-f",
compose_path,
"run",
"--rm",
test_image,
])
out = out.decode('utf-8')
# Check if all lines are contained in the output
self.assertTrue(
all(line in out for line in expected_lines),
f"Incorrect output for image {test_image}",
)
finally:
# Now we send the stop command to gracefully shut down the server
agent.stop_agent()
if os.path.exists(sock_path):
os.remove(sock_path)
self.run_subprocess_assert_returncode([
"podman",
"rmi",
"my-alpine-build-ssh-map",
"my-alpine-build-ssh-array",
])
# SSH agent message types
SSH_AGENTC_REQUEST_IDENTITIES = 11
SSH_AGENT_IDENTITIES_ANSWER = 12
SSH_AGENT_FAILURE = 5
STOP_REQUEST = 0xFF
class MockSSHAgent:
def __init__(self, private_key_path):
self.sock_path = None
self.server_sock = None
self.running = threading.Event()
self.keys = [self._load_ed25519_private_key(private_key_path)]
self.agent_thread = None # Thread to run the agent
def _load_ed25519_private_key(self, private_key_path):
"""Load ED25519 private key from an OpenSSH private key file."""
with open(private_key_path, 'rb') as key_file:
private_key = serialization.load_ssh_private_key(key_file.read(), password=None)
# Ensure it's an Ed25519 key
if not isinstance(private_key, Ed25519PrivateKey):
raise ValueError("Invalid key type, expected ED25519 private key.")
# Get the public key corresponding to the private key
public_key = private_key.public_key()
# Serialize the public key to the OpenSSH format
public_key_blob = public_key.public_bytes(
encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw
)
# SSH key type "ssh-ed25519"
key_type = b"ssh-ed25519"
# Build the key blob (public key part for the agent)
key_blob_full = (
struct.pack(">I", len(key_type))
+ key_type # Key type length + type
+ struct.pack(">I", len(public_key_blob))
+ public_key_blob # Public key length + key blob
)
# Comment (empty)
comment = ""
return ("ssh-ed25519", key_blob_full, comment)
def start_agent(self, sock_path):
"""Start the mock SSH agent and create a Unix domain socket."""
self.sock_path = sock_path
if os.path.exists(self.sock_path):
os.remove(self.sock_path)
self.server_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.server_sock.bind(self.sock_path)
self.server_sock.listen(5)
os.environ['SSH_AUTH_SOCK'] = self.sock_path
self.running.set() # Set the running event
# Start a thread to accept client connections
self.agent_thread = threading.Thread(target=self._accept_connections, daemon=True)
self.agent_thread.start()
def _accept_connections(self):
"""Accept and handle incoming connections."""
while self.running.is_set():
try:
client_sock, _ = self.server_sock.accept()
self._handle_client(client_sock)
except Exception as e:
print(f"Error accepting connection: {e}")
def _handle_client(self, client_sock):
"""Handle a single client request (like ssh-add)."""
try:
# Read the message length (first 4 bytes)
length_message = client_sock.recv(4)
if not length_message:
raise "no length message received"
msg_len = struct.unpack(">I", length_message)[0]
request_message = client_sock.recv(msg_len)
# Check for STOP_REQUEST
if request_message[0] == STOP_REQUEST:
client_sock.close()
self.running.clear() # Stop accepting connections
return
# Check for SSH_AGENTC_REQUEST_IDENTITIES
if request_message[0] == SSH_AGENTC_REQUEST_IDENTITIES:
response = self._mock_list_keys_response()
client_sock.sendall(response)
else:
print("Message not recognized")
# Send failure if the message type is not recognized
response = struct.pack(">I", 1) + struct.pack(">B", SSH_AGENT_FAILURE)
client_sock.sendall(response)
except socket.error:
print("Client socket error.")
pass # You can handle specific errors here if needed
finally:
client_sock.close() # Ensure the client socket is closed
def _mock_list_keys_response(self):
"""Create a mock response for ssh-add -l, listing keys."""
# Start building the response
response = struct.pack(">B", SSH_AGENT_IDENTITIES_ANSWER) # Message type
# Number of keys
response += struct.pack(">I", len(self.keys))
# For each key, append key blob and comment
for key_type, key_blob, comment in self.keys:
# Key blob length and content
response += struct.pack(">I", len(key_blob)) + key_blob
# Comment length and content
comment_encoded = comment.encode()
response += struct.pack(">I", len(comment_encoded)) + comment_encoded
# Prefix the entire response with the total message length
response = struct.pack(">I", len(response)) + response
return response
def stop_agent(self):
"""Stop the mock SSH agent."""
if self.running.is_set(): # First check if the agent is running
# Create a temporary connection to send the stop command
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client_sock:
client_sock.connect(self.sock_path) # Connect to the server
stop_command = struct.pack(
">B", STOP_REQUEST
) # Pack the stop command as a single byte
# Send the message length first
message_length = struct.pack(">I", len(stop_command))
client_sock.sendall(message_length) # Send the length first
client_sock.sendall(stop_command) # Send the stop command
self.running.clear() # Stop accepting new connections
# Wait for the agent thread to finish
if self.agent_thread:
self.agent_thread.join() # Wait for the thread to finish
self.agent_thread = None # Reset thread reference
# Remove the socket file only after the server socket is closed
if self.server_sock: # Check if the server socket exists
self.server_sock.close() # Close the server socket
os.remove(self.sock_path)

View File

@ -0,0 +1,4 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/

View File

@ -0,0 +1,7 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
x-podman:
default_net_behavior_compat: true

View File

@ -0,0 +1,7 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
networks:
net0: {}

View File

@ -0,0 +1,10 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
networks:
net0: {}
x-podman:
default_net_behavior_compat: true

View File

@ -0,0 +1,8 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
networks:
net0: {}
net1: {}

View File

@ -0,0 +1,11 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
networks:
net0: {}
net1: {}
x-podman:
default_net_behavior_compat: true

View File

@ -0,0 +1,9 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
networks:
net0: {}
net1: {}
default: {}

View File

@ -0,0 +1,12 @@
services:
web:
image: busybox
command: httpd -f -p 8123 -h /tmp/
networks:
net0: {}
net1: {}
default: {}
x-podman:
default_net_behavior_compat: true

View File

@ -0,0 +1,22 @@
version: "3.7"
services:
web:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-h", "/etc/", "-p", "8000"]
tmpfs:
- /run
- /tmp
healthcheck:
test: ["CMD", "/bin/false"]
interval: 10s # Time between health checks
timeout: 1s # Time to wait for a response
retries: 1 # Number of consecutive failures before marking as unhealthy
sleep:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 3600"]
depends_on:
web:
condition: service_healthy
tmpfs:
- /run
- /tmp

View File

@ -0,0 +1,22 @@
version: "3.7"
services:
web:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-h", "/etc/", "-p", "8000"]
tmpfs:
- /run
- /tmp
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8000/hosts"]
interval: 30s # Time between health checks
timeout: 5s # Time to wait for a response
retries: 3 # Number of consecutive failures before marking as unhealthy
sleep:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 3600"]
depends_on:
web:
condition: service_healthy
tmpfs:
- /run
- /tmp

View File

@ -0,0 +1,25 @@
version: "3.7"
services:
web:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-h", "/etc/", "-p", "8000"]
tmpfs:
- /run
- /tmp
sleep:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 3600"]
depends_on:
- "web"
tmpfs:
- /run
- /tmp
sleep2:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 3600"]
depends_on:
- sleep
tmpfs:
- /run
- /tmp

View File

@ -0,0 +1,2 @@
ZZVAR1='This value is overwritten by env-file-tests/.env'
ZZVAR3='This value is loaded from env-file-tests/.env'

View File

@ -0,0 +1,4 @@
# This overrides the repository root .gitignore (ignoring all .env).
# The .env files in this directory are important for the test cases.
!.env
!project/.env

View File

@ -0,0 +1,3 @@
ZZVAR1=podman-rocks-123
ZZVAR2=podman-rocks-124
ZZVAR3=podman-rocks-125

View File

@ -0,0 +1,2 @@
ZZVAR1=podman-rocks-223
ZZVAR2=podman-rocks-224

View File

@ -0,0 +1,2 @@
ZZVAR1='This value is loaded but should be overwritten'
ZZVAR2='This value is loaded from .env in project/ directory'

View File

@ -0,0 +1,9 @@
services:
app:
image: busybox
command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
tmpfs:
- /run
- /tmp
env_file:
- ../env-files/project-1.env

View File

@ -0,0 +1,11 @@
services:
app:
image: busybox
command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
tmpfs:
- /run
- /tmp
env_file:
- path: ../env-files/project-1.env
- path: ../env-files/project-2.env # this file exists
required: false

View File

@ -0,0 +1,11 @@
services:
app:
image: busybox
command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
tmpfs:
- /run
- /tmp
env_file:
- path: ../env-files/project-1.env
- path: ../env-files/project-3.env # this file is missing
required: false

View File

@ -0,0 +1,9 @@
services:
app:
image: busybox
command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
tmpfs:
- /run
- /tmp
env_file:
- path: ../env-files/project-1.env

View File

@ -0,0 +1,11 @@
services:
app:
image: busybox
command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
tmpfs:
- /run
- /tmp
environment:
ZZVAR1: $ZZVAR1
ZZVAR2: $ZZVAR2
ZZVAR3: $ZZVAR3

View File

@ -0,0 +1,9 @@
services:
app:
image: busybox
command: ["/bin/busybox", "sh", "-c", "env | grep ZZ"]
tmpfs:
- /run
- /tmp
environment:
ZZVAR1: $ZZVAR1

View File

@ -1,9 +1,10 @@
version: '3'
version: "3"
services:
env-test:
image: busybox
command: sh -c "export | grep ZZ"
environment:
- ZZVAR1=myval1
ZZVAR1: myval1
ZZVAR2: 2-$ZZVAR1
ZZVAR3: 3-$ZZVAR2

View File

@ -0,0 +1,15 @@
version: "3"
services:
sh1:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 1; exit 1"]
tmpfs:
- /run
- /tmp
sh2:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "sh", "-c", "sleep 1; exit 2"]
tmpfs:
- /run
- /tmp

View File

@ -0,0 +1,7 @@
services:
webapp_default:
webapp_special:
image: nopush/podman-compose-test
volumes:
- "/data"

View File

@ -0,0 +1,10 @@
version: "3"
services:
web:
image: nopush/podman-compose-test
extends:
file: common-services.yml
service: webapp_default
environment:
- DEBUG=1
cpu_shares: 5

View File

@ -0,0 +1 @@
FROM nopush/podman-compose-test as base

Some files were not shown because too many files have changed in this diff Show More