flatcar-scripts/sdk_lib/setup_boards.sh
Krzesimir Nowak f373f06fb7 *: Scavenge for configure logs and upload them to bincache
This searches for portage logs and configure logs after a build, and
uploads them to bincache. This is currently only done for SDK builds,
SDK container builds and package builds. This probably could be
extended to catch logs for sysext builds, but this was annoying to
implement, IIRC.

Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
2026-04-30 14:54:23 +02:00

50 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Script used in Dockerfile.sdk-build. The failure is indicated by the
# BUILD_PACKAGES_FAILED file in the scripts directory in the built
# docker image. We do it to be able to recover the build logs from
# failed builds too.
set -euo pipefail
phase=${1}; shift
case ${phase} in
start)
binhost=${1}; shift
if ! ( ./setup_board --board="arm64-usr" --binhost="${binhost}/arm64-usr" && \
./setup_board --board="arm64-usr" --regen_configs && \
./build_packages --board="arm64-usr" --only_resolve_circular_deps && \
\
./setup_board --board="amd64-usr" --binhost="${binhost}/amd64-usr" && \
./setup_board --board="amd64-usr" --regen_configs && \
./build_packages --board="amd64-usr" --only_resolve_circular_deps ); then
touch BUILD_PACKAGES_FAILED
fi
exit 0
;;
finish)
logdir=''
if [[ ${#} -gt 0 ]]; then
logdir=${1}; shift
fi
if [[ -n ${logdir} ]]; then
for arch in amd64 arm64; do
cp -a "/build/${arch}-usr/var/log/portage" "${logdir}/${arch}-package-logs"
done
fi
if [[ -e BUILD_PACKAGES_FAILED ]]; then
rm -f BUILD_PACKAGES_FAILED
exit 1
fi
exit 0
;;
*)
echo "wrong phase ${phase@Q}" >&2
exit 1
;;
esac