ci: add docker build smoke test (#13200)

This commit is contained in:
Evan Culver 2022-05-27 13:29:57 -07:00 committed by GitHub
parent 64cfe245dd
commit 9a13be3881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

23
.github/scripts/docker_smoke.sh vendored Executable file
View File

@ -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 "$@"

View File

@ -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