Apex: Fixes iso verify depending on previous build workspace 49/42849/3
authorTim Rozet <trozet@redhat.com>
Sat, 23 Sep 2017 14:23:33 +0000 (10:23 -0400)
committerTim Rozet <trozet@redhat.com>
Sat, 23 Sep 2017 14:41:59 +0000 (10:41 -0400)
There is a bug where if there are multiple builds queued and daily build
completes, the following iso verify job will try to use the workspace of
the completed daily build to get the iso file.  However, if another
build job has already started it may clean and overwrite the workspace
of the daily build job, and the iso verify job will fail because the
file is now gone.  This makes the build job copy the iso to a tmp
directory for apex iso verify to consume.

This should be safe since only one daily can run at a time on the host
and daily jobs build and iso verify have to always execute on the same
node.

Change-Id: Ie8e32c4abefbc311e505688d6da2b26ae08ed98f
Signed-off-by: Tim Rozet <trozet@redhat.com>
jjb/apex/apex-build.sh
jjb/apex/apex-iso-verify.sh
jjb/apex/apex.yml
jjb/apex/apex.yml.j2

index 23ce810..cf59998 100755 (executable)
@@ -46,6 +46,12 @@ echo "Cache Directory Contents:"
 echo "-------------------------"
 ls -al $CACHE_DIRECTORY
 
+if [[ "$BUILD_ARGS" =~ '--iso' ]]; then
+  mkdir -p /tmp/apex-iso/
+  rm -f /tmp/apex-iso/*.iso
+  cp -f $BUILD_DIRECTORY/../.build/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso /tmp/apex-iso/
+fi
+
 if ! echo $ARTIFACT_VERSION | grep "dev" 1> /dev/null; then
   echo "Writing opnfv.properties file"
   # save information regarding artifact into file
index f102421..4faeb60 100755 (executable)
@@ -8,7 +8,14 @@ echo "Starting the Apex iso verify."
 echo "--------------------------------------------------------"
 echo
 
-source $BUILD_DIRECTORY/../opnfv.properties
+# Must be RPMs/ISO
+echo "Downloading latest properties file"
+
+# get the properties file in order to get info regarding artifacts
+curl --fail -s -o opnfv.properties http://$GS_URL/latest.properties
+
+# source the file so we get OPNFV vars
+source opnfv.properties
 
 if ! rpm -q virt-install > /dev/null; then
   sudo yum -y install virt-install
@@ -35,9 +42,9 @@ sudo rm -f /var/log/libvirt/qemu/apex-iso-verify-console.log
 sudo virt-install -n apex-iso-verify -r 4096 --vcpus 4 --os-variant=rhel7 \
  --accelerate -v --noautoconsole \
  --disk path=/var/lib/libvirt/images/apex-iso-verify.qcow2,size=30,format=qcow2 \
- -l $BUILD_DIRECTORY/release/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso \
+ -l /tmp/apex-iso/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso \
  --extra-args 'console=ttyS0 console=ttyS0,115200n8 serial inst.ks=file:/iso-verify.ks inst.stage2=hd:LABEL=OPNFV\x20CentOS\x207\x20x86_64:/' \
- --initrd-inject $BUILD_DIRECTORY/../ci/iso-verify.ks \
+ --initrd-inject ci/iso-verify.ks \
  --serial file,path=/var/log/libvirt/qemu/apex-iso-verify-console.log
 
 echo "Waiting for install to finish..."
index 7728465..058f18a 100644 (file)
 
     properties:
         - logrotate-default
+        - build-blocker:
+            use-build-blocker: true
+            block-level: 'NODE'
+            blocking-jobs:
+                - 'apex-daily.*'
 
     triggers:
         - 'apex-{stream}'
index ec68852..09c2f8c 100644 (file)
 
     properties:
         - logrotate-default
+        - build-blocker:
+            use-build-blocker: true
+            block-level: 'NODE'
+            blocking-jobs:
+                - 'apex-daily.*'
 
     triggers:
         - 'apex-{stream}'