Skip to content

Commit

Permalink
Mount linux utilities into distroless container during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GollyTicker committed Apr 24, 2022
1 parent 3618a28 commit 4f96922
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ The release process works like this:
doker images
* [Docker Buildx](https://docs.docker.com/engine/reference/commandline/buildx/) is used to build multi-architecture
images and push them to [qaware/protocurl](https://hub.docker.com/r/qaware/protocurl)
* their Dockerfile is generated via [release/generate-Dockerfile.sh](release/generate-Dockerfile.sh)
* There is a hack, when copying the proper lib files via multi-stage builds and build args into the [distroless cc](https://github.com/GoogleContainerTools/distroless/tree/main/cc) image.
* their Dockerfile is generated via [release/40-generate-Dockerfile.sh](release/40-generate-Dockerfile.sh)
* There is a [hack](release/final.Dockerfile), when copying the proper lib files via multi-stage builds and build args into the [distroless cc](https://github.com/GoogleContainerTools/distroless/tree/main/cc) image.
* Native tests for multiple platforms are run. If these tests fail then the release candidate needs to be fixed.
* This should only happen for release candidates - as proper releases should only be created once a release candidate
passes all tests.
Expand Down
8 changes: 0 additions & 8 deletions dev/final.Dockerfile.extensions

This file was deleted.

2 changes: 1 addition & 1 deletion dev/generate-local.Dockerfile.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
set -e
cat dev/builder.local.Dockerfile release/final.Dockerfile dev/final.Dockerfile.extensions >dev/generated.local.Dockerfile
cat dev/builder.local.Dockerfile release/final.Dockerfile >dev/generated.local.Dockerfile
2 changes: 2 additions & 0 deletions release/final.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM gcr.io/distroless/cc:latest as final
WORKDIR /protocurl

COPY --from=builder /usr/bin/curl /usr/bin/curl
# In the containerized tests, we mount /bin from host to get linux commands for testing.
# If the base image changes, then that might need adaptation.

# Ideally, we would simply copy these lib files based on their architecture. Unfortunately, we cannot use
# a build arg such as "ARG ARCH_UNAME_M" here with format as given by "uname -m" (x86_64, etc.).
Expand Down
10 changes: 9 additions & 1 deletion test/suite/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ set -e

WORKING_DIR="$1"

export RUN_CLIENT="docker run --rm -v $WORKING_DIR/test/proto:/proto --network host"
export RUN_CLIENT="docker run --rm -v $WORKING_DIR/test/proto:/proto --network host \
-v /bin/bash:/bin/bash:ro \
-v /bin/mkdir:/bin/mkdir:ro \
-v /bin/cp:/bin/cp:ro \
-v /bin/mv:/bin/mv:ro \
-v /bin/rm:/bin/rm:ro \
-v /bin/sed:/bin/sed:ro \
-v /bin/chmod:/bin/chmod:ro"
# We also mount the utilities into the distroless container to make them useable in the tests

export SHOW_LOGS="docker logs"

Expand Down

0 comments on commit 4f96922

Please sign in to comment.