CI: Add check for required pmbootstrap version's age
While ideally everyone would be running the latest pmbootstrap version, in practice people don't always update right away. And even if they want to, their distribution may not have the latest version packaged yet. Let's enforce some wiggle room here so distributions have time to catch up before we require newer versions. Signed-off-by: Stefan Hansson <newbyte@postmarketos.org> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8550>
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
# Description: Ensure that we're not depending on a too new pmbootstrap version.
|
||||||
|
# https://postmarketos.org/pmb-ci
|
||||||
|
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
set -x
|
||||||
|
apk -q add coreutils curl jq
|
||||||
|
exec su "${TESTUSER:-build}" -c "sh -e $0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pmbootstrap_min_age_days="30"
|
||||||
|
pmbootstrap_min_version_field="$(grep pmbootstrap_min_version= pmaports.cfg)"
|
||||||
|
pmbootstrap_min_version="${pmbootstrap_min_version_field#*=}"
|
||||||
|
|
||||||
|
tag_date=$(curl -s "https://gitlab.postmarketos.org/api/v4/projects/postmarketOS%2Fpmbootstrap/repository/tags/$pmbootstrap_min_version" \
|
||||||
|
| jq -r ".created_at")
|
||||||
|
|
||||||
|
tag_age_timestamp=$(date -d "$tag_date" +"%s")
|
||||||
|
acceptable_age_timestamp=$(date -d "$pmbootstrap_min_age_days days ago" +"%s")
|
||||||
|
|
||||||
|
echo "NOTE: pmbootstrap versions must be at least $pmbootstrap_min_age_days days old to be the minimum required version"
|
||||||
|
|
||||||
|
if [ "$tag_age_timestamp" -ge "$acceptable_age_timestamp" ]; then
|
||||||
|
echo "ERROR: pmbootstrap version '$pmbootstrap_min_version' is too new!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "PASS: pmbootstrap version '$pmbootstrap_min_version' is acceptable"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
@@ -172,6 +172,18 @@ mr-settings:
|
|||||||
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/check_mr_settings.py"
|
- wget -q "https://gitlab.postmarketos.org/postmarketOS/ci-common/-/raw/main/check_mr_settings.py"
|
||||||
- python3 ./check_mr_settings.py
|
- python3 ./check_mr_settings.py
|
||||||
|
|
||||||
|
pmbootstrap minimum version:
|
||||||
|
stage: lint
|
||||||
|
rules:
|
||||||
|
- if: *mr_rule
|
||||||
|
changes:
|
||||||
|
- .ci/check-pmbootstrap-min-version.sh
|
||||||
|
- .gitlab-ci.yml
|
||||||
|
- pmaports.cfg
|
||||||
|
script:
|
||||||
|
- .ci/lib/gitlab_prepare_ci.sh
|
||||||
|
- .ci/check-pmbootstrap-min-version.sh
|
||||||
|
|
||||||
# Calculate build of changed aports using a dynamic downstream pipelines:
|
# Calculate build of changed aports using a dynamic downstream pipelines:
|
||||||
# https://docs.gitlab.com/ci/pipelines/downstream_pipelines/#dynamic-child-pipelines
|
# https://docs.gitlab.com/ci/pipelines/downstream_pipelines/#dynamic-child-pipelines
|
||||||
# For those to work, we need two jobs:
|
# For those to work, we need two jobs:
|
||||||
|
|||||||
Reference in New Issue
Block a user