Skip to content

Conversation

@aeijdenberg
Copy link
Contributor

Allow secrets specified with mount to result in env variable set as an alternative to mounting a file.

This matches Docker behaviour:
https://docs.docker.com/reference/dockerfile/#example-mount-as-environment-variable

What type of PR is this?

/kind feature

What this PR does / why we need it:

Docker supports making secret mounts appear as environment variables during a RUN command. This adds the same to buildah.

See: https://docs.docker.com/reference/dockerfile/#example-mount-as-environment-variable

How to verify it

bats test added.

Which issue(s) this PR fixes:

Fixes #5892

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Adds support for mounting a secret to an environment variable. For example:

RUN --mount=type=secret,id=mysecret,env=FOO sh -c 'echo "Hello $FOO"'

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label Jul 14, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 14, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aeijdenberg
Once this PR has been reviewed and has the lgtm label, please assign flouthoc for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@aeijdenberg aeijdenberg force-pushed the supportmountingsecretasenv branch from ca6c7f0 to e42de5f Compare July 15, 2025 03:09
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2025
@aeijdenberg aeijdenberg force-pushed the supportmountingsecretasenv branch from e42de5f to bbfa364 Compare July 31, 2025 09:29
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2025
@filip-be
Copy link

Hi Team!
What's the status of this PR? is it going to be updated and merged anytime soon or is there any pending issue that needs to be resolved?

@aeijdenberg aeijdenberg force-pushed the supportmountingsecretasenv branch from bbfa364 to 3a2513c Compare August 28, 2025 09:50
@aeijdenberg
Copy link
Contributor Author

Rebased on latest main to fix merge conflict in test.

@github-actions
Copy link

A friendly reminder that this PR had no activity for 30 days.

@ab-gh
Copy link

ab-gh commented Oct 14, 2025

Hi there, has there been any progress in the status of this PR? Not having docker-like type=secret,env=bar is really hindering some progress.

@aeijdenberg aeijdenberg force-pushed the supportmountingsecretasenv branch from 3a2513c to 701d376 Compare October 20, 2025 22:21
@aeijdenberg
Copy link
Contributor Author

Rebased to fix merge conflict.

@github-actions github-actions bot removed the stale-pr label Oct 22, 2025
@aeijdenberg aeijdenberg force-pushed the supportmountingsecretasenv branch from 701d376 to 95f2336 Compare October 29, 2025 21:27
Allow secrets specified with mount to result in env variable set as an
alternative to mounting a file.

This matches Docker behaviour:
https://docs.docker.com/reference/dockerfile/#example-mount-as-environment-variable

Signed-off-by: Adam Eijdenberg <[email protected]>
@aeijdenberg aeijdenberg force-pushed the supportmountingsecretasenv branch from 95f2336 to ff08a60 Compare November 16, 2025 23:46
@aeijdenberg
Copy link
Contributor Author

Rebased to fix merge conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support building Dockerfiles that mount secrets as environment variables

4 participants