33 lines
1.2 KiB
Bash
33 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Build all main Linux amd64 runtime images locally when a commit opts into CI.
|
|
set -euo pipefail
|
|
|
|
[[ "${CI_PIPELINE_EVENT:-}" == push && "${CI_COMMIT_BRANCH:-}" == main && "${CI_COMMIT_MESSAGE:-}" == *"[CI]"* ]] || {
|
|
echo "main amd64 builds require a main push with [CI] in the commit message" >&2
|
|
exit 2
|
|
}
|
|
|
|
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
|
|
|
|
BUILDAH_HOME="$base_home-backend" IMAGE_PUBLISH=false bash "$root/ci/release-linux.sh" amd64 backend
|
|
|
|
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"
|
|
|
|
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
|