ci: run main amd64 image builds in parallel [CI SKIP]

This commit is contained in:
justme committed 2026-10-06 15:59:54 +08:00
1 parent dd6ac4258d
commit 19c6cab104
2 files changed
+41 -21

No files matched your search

+18 -2
View File
@@ -16,10 +16,26 @@ when:
concurrency: 1 concurrency: 1
steps: steps:
- name: build-linux-amd64-images - name: build-linux-amd64-backend
image: bash image: bash
environment: environment:
NUGET_PACKAGES: /home/justme/.nuget/packages NUGET_PACKAGES: /home/justme/.nuget/packages
commands: 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: [] depends_on: []
+23 -19
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/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 set -euo pipefail
[[ "${CI_PIPELINE_EVENT:-}" == push && "${CI_COMMIT_BRANCH:-}" == main && "${CI_COMMIT_MESSAGE:-}" == *"[CI]"* ]] || { [[ "${CI_PIPELINE_EVENT:-}" == push && "${CI_COMMIT_BRANCH:-}" == main && "${CI_COMMIT_MESSAGE:-}" == *"[CI]"* ]] || {
@@ -7,26 +7,30 @@ set -euo pipefail
exit 2 exit 2
} }
component="${1:?usage: build-main-amd64.sh <backend|agent|probe>}"
case "$component" in
backend|agent|probe) ;;
*) echo "unsupported component: $component" >&2; exit 2 ;;
esac
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
work="$root/.release/main-amd64-build" work="$root/.release/main-amd64-build"
base_home="/home/justme/woodpecker/buildah-home/main-amd64-build" base_home="/home/justme/woodpecker/buildah-home/main-amd64-build-$component"
mkdir -p "$work" mkdir -p "$work" "$base_home"
export IMAGE_PUBLISH=false
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 export HOME="$base_home"
context="$work/$component" export BUILDAH_HOME="$base_home"
home="$base_home-$component" export REGISTRY_AUTH_FILE="$work/$component-auth.json"
mkdir -p "$home" context="$work/$component"
export HOME="$home"
export BUILDAH_HOME="$home"
export REGISTRY_AUTH_FILE="$work/$component-auth.json"
python3 "$root/ci/stage-node-image.py" "$component" "$context" python3 "$root/ci/stage-node-image.py" "$component" "$context"
buildah bud --layers --network host --tls-verify=true --arch amd64 \ buildah bud --layers --network host --tls-verify=true --arch amd64 \
--build-arg APP_VERSION=main \ --build-arg APP_VERSION=main \
-f "$context/Containerfile" \ -f "$context/Containerfile" \
-t "localhost/monitor-$component:main-amd64-check" "$context" -t "localhost/monitor-$component:main-amd64-check" "$context"
echo "built local Linux amd64 $component image; not publishing it" echo "built local Linux amd64 $component image; not publishing it"
done