Zombie Builder #222
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright Quadrivium LLC | |
# All Rights Reserved | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
name: Zombie Builder | |
on: | |
# schedule: | |
# - cron: '0 2 * * 0' # Update zombie builder image each Sunday night | |
workflow_dispatch: | |
inputs: | |
polkadot_builder: | |
description: 'Build the polkadot builder image' | |
required: false | |
default: 'false' | |
type: 'boolean' | |
polkadot_builder_tag: | |
description: 'Custom Polkadot Builder tag' | |
default: 'latest' | |
required: false | |
type: 'string' | |
polkadot_binaries: | |
description: 'Build the polkadot binaries' | |
required: false | |
default: 'true' | |
type: 'boolean' | |
polkadot_sdk_tag: | |
description: 'Custom Polkadot SDK tag' | |
required: false | |
type: 'string' | |
zombie_tester: | |
description: 'Build the zombie tester image' | |
required: false | |
default: 'false' | |
type: 'boolean' | |
zombie_tester_tag: | |
description: 'Custom Zombie Tester tag' | |
default: 'latest' | |
required: false | |
type: 'string' | |
zombienet_release: | |
description: 'Custom zombienet release' | |
default: '1.3.119' | |
required: false | |
type: 'string' | |
polkadot_package_version: | |
description: 'Custom Polkadot package version' | |
default: '2412-20250127' | |
required: false | |
type: 'string' | |
env: | |
DOCKER_REGISTRY_PATH: ${{ secrets.GCP_REGISTRY }}/${{ secrets.GCP_PROJECT }}/kagome-dev/ | |
GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }} | |
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }} | |
PROJECT_ID: ${{ secrets.GCP_PROJECT }} | |
POLKADOT_SDK_TAG: ${{ github.event.inputs.polkadot_sdk_tag }} | |
BUILDER_LATEST_TAG: ${{ github.event.inputs.polkadot_builder_tag || 'latest' }} | |
TESTER_LATEST_TAG: ${{ github.event.inputs.zombie_tester_tag || 'latest' }} | |
ZOMBIENET_RELEASE: ${{ github.event.inputs.zombienet_release || '1.3.119' }} | |
POLKADOT_DEB_PACKAGE_VERSION_NO_ARCH: ${{ github.event.inputs.polkadot_package_version || '2412-20250127' }} | |
SCCACHE_GCS_BUCKET: ${{ secrets.SCCACHE_GCS_BUCKET }} | |
CACHE_VERSION: v001 | |
CACHE_PATHS: ./zombienet/docker/build_docker/cargo | |
DOCKER_BUILD_DIR_NAME: build_docker_ci | |
jobs: | |
build_polkadot_builder: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- platform: linux/amd64 | |
os: ubuntu-24.04 | |
- platform: linux/arm64 | |
os: ubuntu-24.04-arm | |
timeout-minutes: 60 | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
steps: | |
- name: "Сheck if polkadot_builder is required" | |
run: | | |
if [ "${{ github.event.inputs.polkadot_builder }}" != "true" ]; then | |
echo "Polkadot Builder is not required" | |
echo "skip=true" >> $GITHUB_ENV | |
fi | |
- name: Checkout repository | |
if: env.skip != 'true' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch master branch | |
if: env.skip != 'true' | |
run: | | |
git fetch origin master:master | |
- name : "Authenticate with Google Cloud" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
if: env.skip != 'true' | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Check if image tag exists using Makefile" | |
if: env.skip != 'true' | |
id: check-tag | |
working-directory: ./zombienet/docker | |
run: | | |
make set_versions | |
exists=$(make polkadot_builder_check_tag) | |
echo "Image Exists: $exists" | |
echo "exists=$exists" >> $GITHUB_ENV | |
- name: "Build Polkadot Builder" | |
working-directory: ./zombienet/docker | |
if: env.exists == 'false' || env.skip != 'true' | |
run: | | |
make polkadot_builder && make polkadot_builder_push | |
- name: "Versions Info" | |
if: always() && env.skip != 'true' | |
working-directory: ./zombienet/docker | |
run: | | |
make polkadot_builder_image_info | |
docker_manifest: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 60 | |
needs: [build_polkadot_builder] | |
steps: | |
- name: "Сheck if polkadot_builder is required" | |
run: | | |
if [ "${{ github.event.inputs.polkadot_builder }}" != "true" ]; then | |
echo "Polkadot Builder is not required" | |
echo "skip=true" >> $GITHUB_ENV | |
fi | |
- name: Checkout repository | |
if: env.skip != 'true' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch master branch | |
if: env.skip != 'true' | |
run: | | |
git fetch origin master:master | |
- name : "Authenticate with Google Cloud" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
if: env.skip != 'true' | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Check if image tag exists using Makefile" | |
if: env.skip != 'true' | |
id: check-tag | |
working-directory: ./zombienet/docker | |
run: | | |
make set_versions | |
exists=$(make polkadot_builder_check_tag) | |
echo "Image Exists: $exists" | |
echo "exists=$exists" >> $GITHUB_ENV | |
- name: "Build Polkadot Builder" | |
working-directory: ./zombienet/docker | |
if: env.exists == 'false' || env.skip != 'true' | |
run: | | |
make polkadot_builder_push_manifest | |
- name: "Versions Info" | |
if: always() && env.skip != 'true' | |
working-directory: ./zombienet/docker | |
run: | | |
make polkadot_builder_image_info | |
building_binaries: | |
if: github.event.inputs.polkadot_binaries == 'true' | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: linux/amd64 | |
runner: [ actions-runner-controller ] | |
- platform: linux/arm64 | |
runner: [ self-hosted, qdrvm-arm64 ] | |
needs: | |
- build_polkadot_builder | |
- docker_manifest | |
timeout-minutes: 120 | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch master branch | |
run: | | |
git fetch origin master:master | |
# - uses: actions/cache@v4 | |
# with: | |
# path: ${{ env.CACHE_PATHS }} | |
# key: ${{ runner.os }}-rust-${{ env.CACHE_VERSION }} | |
- name: "Authenticate with Google Cloud" | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Build target" | |
working-directory: ./zombienet/docker | |
run: | | |
make polkadot_binary | |
- name: "Push Polkadot APT Package" | |
working-directory: ./zombienet/docker | |
run: | | |
make upload_apt_package | |
- name: "Debian package Info" | |
if: always() | |
working-directory: ./zombienet/docker | |
run: | | |
make polkadot_deb_package_info | |
build_zombie_tester: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: linux/amd64 | |
os: ubuntu-24.04 | |
- platform: linux/arm64 | |
os: ubuntu-24.04-arm | |
timeout-minutes: 60 | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
steps: | |
- name: "Сheck if zombie_tester is required" | |
run: | | |
if [ "${{ github.event.inputs.zombie_tester }}" != "true" ]; then | |
echo "Zombie Tester is not required" | |
echo "skip=true" >> $GITHUB_ENV | |
fi | |
- name: Checkout repository | |
if: env.skip != 'true' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch master branch | |
if: env.skip != 'true' | |
run: | | |
git fetch origin master:master | |
- name : "Authenticate with Google Cloud" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
if: env.skip != 'true' | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Check if image tag exists using Makefile" | |
if: env.skip != 'true' | |
id: check-tag | |
working-directory: ./zombienet/docker | |
run: | | |
make get_versions | |
exists=$(make zombie_tester_check_tag) | |
echo "Image Exists: $exists" | |
echo "exists=$exists" >> $GITHUB_ENV | |
- name: "Build Zombie Tester" | |
working-directory: ./zombienet/docker | |
if: env.exists == 'false' || env.skip != 'true' | |
run: | | |
make zombie_tester && make zombie_tester_push | |
- name: "Versions Info" | |
if: always() && env.skip != 'true' | |
working-directory: ./zombienet/docker | |
run: | | |
make zombie_tester_image_info | |
zombie_tester_manifest: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 60 | |
needs: [build_zombie_tester] | |
steps: | |
- name: "Сheck if zombie_tester is required" | |
run: | | |
if [ "${{ github.event.inputs.zombie_tester }}" != "true" ]; then | |
echo "Zombie Tester is not required" | |
echo "skip=true" >> $GITHUB_ENV | |
fi | |
- name: Checkout repository | |
if: env.skip != 'true' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch master branch | |
if: env.skip != 'true' | |
run: | | |
git fetch origin master:master | |
- name : "Authenticate with Google Cloud" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | |
- name: "Set up Cloud SDK" | |
if: env.skip != 'true' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: "Configure Docker for GCR" | |
if: env.skip != 'true' | |
run: | | |
gcloud auth configure-docker --quiet | |
gcloud auth configure-docker ${{ secrets.GCP_REGISTRY }} --quiet | |
- name: "Check if image tag exists using Makefile" | |
if: env.skip != 'true' | |
id: check-tag | |
working-directory: ./zombienet/docker | |
run: | | |
make get_versions | |
exists=$(make zombie_tester_check_tag) | |
echo "Image Exists: $exists" | |
echo "exists=$exists" >> $GITHUB_ENV | |
- name: "Build Zombie Tester" | |
working-directory: ./zombienet/docker | |
if: env.exists == 'false' || env.skip != 'true' | |
run: | | |
make zombie_tester_push_manifest | |
- name: "Versions Info" | |
if: always() && env.skip != 'true' | |
working-directory: ./zombienet/docker | |
run: | | |
make zombie_tester_image_info | |