From 19c6cab1044654205cb126f5fefbd915950fc008 Mon Sep 17 00:00:00 2001 From: JustMe Date: Tue, 6 Oct 2026 15:59:54 +0800 Subject: [PATCH] ci: run main amd64 image builds in parallel [CI SKIP] --- .woodpecker/main-amd64-build.yml | 20 +++++++++++++-- ci/build-main-amd64.sh | 42 +++++++++++++++++--------------- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/.woodpecker/main-amd64-build.yml b/.woodpecker/main-amd64-build.yml index 5e506d7..18b0a1c 100644 --- a/.woodpecker/main-amd64-build.yml +++ b/.woodpecker/main-amd64-build.yml @@ -16,10 +16,26 @@ when: concurrency: 1 steps: - - name: build-linux-amd64-images + - name: build-linux-amd64-backend image: bash environment: NUGET_PACKAGES: /home/justme/.nuget/packages commands: - - bash ci/build-main-amd64.sh + - bash ci/build-main-amd64.sh backend + depends_on: [] + + - name: build-linux-amd64-agent + image: bash + environment: + NUGET_PACKAGES: /home/justme/.nuget/packages + commands: + - bash ci/build-main-amd64.sh agent + depends_on: [] + + - name: build-linux-amd64-probe + image: bash + environment: + NUGET_PACKAGES: /home/justme/.nuget/packages + commands: + - bash ci/build-main-amd64.sh probe depends_on: [] diff --git a/ci/build-main-amd64.sh b/ci/build-main-amd64.sh index eb59e50..8d0fe54 100644 --- a/ci/build-main-amd64.sh +++ b/ci/build-main-amd64.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build all main Linux amd64 runtime images locally when a commit opts into CI. +# Build one Linux amd64 runtime image locally for an opt-in main commit. set -euo pipefail [[ "${CI_PIPELINE_EVENT:-}" == push && "${CI_COMMIT_BRANCH:-}" == main && "${CI_COMMIT_MESSAGE:-}" == *"[CI]"* ]] || { @@ -7,26 +7,30 @@ set -euo pipefail exit 2 } +component="${1:?usage: build-main-amd64.sh }" +case "$component" in + backend|agent|probe) ;; + *) echo "unsupported component: $component" >&2; exit 2 ;; +esac + root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" work="$root/.release/main-amd64-build" -base_home="/home/justme/woodpecker/buildah-home/main-amd64-build" -mkdir -p "$work" -export IMAGE_PUBLISH=false +base_home="/home/justme/woodpecker/buildah-home/main-amd64-build-$component" +mkdir -p "$work" "$base_home" -BUILDAH_HOME="$base_home-backend" IMAGE_PUBLISH=false bash "$root/ci/release-linux.sh" amd64 backend +if [[ "$component" == backend ]]; then + BUILDAH_HOME="$base_home" IMAGE_PUBLISH=false bash "$root/ci/release-linux.sh" amd64 backend + exit 0 +fi -for component in agent probe; do - context="$work/$component" - home="$base_home-$component" - mkdir -p "$home" - export HOME="$home" - export BUILDAH_HOME="$home" - export REGISTRY_AUTH_FILE="$work/$component-auth.json" +export HOME="$base_home" +export BUILDAH_HOME="$base_home" +export REGISTRY_AUTH_FILE="$work/$component-auth.json" +context="$work/$component" - python3 "$root/ci/stage-node-image.py" "$component" "$context" - buildah bud --layers --network host --tls-verify=true --arch amd64 \ - --build-arg APP_VERSION=main \ - -f "$context/Containerfile" \ - -t "localhost/monitor-$component:main-amd64-check" "$context" - echo "built local Linux amd64 $component image; not publishing it" -done +python3 "$root/ci/stage-node-image.py" "$component" "$context" +buildah bud --layers --network host --tls-verify=true --arch amd64 \ + --build-arg APP_VERSION=main \ + -f "$context/Containerfile" \ + -t "localhost/monitor-$component:main-amd64-check" "$context" +echo "built local Linux amd64 $component image; not publishing it"