stashed work

This commit is contained in:
Krzesimir Nowak 2025-05-20 13:34:50 +02:00
parent aeb9d8e2b9
commit 0ed427c82c
6 changed files with 24 additions and 13 deletions

View File

@ -118,7 +118,7 @@ if [ "${image_present}" = "${import_tarball}" ] ; then
else
yell "Importing SDK tarball"
if [ -n "$cleanup" ] ; then
echo "$docker image rm -f '${import_tarball}'" >> "$cleanup"
prepend_cleanup "${cleanup}" "${docker} image rm -f '${import_tarball}'"
fi
$docker import "${tarball}" "${import_tarball}"
fi
@ -135,7 +135,7 @@ if [ "$image_present" = "${import_image}" ] ; then
else
yell "Building plain SDK import image"
if [ -n "$cleanup" ] ; then
echo "$docker image rm -f '${import_image}'" >> "$cleanup"
prepend_cleanup "${cleanup}" "${docker} image rm -f '${import_image}'"
fi
$docker build -t "$import_image" \
--build-arg VERSION="${docker_vernum}" \
@ -168,7 +168,7 @@ else
toolchains_container="flatcar-sdk-toolchains-build-${docker_vernum}"
if [ -n "$cleanup" ] ; then
echo "$docker container rm -f '${toolchains_container}'" >> "$cleanup"
prepend_cleanup "${cleanup}" "${docker} container rm -f '${toolchains_container}'"
fi
./run_sdk_container -C "${import_image}" -n "${toolchains_container}" \
sudo ./build_toolchains --seed_tarball="./${tarball}"
@ -194,7 +194,7 @@ else
# Spin up temporary toolchains package binhost
if [ -n "$cleanup" ] ; then
echo "$docker container rm -f '${binhost_container}'" >> "$cleanup"
prepend_cleanup "${cleanup}" "${docker} container rm -f '${binhost_container}'"
fi
$docker run --rm -d -p "${binhost}":80 \
--name ${binhost_container} \
@ -206,7 +206,7 @@ else
yell "Initialising the SDK container and building board packages"
if [ -n "$cleanup" ] ; then
echo "$docker image rm -f '${sdk_build_image}'" >> "$cleanup"
prepend_cleanup "${cleanup}" "${docker} image rm -f '${sdk_build_image}'"
fi
$docker build -t "${sdk_build_image}" \
--build-arg VERSION="${docker_vernum}" \

View File

@ -62,6 +62,7 @@ function packages_build() {
function _packages_build_impl() {
local arch="$1"
source sdk_lib/sdk_container_common.sh
source ci-automation/ci_automation_common.sh
source ci-automation/gpg_setup.sh
@ -75,7 +76,7 @@ function _packages_build_impl() {
docker_image_from_registry_or_buildcache "${sdk_name}" "${docker_sdk_vernum}"
local sdk_image="$(docker_image_fullname "${sdk_name}" "${docker_sdk_vernum}")"
echo "docker image rm -f '${sdk_image}'" >> ./ci-cleanup.sh
prepend_cleanup ./ci-cleanup.sh "docker image rm -f '${sdk_image}'"
# Set name of the packages container for later rename / export
local vernum="${FLATCAR_VERSION}"
@ -83,8 +84,6 @@ function _packages_build_impl() {
local packages_container="flatcar-packages-${arch}-${docker_vernum}"
local torcx_pkg_url="https://${BUILDCACHE_SERVER}/images/${arch}/${vernum}/torcx"
source sdk_lib/sdk_container_common.sh
if is_official "${vernum}"; then
# A channel returned by get_git_channel should not ever be
# "developer" here, because it's an official build done from

View File

@ -203,7 +203,7 @@ function _release_build_impl() {
local mantle_ref
mantle_ref=$(cat sdk_container/.repo/manifests/mantle-container)
# A job on each worker prunes old mantle images (docker image prune), no need to do it here
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
prepend_cleanup ./ci-cleanup.sh "docker rm -f '${container_name}'"
touch sdk_container/.env # This file should already contain the required credentials as env vars
docker run --pull always --rm --name="${container_name}" --net host \

View File

@ -186,7 +186,7 @@ function _test_run_impl() {
local print_give_up=true
local failed_tests=()
# A job on each worker prunes old mantle images (docker image prune)
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
prepend_cleanup ./ci-cleanup.sh "docker rm -f '${container_name}'"
local image_escaped
printf -v image_escaped '%q' "${image}"

View File

@ -100,7 +100,7 @@ hostname="${name:0:63}"
hostname="${hostname//./_}"
if [ -n "$cleanup" ] ; then
echo "$docker container rm -f '${name}'" >> "$cleanup"
prepend_cleanup "${cleanup}" "${docker} container rm -f '${name}'"
fi
if [ -z "$stat" ] ; then

View File

@ -262,8 +262,6 @@ EOF
export BOTO_PATH
export GOOGLE_APPLICATION_CREDENTIALS
}
# --
# Generate volume mount command line options for docker
@ -294,3 +292,17 @@ function gnupg_ssh_gcloud_mount_opts() {
fi
fi
}
# --
function prepend_cleanup() {
local cleanup_file=${1}; shift
local command=${1}; shift
local tmpfile old
tmpfile=$(mktemp "${cleanup_file}-XXXXXX")
old=$(cat "${cleanup_file}" 2>/dev/null || :)
printf '%s\n%s\n' "${command}" "${old}" >"${tmpfile}"
mv -f "${tmpfile}" "${cleanup_file}"
}
# --