Apex: more snapshot fixes 93/58893/1
authorTim Rozet <trozet@redhat.com>
Fri, 22 Jun 2018 00:15:16 +0000 (20:15 -0400)
committerTim Rozet <trozet@redhat.com>
Fri, 22 Jun 2018 00:15:16 +0000 (20:15 -0400)
Changes-Include:
 - Rename jobs to have 'os' in them to distinguish openstack branch
 - Fix uploading snapshots to upload from the create directory (where
   the artifacts are built and stored)
 - Fix the properties file so that it is created if one does not exist
   already upstream in the artifacts repo

Change-Id: I0d75fd41585538cbe860274a082cb4051d8b05c5
Signed-off-by: Tim Rozet <trozet@redhat.com>
jjb/apex/apex-snapshot-create.sh
jjb/apex/apex-upload-artifact.sh
jjb/apex/apex.yaml
jjb/apex/apex.yaml.j2

index 7e38d56..b739314 100644 (file)
@@ -91,10 +91,16 @@ echo "Snapshot saved as apex-${SNAP_TYPE}-snap-${DATE}.tar.gz"
 
 # update opnfv properties file
 if [ "$SNAP_TYPE" == 'csit' ]; then
-  curl -O -L http://$GS_URL/snapshot.properties
-  sed -i '/^OPNFV_SNAP_URL=/{h;s#=.*#='${GS_URL}'/apex-csit-snap-'${DATE}'.tar.gz#};${x;/^$/{s##OPNFV_SNAP_URL='${GS_URL}'/apex-csit-snap-'${DATE}'.tar.gz#;H};x}' snapshot.properties
   snap_sha=$(sha512sum apex-csit-snap-${DATE}.tar.gz | cut -d' ' -f1)
-  sed -i '/^OPNFV_SNAP_SHA512SUM=/{h;s/=.*/='${snap_sha}'/};${x;/^$/{s//OPNFV_SNAP_SHA512SUM='${snap_sha}'/;H};x}' snapshot.properties
+  if curl --fail -O -L http://$GS_URL/snapshot.properties; then
+    sed -i '/^OPNFV_SNAP_URL=/{h;s#=.*#='${GS_URL}'/apex-csit-snap-'${DATE}'.tar.gz#};${x;/^$/{s##OPNFV_SNAP_URL='${GS_URL}'/apex-csit-snap-'${DATE}'.tar.gz#;H};x}' snapshot.properties
+    sed -i '/^OPNFV_SNAP_SHA512SUM=/{h;s/=.*/='${snap_sha}'/};${x;/^$/{s//OPNFV_SNAP_SHA512SUM='${snap_sha}'/;H};x}' snapshot.properties
+  else
+    cat << EOF > snapshot.properties
+OPNFV_SNAP_URL=${GS_URL}/apex-csit-snap-${DATE}.tar.gz
+OPNFV_SNAP_SHA512SUM=${snap_sha}
+EOF
+  fi
   echo "OPNFV_SNAP_URL=$GS_URL/apex-csit-snap-${DATE}.tar.gz"
   echo "OPNFV_SNAP_SHA512SUM=$(sha512sum apex-csit-snap-${DATE}.tar.gz | cut -d' ' -f1)"
   echo "Updated properties file: "
index 6acb2a5..5c777a8 100755 (executable)
@@ -77,13 +77,16 @@ uploadrpm () {
 uploadsnap () {
   # Uploads snapshot artifact and updated properties file
   echo "Uploading snapshot artifacts"
+  # snapshot dir is the same node in the create job workspace
+  # only 1 promotion job can run at a time on a slave
+  snapshot_dir="${WORKSPACE}/../apex-create-snapshot"
   if [ -z "$SNAP_TYPE" ]; then
     echo "ERROR: SNAP_TYPE not provided...exiting"
     exit 1
   fi
-  gsutil cp $WORKSPACE/apex-${SNAP_TYPE}-snap-`date +%Y-%m-%d`.tar.gz gs://$GS_URL/ > gsutil.iso.log
+  gsutil cp ${snapshot_dir}/apex-${SNAP_TYPE}-snap-`date +%Y-%m-%d`.tar.gz gs://$GS_URL/ > gsutil.iso.log
   if [ "$SNAP_TYPE" == 'csit' ]; then
-    gsutil cp $WORKSPACE/snapshot.properties gs://$GS_URL/snapshot.properties > gsutil.latest.log
+    gsutil cp ${snapshot_dir}/snapshot.properties gs://$GS_URL/snapshot.properties > gsutil.latest.log
   fi
   echo "Upload complete for Snapshot"
 }
index 249fb0a..65e5588 100644 (file)
@@ -8,7 +8,7 @@
       - 'apex-virtual-{stream}'
       - 'apex-deploy-{platform}-{stream}'
       - 'apex-daily-{stream}'
-      - 'apex-csit-promote-daily-{stream}-{os_version}'
+      - 'apex-csit-promote-daily-{stream}-os-{os_version}'
       - 'apex-fdio-promote-daily-{stream}'
       - 'apex-{scenario}-baremetal-{scenario_stream}'
       - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}'
 
 # CSIT promote
 - job-template:
-    name: 'apex-csit-promote-daily-{stream}-{os_version}'
+    name: 'apex-csit-promote-daily-{stream}-os-{os_version}'
 
     # Job template for promoting CSIT Snapshots
     #
index 166e7a0..f1208d2 100644 (file)
@@ -8,7 +8,7 @@
       - 'apex-virtual-{stream}'
       - 'apex-deploy-{platform}-{stream}'
       - 'apex-daily-{stream}'
-      - 'apex-csit-promote-daily-{stream}-{os_version}'
+      - 'apex-csit-promote-daily-{stream}-os-{os_version}'
       - 'apex-fdio-promote-daily-{stream}'
       - 'apex-{scenario}-baremetal-{scenario_stream}'
       - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}'
 
 # CSIT promote
 - job-template:
-    name: 'apex-csit-promote-daily-{stream}-{os_version}'
+    name: 'apex-csit-promote-daily-{stream}-os-{os_version}'
 
     # Job template for promoting CSIT Snapshots
     #