From 865a75b0ccb7deb88349740315362f506917b2fe Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Wed, 18 Nov 2020 14:37:48 -0500 Subject: [PATCH] Add extra validation to upload_packages_testing_to_stable.sh: only numbered releases should be allowed. No issue # Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- jenkins/upload_packages_testing_to_stable.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/jenkins/upload_packages_testing_to_stable.sh b/jenkins/upload_packages_testing_to_stable.sh index 3d2bae9..16c44f4 100755 --- a/jenkins/upload_packages_testing_to_stable.sh +++ b/jenkins/upload_packages_testing_to_stable.sh @@ -7,8 +7,6 @@ # Parameters: list of packages, space separated, to move from *-testing to * # under /var/lib/freight/apt/ in host public.curoverse.com -set -x - APT_REPO_SERVER="apt.arvados.org" RPM_REPO_SERVER="rpm.arvados.org" @@ -29,6 +27,18 @@ if [ -z "${LSB_DISTRIB_CODENAMES}" ]; then exit 255 fi +# Only numbered package versions are supposed to go into the stable repositories +TMP=$(echo "$PACKAGES_TO_PUBLISH" | sed 's/versions://g;') +VALIDATED_PACKAGES_TO_PUBLISH=`echo "$TMP" | sed -nE '/^.*: [0-9].[0-9].[0-9]-[0-9]$/p'` + +if [[ "$TMP" != "$VALIDATED_PACKAGES_TO_PUBLISH" ]]; then + echo "The list of packages has invalid syntax. each line must be of the format:" + echo + echo "packagename: [0-9].[0-9].[0-9]-[0-9]" + echo + exit 253 +fi + # Sanitize the vars in a way suitable to be used by the remote 'publish_packages.sh' script # Just to make copying a single line, and not having to loop over it PACKAGES_LIST=$(echo ${PACKAGES_TO_PUBLISH} | sed 's/versions://g; s/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1*\2*,/g; s/[[:blank:]]//g; s/,$//g;') -- 2.30.2