mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 13:36:58 +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.
24 lines
588 B
Bash
Executable File
24 lines
588 B
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
rm -f ami.properties images.json
|
|
|
|
[ -s verify.asc ] && verify_key=--verify-key=verify.asc || verify_key=
|
|
|
|
bin/plume pre-release --force \
|
|
--debug \
|
|
--platform=aws \
|
|
--aws-credentials="${AWS_CREDENTIALS}" \
|
|
--gce-json-key="${GOOGLE_APPLICATION_CREDENTIALS}" \
|
|
--board="${BOARD}" \
|
|
--channel="${CHANNEL}" \
|
|
--version="${FLATCAR_VERSION}" \
|
|
--write-image-list=images.json \
|
|
$verify_key
|
|
|
|
hvm_ami_id=$(jq -r '.aws.amis[]|select(.name == "'"${AWS_REGION}"'").hvm' images.json)
|
|
|
|
tee ami.properties << EOF
|
|
HVM_AMI_ID = ${hvm_ami_id:?}
|
|
EOF
|