Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for environmental secrets #856

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

breca
Copy link
Contributor

@breca breca commented Feb 25, 2024

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

Copy link
Collaborator

@p12tic p12tic left a comment

Choose a reason for hiding this comment

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

The code looks good, thanks!

The PR needs unit tests, not just an integration test. In few weeks we will hopefully have an easy way to add unit tests to changes like this.

@breca
Copy link
Contributor Author

breca commented Mar 8, 2024

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

@p12tic
Copy link
Collaborator

p12tic commented Mar 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants