podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

Add support for environmental secrets

Open breca opened this issue 11 months ago • 2 comments

This merge adds support for type=env secret parameter, picking up the work of @71ms1 in #671.

It also adds some basic tests to the existing secret checks:

[test] podman start -a secrets_test_1
[test] | -rw-rw-r--    1 root     root            30 Feb 24 08:15 /run/secrets/custom_name
[test] | -rw-rw-r--    1 root     root            30 Feb 24 08:15 /run/secrets/file_secret
[test] | -r--r--r--    1 root     root             4 Feb 24 10:10 /run/secrets/my_secret
[test] | -r--r--r--    1 root     root             4 Feb 24 10:10 /run/secrets/my_secret_2
[test] | -r--------    1 103      103              4 Feb 24 10:10 /run/secrets/my_secret_3
[test] | -rw-rw-r--    1 root     root            30 Feb 24 08:15 /run/secrets/unused_params_warning
[test] | -rw-rw-r--    1 root     root            30 Feb 24 08:15 /etc/custom_location
[test] | important-secret-is-important
[test] | important-secret-is-important
[test] | sec
[test] | sec
[test] | sec
[test] | important-secret-is-important
[test] | important-secret-is-important
[test] | ENV_SECRET=sec
[test] exit code: 0

breca avatar Feb 25 '24 01:02 breca

Cool, happy to look at it when the bar is set.

breca avatar Mar 08 '24 22:03 breca

I looked into this again and think that we could simply have a unit test for get_secret_args function.

We already have tests for container_to_args() in pytests/test_container_to_args.py. At the moment splitting tests by function seems a bit non-optimal, but I expect we will have hundreds of lines of unit tests for each function. Splitting tests by function seems like an easy way to help navigating them.

p12tic avatar Mar 08 '24 23:03 p12tic

Merged via https://github.com/containers/podman-compose/pull/971 which added unit tests. Thanks for the PR that did most of the work.

p12tic avatar Jun 24 '24 20:06 p12tic