mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-28 14:01:43 +01:00
ci-automation: Implement a stricter image version check
I made a mistake and wrote a version like main-3363-0.0-stuff (note a dash instead of a dot after the first number). Surprisingly the build chugged along just fine almost until the end of the image job - it detected invalid version string when the job wanted to create a version.txt file: ERROR build_image: script called: build_image '--board=amd64-usr' '--group=developer' '--output_root=/home/sdk/build/images' '--only_store_compressed' '--torcx_root=/home/sdk/build/torcx' 'prodtar' 'container' ERROR build_image: Backtrace: (most recent call is last) ERROR build_image: file build_image, line 196, called: split_ver '3363' 'SPLIT' ERROR build_image: file common.sh, line 192, called: die 'Invalid version string '3363'' ERROR build_image: ERROR build_image: Error was: ERROR build_image: Invalid version string '3363' Let's have a stricter version check in the beginning of the build process, so the process fails sooner rather than later.
This commit is contained in:
parent
0aa225caab
commit
1585ede78a
@ -32,8 +32,8 @@ function update_submodule() {
|
|||||||
function check_version_string() {
|
function check_version_string() {
|
||||||
local version="$1"
|
local version="$1"
|
||||||
|
|
||||||
if ! echo "${version}" | grep -qE '^(main-|alpha-|beta-|stable-|lts-)' ; then
|
if [[ ! "${version}" =~ ^(main|alpha|beta|stable|lts)-[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
|
||||||
echo "ERROR: invalid version '${version}', must start with 'main-', 'alpha-', 'beta-', 'stable-', or 'lts-'"
|
echo "ERROR: invalid version '${version}', must start with 'main', 'alpha', 'beta', 'stable' or 'lts', followed by a dash and three dot-separated numbers, optionally followed by a dash and a non-empty build ID"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user