SDK container: enable binpkg cache for nightly builds

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
This commit is contained in:
Thilo Fromm 2022-01-12 15:44:30 +01:00
parent f9b51461ab
commit 719689992c
2 changed files with 18 additions and 6 deletions

View File

@ -147,7 +147,7 @@ get_board_binhost() {
if [[ "${FLATCAR_BUILD_ID}" =~ ^nightly-.*$ ]] ; then
# containerised nightly build; this uses [VERSION]-[BUILD_ID] for binpkg url
# and toolchain packages are at the same location as OS image ones
set -- "${FLATCAR_VERSION_ID}-${FLATCAR_BUILD_ID}"
set -- "${FLATCAR_VERSION_ID}+${FLATCAR_BUILD_ID}"
pkgs_include_toolchain=1
else
set -- "${FLATCAR_VERSION_ID}"
@ -189,7 +189,12 @@ get_sdk_binhost() {
set -- "${FLATCAR_SDK_VERSION}"
fi
FLATCAR_DEV_BUILDS_SDK="${FLATCAR_DEV_BUILDS_SDK-$FLATCAR_DEV_BUILDS/sdk}"
if [ "${FLATCAR_DEV_BUILDS}" != "${SETTING_BINPKG_SERVER_DEV_CONTAINERISED}" ] ; then
FLATCAR_DEV_BUILDS_SDK="${FLATCAR_DEV_BUILDS_SDK-${FLATCAR_DEV_BUILDS}/sdk}"
else
# ALWAYS use a released SDK version, never a nightly, for SDK binpkgs
FLATCAR_DEV_BUILDS_SDK="${FLATCAR_DEV_BUILDS_SDK-${SETTING_BINPKG_SERVER_PROD}/sdk}"
fi
for ver in "$@"; do
# Usually only crossdev needs to be fetched from /toolchain/ in the setup_board step.
# The entry for /pkgs/ is there if something needs to be reinstalled in the SDK

View File

@ -15,24 +15,31 @@ chown -R sdk:sdk /home/sdk
(
source /etc/lsb-release # SDK version in DISTRIB_RELEASE
source /mnt/host/source/.repo/manifests/version.txt # OS image version in FLATCAR_VERSION_ID
version="${FLATCAR_VERSION_ID}"
if [ "${FLATCAR_VERSION_ID}" != "${DISTRIB_RELEASE}" ] ; then
# If this is a nightly build tag we can use pre-built binaries directly from the
# build cache.
if [[ "${FLATCAR_BUILD_ID}" =~ ^nightly-.*$ ]] ; then
version="${FLATCAR_VERSION_ID}+${FLATCAR_BUILD_ID}"
fi
if [ "${version}" != "${DISTRIB_RELEASE}" ] ; then
for target in amd64-usr arm64-usr; do
if [ ! -d "/build/$target" ] ; then
continue
fi
if [ -f "/build/$target/etc/target-version.txt" ] ; then
source "/build/$target/etc/target-version.txt"
if [ "${TARGET_FLATCAR_VERSION_ID}" = "${FLATCAR_VERSION_ID}" ] ; then
if [ "${TARGET_FLATCAR_VERSION}" = "${version}" ] ; then
continue # already updated
fi
fi
echo
echo "Updating board support in '/build/${target}' to use package cache for version '${FLATCAR_VERSION_ID}'"
echo "Updating board support in '/build/${target}' to use package cache for version '${version}'"
echo "---"
sudo su sdk -l -c "/home/sdk/trunk/src/scripts/setup_board --board='$target' --regen_configs_only"
echo "TARGET_FLATCAR_VERSION_ID='${FLATCAR_VERSION_ID}'" | sudo tee "/build/$target/etc/target-version.txt" >/dev/null
echo "TARGET_FLATCAR_VERSION='${version}'" | sudo tee "/build/$target/etc/target-version.txt" >/dev/null
done
fi
)