diff --git a/.github/scripts/docker_smoke.sh b/.github/scripts/docker_smoke.sh new file mode 100755 index 0000000000..0ab4126516 --- /dev/null +++ b/.github/scripts/docker_smoke.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -euo pipefail + +function main { + local image_name="${1:-${IMAGE_NAME:-}}" + local test_version + + if [[ -z "${image_name}" ]]; then + echo "ERROR: IMAGE_NAME environment var or argument is required" + exit 1 + fi + + test_version="$(docker run "${image_name}" version | head -n1 | awk '{print $2}')" + if [ "${test_version}" != "v${version}" ]; then + echo "Test FAILED" + echo "Got: ${test_version}, Want: ${version}" + exit 1 + fi + echo "Test PASSED" +} + +main "$@" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67edb0e78d..93aa1aeb54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -253,6 +253,7 @@ jobs: dev_tags: | docker.io/hashicorppreview/${{ env.repo }}:${{ env.version }} docker.io/hashicorppreview/${{ env.repo }}:${{ env.version }}-${{ github.sha }} + smoke_test: .github/scripts/docker_smoke.sh - name: Run verification in qemu docker for ${{ matrix.arch }} linux zip if: ${{ matrix.arch == 'arm64' }} run: | @@ -282,6 +283,7 @@ jobs: target: ubi arch: amd64 redhat_tag: scan.connect.redhat.com/ospid-612d01d49f14588c41ebf67c/${{env.repo}}:${{env.version}}-ubi + smoke_test: .github/scripts/docker_smoke.sh verify: needs: - get-product-version