mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-11 15:16:21 +02:00
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>
86 lines
2.5 KiB
Bash
Executable File
86 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2021 The Flatcar Maintainers.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
set -eu
|
|
|
|
cd $(dirname "$0")
|
|
source sdk_lib/sdk_container_common.sh
|
|
|
|
seed_version=""
|
|
target_version=""
|
|
logdir=''
|
|
|
|
declare -a cleanup
|
|
|
|
# --
|
|
|
|
usage() {
|
|
echo " Usage:"
|
|
echo " $0 <seed-sdk-version> <new-sdk-version> [-x <cleanup-script>]"
|
|
echo
|
|
echo " This script will bootstrap a new SDK tarball using an SDK container."
|
|
echo " '$sdk_container_common_versionfile' will be updated to the target version."
|
|
echo
|
|
echo " <seed-sdk-vernum> - SDK version number (e.g. '3005.0.0') to use for bootstrapping."
|
|
echo " The SDK container will be pulled and the tarball"
|
|
echo " downloaded if necessary."
|
|
echo " <new-sdk-vernum> - SDK version number (e.g. '3027.0.0') of the new SDK."
|
|
echo " -x <cleanup-script> - For each resource generated during build (container etc.)"
|
|
echo " add a cleanup line to <script> which, when run, will free"
|
|
echo " the resource. Useful for CI."
|
|
echo " -l <directory> - Gather build logs here."
|
|
echo " -h - Print this help."
|
|
echo
|
|
}
|
|
# --
|
|
|
|
while [ 0 -lt $# ] ; do
|
|
case "$1" in
|
|
-h) usage; exit 0;;
|
|
-l) logdir=${2}; shift 2;;
|
|
-x) cleanup=("-x" "$2"); shift; shift;;
|
|
*) if [ -z "$seed_version" ] ; then
|
|
seed_version="$1"
|
|
elif [ -z "$target_version" ] ; then
|
|
target_version="$1"
|
|
else
|
|
echo "ERROR: Spurious positional parameter '$1'"
|
|
usage; exit 1;
|
|
fi
|
|
shift;;
|
|
esac
|
|
done
|
|
|
|
if [ -z "$seed_version" -o -z "$target_version" ] ; then
|
|
echo "ERROR: Missing seed and /or target SDK version."
|
|
usage
|
|
exit 1
|
|
fi
|
|
# --
|
|
|
|
vernum="$(strip_version_prefix "$target_version")"
|
|
if is_official "$vernum" ; then
|
|
official="true"
|
|
else
|
|
official="false"
|
|
fi
|
|
|
|
yell "\n######\n###### Bootstrapping SDK version $target_version from seed ($seed_version)"
|
|
|
|
if $official; then
|
|
export COREOS_OFFICIAL=1
|
|
fi
|
|
|
|
# bootstrap_sdk needs FLATCAR_SDK_VERSION set to the seed version
|
|
failed=''
|
|
./run_sdk_container "${cleanup[@]}" -V "$seed_version" -v "$target_version" \
|
|
sudo -E ./bootstrap_sdk || failed=x
|
|
|
|
# Update versionfile to the actual SDK version
|
|
create_versionfile "${target_version}"
|
|
|
|
if [[ -n ${failed} ]]; then exit 1; fi
|