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 <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Oct 17, 2022
1 parent 0ac4310 commit ec88287
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 @@ -167,3 +167,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 ec88287

Please sign in to comment.