-
Notifications
You must be signed in to change notification settings - Fork 857
feat(build): add --mount option #6289
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
base: main
Are you sure you want to change the base?
Conversation
3ef5e79 to
eb46ba8
Compare
|
I found #5987 today, who look to be trying solve a similar case to me. I'd like to set some transient related env vars and file mounts during the build phase that shouldn't affect the final image. For example, this options allow me to run: buildah build \
--secret id=MAVEN_SETTINGS_FILE,type=file,src=/path/to/host/mvn.settings \
--run-mount type=secret,id=MAVEN_SETTINGS_FILE,target=/usr/share/maven/conf/settings.xml,required \
...(and related PR #6285 to expose in an env variable to the build process) |
eb46ba8 to
10a6215
Compare
|
If interested, here's some context on how I'm using this - the intent to is make Here's a full writeup of the tool I'm working on and info about the patches added to https://github.com/continusec/htvend/ |
10a6215 to
ea84778
Compare
|
A friendly reminder that this PR had no activity for 30 days. |
ea84778 to
f8dca25
Compare
|
Rebased to fix merge conflict. |
|
Generally looks fine. Flags, even when they're specific to RUN, don't tend to have a "run-" prefix for |
f8dca25 to
88ff66d
Compare
|
Thanks for the feedback.
I've renamed to
Added. |
|
LGTM |
|
Ugh, I created merge conflicts with #6442. If I can trouble you to rebase one more time, I'll go ahead and merge this. |
88ff66d to
32a0dff
Compare
Done, and thanks for reviewing. |
|
/lgtm |
This allows adding an ephemeral mount to all RUN commands in a Containerfile during a build. Signed-off-by: Adam Eijdenberg <[email protected]>
32a0dff to
9a68c43
Compare
|
New changes are detected. LGTM label has been removed. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aeijdenberg 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 |
|
Rebased to fix merge conflict. |
This allows adding an ephemeral mount to all RUN commands in a Containerfile during a build.
What type of PR is this?
What this PR does / why we need it:
This adds a
--mountoption tobuildwhich has the effect of adding this mount to eachRUNcommand in a Containerfile before executing. For example:buildah build --mount type=secret,id=mysecret ...and a Containerfile entry of:
RUN cat /run/secrets/mysecretHas the same effect as:
RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecretThis is useful in conjunction with #6285 for building existing Containerfile's with different environmental considerations (such as SSL_CERT_FILE data etc) without needing to modify the existing Containerfile's or causing changes to the produced images.
How to verify it
bats test added.
Prints:
hello world welcomeWhich issue(s) this PR fixes:
None
Special notes for your reviewer:
There is an existing field
TransientMountsinBuildOptionsthat had comment suggesting it would do exactly as described by this PR, however it does not quite operate as described, rather it expects each argument to be asrc:destvolume mount (I suspect it predates other types of mounts):buildah/define/build.go
Lines 148 to 150 in db61e10
Since that field was part of the public API, I didn't change it's behaviour in this PR, but I did adjust the comment and added a new fields for other mounts.
Does this PR introduce a user-facing change?