mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 22:21:10 +02:00
The logic of the inline bash scripts of each job was sometimes separated into the flatcar-scripts/jenkins/*.sh helpers but mostly part of the Groovy file. This coupling had its advantages but also downsides when special cases needed to be added for different release versions. Other issues were that the inline scripts needed the backslash character to be escaped twice and Jenkins was not good in terminating the child processes when stopping a job. Having inline bash scripts in Groovy also mandated the use of Jenkins to build and release Flatcar Container Linux which hinders test builds in other CI platforms. Move the inline bash scripts fully to to the files in flatcar-scripts/jenkins/ and create new ones for job that didn't have a script there yet. Also invoke them through a systemd-run wrapper script which ensures that all child processes are terminated and also sets up /opt/bin as additional path for the static lbzcat binary. A workaround for bash 4 was needed to use a temporary file instead of the <(cmd) bash feature which caused a strange syntax error, otherwise the bash commands are moved as they are.
53 lines
1.4 KiB
Bash
Executable File
53 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
rm -rf *.tap _kola_temp*
|
|
|
|
# If the OFFER is empty, it should be treated as the basic offering.
|
|
if [[ "${OFFER}" == "" ]]; then
|
|
OFFER="basic"
|
|
fi
|
|
|
|
# Append the offer as oem suffix.
|
|
if [[ "${OFFER}" != "basic" ]]; then
|
|
OEM_SUFFIX="_${OFFER}"
|
|
fi
|
|
|
|
# Create a name that includes the OEM_SUFFIX,
|
|
# but replace _ with -, as gcloud doesn't like it otherwise.
|
|
OEMNAME="jenkins-${JOB_NAME##*/}${OEM_SUFFIX}-${BUILD_NUMBER}"
|
|
NAME=${OEMNAME//_/-}
|
|
|
|
bin/ore gcloud create-image \
|
|
--board="${BOARD}" \
|
|
--family="${NAME}" \
|
|
--json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
|
|
--source-root="${DOWNLOAD_ROOT}/boards" \
|
|
--source-name=flatcar_production_gce${OEM_SUFFIX}.tar.gz \
|
|
--version="${FLATCAR_VERSION}"
|
|
|
|
GCE_NAME="${NAME//[+.]/-}-${FLATCAR_VERSION//[+.]/-}"
|
|
|
|
trap 'bin/ore gcloud delete-images \
|
|
--json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
|
|
"${GCE_NAME}"' EXIT
|
|
|
|
if [[ "${KOLA_TESTS}" == "" ]]; then
|
|
KOLA_TESTS="*"
|
|
fi
|
|
|
|
# Do not expand the kola test patterns globs
|
|
set -o noglob
|
|
timeout --signal=SIGQUIT 6h bin/kola run \
|
|
--basename="${NAME}" \
|
|
--gce-image="${GCE_NAME}" \
|
|
--gce-json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
|
|
--gce-machinetype="${GCE_MACHINE_TYPE}" \
|
|
--parallel=4 \
|
|
--platform=gce \
|
|
--channel="${GROUP}" \
|
|
--tapfile="${JOB_NAME##*/}.tap" \
|
|
--torcx-manifest=torcx_manifest.json \
|
|
${KOLA_TESTS}
|
|
set +o noglob
|