Skip to content

Commit 93b6f9c

Browse files
committed
Test container before pushing to Docker registry
We've been burnt before by pushing untested container images and then breaking debos/fakemachine CI jobs. Run the unit tests from the last tagged version of fakemachine/debos (which have already been tested) before pushing the container image to the registry. Fixes: #19 Signed-off-by: Christopher Obbard <[email protected]>
1 parent 5927f18 commit 93b6f9c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Diff for: .github/workflows/container.yaml

+21-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
build-containers:
1818
runs-on: ubuntu-latest
1919
name: Build ${{ matrix.variant }} container
20+
env:
21+
TEST_TAG: ${{ github.repository }}-${{ matrix.variant }}-testbuild
2022
permissions:
2123
contents: read
2224
packages: write
@@ -63,7 +65,25 @@ jobs:
6365
"type=ref,event=tag"
6466
"type=ref,event=pr"
6567
66-
- name: Build and push Docker image
68+
- name: Build Docker image
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
file: Dockerfile.${{ matrix.dockerfile }}
73+
load: true
74+
push: false
75+
tags: ${{ env.TEST_TAG }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
build-args: |
78+
VARIANT=${{ matrix.variant }}
79+
80+
# TODO: actually do something useful here
81+
# git clone latest version && go test -v ./...
82+
- name: Test Docker image
83+
run: |
84+
docker run --rm ${{ env.TEST_TAG }} go run github.com/go-debos/debos/cmd/debos@latest --help
85+
86+
- name: Push Docker image
6787
uses: docker/build-push-action@v5
6888
with:
6989
context: .

0 commit comments

Comments
 (0)