blob: e3078e2564a7fe5889820e76ee51fa4de588d234 [file] [log] [blame]
#!/bin/bash
set -eux -o pipefail
shopt -s failglob
ZUUL_JOB_NAME=$(jq < ~/zuul-env.json -r '.job')
ZUUL_PROJECT_SRC_DIR=$HOME/$(jq < ~/zuul-env.json -r '.project.src_dir')
ZUUL_PROJECT_SHORT_NAME=$(jq < ~/zuul-env.json -r '.project.short_name')
CI_PARALLEL_JOBS=$(awk -vcpu=$(getconf _NPROCESSORS_ONLN) 'BEGIN{printf "%.0f", cpu*1.3+1}')
BUILD_DIR=~/build
mkdir ${BUILD_DIR}
cd ${BUILD_DIR}
${ZUUL_PROJECT_SRC_DIR}/dev-setup-git.sh
if [[ "${ZUUL_JOB_NAME}" =~ clearfog ]]; then
make czechlight_clearfog_defconfig
elif [[ "${ZUUL_JOB_NAME}" =~ beagleboneblack ]]; then
make czechlight_beaglebone_defconfig
else
echo "Unrecognized job name, cannot determine defconfig target"
exit 1
fi
echo BR2_PRIMARY_SITE=\"https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-public/mirror/buildroot\" >> .config
make source -j${CI_PARALLEL_JOBS} --output-sync=target
make -j${CI_PARALLEL_JOBS} --output-sync=target rootfs-czechlight-rauc
mv images/update.raucb ~/zuul-output/artifacts/
if [[ "${ZUUL_JOB_NAME}" =~ clearfog ]]; then
mv images/u-boot-spl.kwb ~/zuul-output/artifacts/
fi
# TODO: USB image as well? (`fallocate -d` to make it sparse)
# TODO: make legal-info