Add extra validation to upload_packages_testing_to_stable.sh: only
authorWard Vandewege <ward@curii.com>
Wed, 18 Nov 2020 19:37:48 +0000 (14:37 -0500)
committerWard Vandewege <ward@curii.com>
Wed, 18 Nov 2020 19:37:48 +0000 (14:37 -0500)
numbered releases should be allowed.

No issue #

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

jenkins/upload_packages_testing_to_stable.sh

index 3d2bae943003f01777efbcc0497984d1e9541f1b..16c44f436e05d1fe40af39396d3c7f0cb856af95 100755 (executable)
@@ -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;')