[ci] Validate image build (#1318)

A recent failure of post-merge image build suggested the need for a
pre-merge sanity check to avoid unintentionally merging changes that
break the image build.
This commit is contained in:
marun
2024-08-28 14:32:58 -07:00
committed by GitHub
parent 561dfb7f2b
commit 4bd95875b7
4 changed files with 30 additions and 1 deletions
+8
View File
@@ -197,6 +197,14 @@ jobs:
run: scripts/mock.gen.sh
- shell: bash
run: .github/workflows/check-clean-branch.sh
test_build_image:
name: Image build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check image build
shell: bash
run: bash -x scripts/tests.build_docker_image.sh
test_build_antithesis_images:
name: Build Antithesis images
runs-on: ubuntu-latest
-1
View File
@@ -13,7 +13,6 @@ source "$SUBNET_EVM_PATH"/scripts/versions.sh
# WARNING: this will use the most recent commit even if there are un-committed changes present
BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${CURRENT_BRANCH}"}
DOCKERHUB_TAG=${SUBNET_EVM_COMMIT::8}
VM_ID=${VM_ID:-"${DEFAULT_VM_ID}"}
if [[ "${VM_ID}" != "${DEFAULT_VM_ID}" ]]; then
+3
View File
@@ -30,6 +30,9 @@ else
SUBNET_EVM_COMMIT="$(git --git-dir="$SUBNET_EVM_PATH/.git" rev-parse HEAD || :)"
fi
# Shared between ./scripts/build_docker_image.sh and ./scripts/tests.build_docker_image.sh
DOCKERHUB_TAG=${SUBNET_EVM_COMMIT::8}
echo "Using branch: ${CURRENT_BRANCH}"
# Static compilation
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
# Sanity check the image build by attempting to build and run the image without error.
# Directory above this script
SUBNET_EVM_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )
# Load the constants
source "$SUBNET_EVM_PATH"/scripts/constants.sh
# Build a local image
"${SUBNET_EVM_PATH}"/scripts/build_docker_image.sh
# Check that the image can be run and contains the plugin
echo "Checking version of the plugin provided by the image"
docker run -t --rm "${DOCKERHUB_REPO}:${DOCKERHUB_TAG}" /avalanchego/build/plugins/"${DEFAULT_VM_ID}" --version
echo "" # --version output doesn't include a newline
echo "Successfully checked image build"