forked from google/osv-scalibr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Layer Scanning] Add symlinks support for the
FileRequirer
logic in…
… `image.FromTarball`; changed the `Layer.Uncompressed` method to return a new `ReaderCloser` every time the method is called. PiperOrigin-RevId: 725223477
- Loading branch information
1 parent
126d3e3
commit c591953
Showing
5 changed files
with
182 additions
and
50 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
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
27 changes: 27 additions & 0 deletions
27
artifact/image/testfixtures/symlinks-across-layers/Dockerfile
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,27 @@ | ||
# Use Alpine as the builder since the final image is built on scratch | ||
# which doesn't contain the `ln` command to generate symlinks. | ||
FROM alpine:latest as builder | ||
|
||
RUN mkdir dir1 | ||
RUN mkdir dir2 | ||
RUN mkdir | ||
|
||
|
||
RUN echo "sample text" > dir1/sample.txt | ||
RUN ln -s /dir1/sample.txt /dir2/absolute-symlink.txt | ||
RUN ln -s /dir2/absolute-symlink.txt /dir3/chain-symlink.txt | ||
|
||
|
||
# - root | ||
# - dir1 | ||
# - sample.txt | ||
# - dir2 | ||
# - absolute-symlink.txt -> /dir1/sample.txt | ||
# - dir3 | ||
# - chain-symlink.txt -> /dir2absolute-symlink.txt | ||
FROM scratch | ||
|
||
# Must copy over the entire directory to preserve the symlinks. | ||
COPY --from=builder /dir3/ /dir3/ | ||
COPY --from=builder /dir2/ /dir2/ | ||
COPY --from=builder /dir1/ /dir1/ |