-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run,mount: remove path only if they didnt pre-exist
It seems buildah was cleaning path after unmounting the content which was added by `--mount`, however buildah should `remove` only if the path it did not pre-exist otherwise it should just simply `unmount`. Following behaviour aligns buildah to buildkit Closes: #4739 Signed-off-by: Aditya R <[email protected]>
- Loading branch information
Showing
5 changed files
with
91 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM alpine as builder | ||
RUN mkdir subdir | ||
COPY hey . | ||
|
||
FROM docker.io/library/debian:testing-slim | ||
RUN --mount=type=bind,source=.,dst=/tmp,z \ | ||
--mount=type=tmpfs,dst=/var/tmp \ | ||
cat /tmp/hey | ||
RUN --mount=type=cache,from=builder,target=/cachedir cat /cachedir/hey | ||
RUN --mount=type=secret,id=secret-foo,dst=secret1.txt cat secret1.txt | ||
ARG TMP="/tmp" | ||
ARG VARTMP="/var/tmp" | ||
ARG CACHEDIR="/cachedir" | ||
ARG TESTDIR="/testdir" | ||
ARG SECRETFILE="secret1.txt" | ||
RUN [ -d "/tmp" ] && echo "Directory $TMP exists." | ||
RUN [ -d "/var/tmp" ] && echo "Directory $VARTMP exists." | ||
|
||
#Following path should not exists after the --mount step | ||
RUN [ ! -d "/testdir" ] && echo "Directory $TESTDIR DOES NOT exists." | ||
RUN [ ! -d "/cachedir" ] && echo "Cache Directory $CACHEDIR DOES NOT exists." | ||
RUN [ ! -f "secret1.txt" ] && echo "Secret File $SECRETFILE DOES NOT exists." | ||
# This should fail | ||
RUN cat /tmp/hey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
secrettext |