Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Validate image build #1318

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion scripts/build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions scripts/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions scripts/tests.build_docker_image.sh
Original file line number Diff line number Diff line change
@@ -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"
Loading