Skip to content

Commit

Permalink
bake(e2e): simple test for sync-output flag
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max authored and jedevc committed Nov 30, 2022
1 parent d52c623 commit 048e6ac
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,36 @@ jobs:
DRIVER_OPT: ${{ matrix.driver-opt }}
ENDPOINT: ${{ matrix.endpoint }}
PLATFORMS: ${{ matrix.platforms }}

cases:
runs-on: ubuntu-20.04
needs:
- build
strategy:
fail-fast: false
matrix:
case:
- bake-sync-output
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Install buildx
uses: actions/download-artifact@v3
with:
name: binary
path: /home/runner/.docker/cli-plugins
-
name: Fix perms and check
run: |
chmod +x /home/runner/.docker/cli-plugins/docker-buildx
docker buildx version
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Test
working-directory: ./test/${{ matrix.case }}
run: |
./test.sh
1 change: 1 addition & 0 deletions test/bake-sync-output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/out
5 changes: 5 additions & 0 deletions test/bake-sync-output/bar.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM busybox
RUN echo bar > /bar

FROM scratch
COPY --from=0 /bar /bar
13 changes: 13 additions & 0 deletions test/bake-sync-output/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
group "default" {
targets = ["foo", "bar"]
}

target "foo" {
dockerfile = "foo.Dockerfile"
output = ["out"]
}

target "bar" {
dockerfile = "bar.Dockerfile"
output = ["out"]
}
5 changes: 5 additions & 0 deletions test/bake-sync-output/foo.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM busybox
RUN echo foo > /foo

FROM scratch
COPY --from=0 /foo /foo
13 changes: 13 additions & 0 deletions test/bake-sync-output/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -ex

rm -rf ./out

docker buildx bake --print
docker buildx bake --sync-output

if [[ ! -f ./out/foo || ! -f ./out/bar ]]; then
echo >&2 "error: missing output files"
exit 1
fi

0 comments on commit 048e6ac

Please sign in to comment.