mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
Support grabbing portage buildbot artifacts
Review URL: http://codereview.chromium.org/660381
This commit is contained in:
parent
14fba2e3b0
commit
55f65f8bc1
@ -148,12 +148,16 @@ function validate_and_set_param_defaults() {
|
|||||||
FLAGS_image_to_live=${FLAGS_TRUE}
|
FLAGS_image_to_live=${FLAGS_TRUE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Grabbing a buildbot build is exclusive with building
|
# Grabbing a buildbot build is exclusive with syncing and building
|
||||||
if [[ -n "${FLAGS_grab_buildbot}" ]]; then
|
if [[ -n "${FLAGS_grab_buildbot}" ]]; then
|
||||||
if [[ -z "${FLAGS_buildbot_uri}" ]]; then
|
if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then
|
||||||
echo "--grab_buildbot requires --buildbot_uri"
|
if [[ -z "${FLAGS_buildbot_uri}" ]]; then
|
||||||
exit 1
|
echo "--grab_buildbot=LATEST requires --buildbot_uri or setting "
|
||||||
|
echo "BUILDBOT_URI"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
FLAGS_sync=${FLAGS_FALSE}
|
||||||
FLAGS_build=${FLAGS_FALSE}
|
FLAGS_build=${FLAGS_FALSE}
|
||||||
FLAGS_master=${FLAGS_FALSE}
|
FLAGS_master=${FLAGS_FALSE}
|
||||||
fi
|
fi
|
||||||
@ -239,7 +243,12 @@ function describe_steps() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then
|
||||||
echo " * Make image able to run tests (mod_image_for_test)"
|
if [[ -n "${FLAGS_grab_buildbot}" ]]; then
|
||||||
|
echo " * Use the prebuilt image modded for test (rootfs_test.image)"
|
||||||
|
echo " * Install prebuilt cross-compiled autotests in chroot"
|
||||||
|
else
|
||||||
|
echo " * Make image able to run tests (mod_image_for_test)"
|
||||||
|
fi
|
||||||
set_passwd=${FLAGS_TRUE}
|
set_passwd=${FLAGS_TRUE}
|
||||||
fi
|
fi
|
||||||
if [[ ${set_passwd} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${set_passwd} -eq ${FLAGS_TRUE} ]]; then
|
||||||
@ -322,6 +331,14 @@ function describe_phase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Called when there is a failure and we exit early
|
||||||
|
function failure() {
|
||||||
|
trap - EXIT
|
||||||
|
describe_phase "Failure during: ${LAST_PHASE}"
|
||||||
|
show_duration
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Runs a phase, describing it first, and also updates the sudo timeout
|
# Runs a phase, describing it first, and also updates the sudo timeout
|
||||||
# afterwards.
|
# afterwards.
|
||||||
# Arguments:
|
# Arguments:
|
||||||
@ -330,6 +347,7 @@ function describe_phase() {
|
|||||||
function run_phase() {
|
function run_phase() {
|
||||||
local desc="$1"
|
local desc="$1"
|
||||||
shift
|
shift
|
||||||
|
LAST_PHASE="${desc}"
|
||||||
describe_phase "${desc}"
|
describe_phase "${desc}"
|
||||||
echo "+ $@"
|
echo "+ $@"
|
||||||
"$@"
|
"$@"
|
||||||
@ -419,20 +437,38 @@ function grab_buildbot() {
|
|||||||
cd "${dl_dir}"
|
cd "${dl_dir}"
|
||||||
unzip image.zip
|
unzip image.zip
|
||||||
check_rootfs_validity
|
check_rootfs_validity
|
||||||
echo "Copying in local_repo/local_packages"
|
|
||||||
# TODO(kmixter): Make this architecture indep once buildbot is.
|
|
||||||
mv -f local_repo/local_packages/* "${FLAGS_top}/src/build/x86/local_packages"
|
|
||||||
local image_basename=$(basename $(dirname "${FLAGS_grab_buildbot}"))
|
local image_basename=$(basename $(dirname "${FLAGS_grab_buildbot}"))
|
||||||
local image_dir="${FLAGS_top}/src/build/images/${image_basename}"
|
local image_base_dir="${FLAGS_top}/src/build/images/${FLAGS_board}"
|
||||||
|
local image_dir="${image_base_dir}/${image_basename}"
|
||||||
echo "Copying in build image to ${image_dir}"
|
echo "Copying in build image to ${image_dir}"
|
||||||
rm -rf "${image_dir}"
|
rm -rf "${image_dir}"
|
||||||
mkdir -p "${image_dir}"
|
mkdir -p "${image_dir}"
|
||||||
# Note that if mbr.image does not exist, this image was not successful.
|
# Note that if mbr.image does not exist, this image was not successful.
|
||||||
mv mbr.image rootfs.image "${image_dir}"
|
mv mbr.image rootfs.image "${image_dir}"
|
||||||
|
if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then
|
||||||
|
run_phase "Installing buildbot test modified image" \
|
||||||
|
mv rootfs_test.image "${image_dir}/rootfs.image"
|
||||||
|
FLAGS_mod_image_for_test=${FLAGS_FALSE}
|
||||||
|
if [[ -e "autotest.tgz" || -e "autotest.tar.bz2" ]]; then
|
||||||
|
# pull in autotest
|
||||||
|
local dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local"
|
||||||
|
local tar_args="xzf"
|
||||||
|
local tar_name="${dl_dir}/autotest.tgz"
|
||||||
|
if [[ -e "autotest.tar.bz2" ]]; then
|
||||||
|
tar_args="xjf"
|
||||||
|
tar_name="${dl_dir}/autotest.tar.bz2"
|
||||||
|
fi
|
||||||
|
sudo rm -rf "${dir}/autotest"
|
||||||
|
cd ${dir}
|
||||||
|
run_phase "Installing buildbot autotest cross-compiled binaries" \
|
||||||
|
sudo tar ${tar_args} "${tar_name}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
chdir_relative .
|
chdir_relative .
|
||||||
run_phase "Removing downloaded image" rm -rf "${dl_dir}"
|
run_phase "Removing downloaded image" rm -rf "${dl_dir}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
assert_outside_chroot
|
assert_outside_chroot
|
||||||
assert_not_root_user
|
assert_not_root_user
|
||||||
@ -454,6 +490,7 @@ function main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
set_start_time
|
set_start_time
|
||||||
|
trap failure EXIT
|
||||||
|
|
||||||
local withdev_param=""
|
local withdev_param=""
|
||||||
if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]]; then
|
if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]]; then
|
||||||
@ -501,11 +538,9 @@ function main() {
|
|||||||
./build_packages "${board_param}" \
|
./build_packages "${board_param}" \
|
||||||
${jobs_param} ${withdev_param} ${build_autotest_param}
|
${jobs_param} ${withdev_param} ${build_autotest_param}
|
||||||
|
|
||||||
# TODO(kmixter): Enable this once build_tests works, but even
|
run_phase_in_chroot "Building unit tests" ./build_tests.sh ${board_param}
|
||||||
# then only do it when not cross compiling.
|
if [[ "${FLAGS_board}" == "x86-generic" ]]; then
|
||||||
if [[ '' ]]; then
|
run_phase_in_chroot "Running unit tests" ./run_tests.sh ${board_param}
|
||||||
run_phase_in_chroot "Building and running unit tests" \
|
|
||||||
"./build_tests.sh && ./run_tests.sh"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -548,6 +583,7 @@ function main() {
|
|||||||
"${board_param}"
|
"${board_param}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
trap - EXIT
|
||||||
echo "Successfully used ${FLAGS_top} to:"
|
echo "Successfully used ${FLAGS_top} to:"
|
||||||
describe_steps
|
describe_steps
|
||||||
show_duration
|
show_duration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user