Bugfix for the `testing_to_stable_publish_packages.sh` script to reflect
authorWard Vandewege <ward@curii.com>
Thu, 25 Feb 2021 18:13:00 +0000 (13:13 -0500)
committerWard Vandewege <ward@curii.com>
Thu, 25 Feb 2021 18:13:00 +0000 (13:13 -0500)
our switch to aptly.

Some refactoring to remove exitcode nonsense.

refs #17218

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

jenkins/testing_to_stable_publish_packages.sh
jenkins/upload_packages_testing_to_stable.sh

index 419339d98318cace2a4c72efa4b62b2266bcb54f..12ca8006c5ffd8c4212e4dd3ad5aa95ad799340d 100755 (executable)
@@ -31,8 +31,8 @@ done
 # Make sure the variables are set or provide an example of how to use them
 if [ -z "${packages}" ]; then
   echo "You must provide a comma-separated list of packages to publish, ie."
-  echo "* Debian: --packages=arvados-ws_0.1.20170906144951.22418ed6e-1_amd64.deb,keep-exercise_*,*170906144951*"
-  echo "* Centos: --packages=arvados-ws_0.1.20170906144951.22418ed6e-1.x86_64.rpm,keep-exercise_0.1.20170906144951.22418ed6e-1.x86_64.rpm,crunch-dispatch-local_0.1.20170906144951.22418ed6e-1.x86_64.rpm"
+  echo "* Debian: --packages=arvados-ws:0.1.20170906144951.22418ed6e-1,keep-exercise:1.2.3-1"
+  echo "* Centos: --packages=arvados-ws:0.1.20170906144951.22418ed6e-1,keep-exercise:1.2.3-1"
   exit 254
 fi
 if [ -z "${distros}" ]; then
@@ -43,10 +43,11 @@ if [ -z "${distros}" ]; then
 fi
 
 DIST_LIST=$(echo ${distros} | sed s/,/' '/g |tr '[:upper:]' '[:lower:]')
-PACKAGES=$(echo ${packages} | sed s/,/' '/g)
+CENTOS_PACKAGES=$(echo ${packages} | sed 's/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1*\2*/g; s/,/ /g;')
+DEBIAN_PACKAGES=$(echo ${packages} | sed 's/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1 (= \2)/g;')
 
 if ( echo ${DIST_LIST} |grep -q centos ); then
-  for DISTNAME in ${DIST_LIST}; do 
+  for DISTNAME in ${DIST_LIST}; do
     case ${DISTNAME} in
       'centos7')
         DIST_DIR_TEST='7/testing/x86_64'
@@ -60,7 +61,7 @@ if ( echo ${DIST_LIST} |grep -q centos ); then
     cd ${RPM_REPO_BASE_DIR}
     mkdir -p ${RPM_REPO_BASE_DIR}/CentOS/${DIST_DIR_PROD}
     echo "Copying packages ..."
-    for P in ${PACKAGES}; do
+    for P in ${CENTOS_PACKAGES}; do
       cp ${RPM_REPO_BASE_DIR}/CentOS/${DIST_DIR_TEST}/${P} ${RPM_REPO_BASE_DIR}/CentOS/${DIST_DIR_PROD}/
       if [ $? -ne 0 ]; then
         FAILED_PACKAGES="${FAILED_PACKAGES} ${P}"
@@ -73,9 +74,20 @@ else
   for DISTNAME in ${DIST_LIST}; do
     ADDED=()
     echo "Copying packages ..."
-    for P in ${PACKAGES}; do
-      aptly repo copy ${DISTNAME}-testing ${DISTNAME} $(basename ${P})
+    OLDIFS=$IFS
+    IFS=$','
+    for P in ${DEBIAN_PACKAGES}; do
+      aptly repo search ${DISTNAME}-testing "${P}"
+      if [ $? -ne 0 ]; then
+        FAILED_PACKAGES="${FAILED_PACKAGES} ${P}"
+      else
+        aptly repo copy ${DISTNAME}-testing ${DISTNAME} "${P}"
+        if [ $? -ne 0 ]; then
+          FAILED_PACKAGES="${FAILED_PACKAGES} ${P}"
+        fi
+      fi
     done
+    IFS=$OLDIFS
     echo "Publishing ${DISTNAME} repository..."
     aptly publish update ${DISTNAME} filesystem:${DISTNAME}:
   done
@@ -84,6 +96,7 @@ fi
 if [ "${FAILED_PACKAGES}" != "" ]; then
   echo "PACKAGES THAT FAILED TO PUBLISH"
   echo "${FAILED_PACKAGES}"
+  exit 252
 else
   echo "All packages published correctly"
 fi
index 74ee9cfa46bdb77848e46f439811b1c6e501b4da..5b3dd384e4d787b95aec291ffa760992db9db67e 100755 (executable)
@@ -42,7 +42,7 @@ 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;')
+PACKAGES_LIST=$(echo ${PACKAGES_TO_PUBLISH} | sed 's/versions://g; s/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1:\2,/g; s/[[:blank:]]//g; s/,$//g;')
 
 DISTROS=$(echo "${LSB_DISTRIB_CODENAMES}"|sed s/[[:space:]]/,/g |tr '[:upper:]' '[:lower:]')
 
@@ -63,12 +63,7 @@ ssh -t \
     -o "StrictHostKeyChecking no" \
     -o "ConnectTimeout 5" \
     ${REPO_SERVER} \
-    "${REMOTE_CMD}" | tee ${TMP_FILE}
+    "${REMOTE_CMD}"
 ECODE=$?
 
-grep -q "FAILED TO PUBLISH" ${TMP_FILE}
-if [ $? -eq 0 ]; then
-  ECODE=1
-fi
-rm -f ${TMP_FILE}
 exit ${ECODE}