jjb: xci: Add postbuild publisher script to remove clean VM 87/52387/13
authorMarkos Chandras <mchandras@suse.de>
Wed, 21 Feb 2018 10:12:11 +0000 (10:12 +0000)
committerMarkos Chandras <mchandras@suse.de>
Wed, 7 Mar 2018 14:03:49 +0000 (14:03 +0000)
The clean VM normally stays around after the job is completed or killed
due to timeout. Unless a job for the same distro is scheduled on the
same node, that VM will state around for a while consuming valuable
system resources. As such, we should remove it after the job finishes
to free up resources for the new jobs.

Change-Id: I88b5e32797969d9378588199a7ddb013bbe740c9
Signed-off-by: Markos Chandras <mchandras@suse.de>
jjb/xci/bifrost-verify-jobs.yml
jjb/xci/xci-cleanup.sh
jjb/xci/xci-daily-jobs.yml
jjb/xci/xci-merge-jobs.yml
jjb/xci/xci-verify-jobs.yml

index 7e01175..2fb7c21 100644 (file)
           recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
       # yamllint enable rule:line-length
       - email-jenkins-admins-on-failure
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
+
 # -------------------------------
 # trigger macros
 # -------------------------------
index ce84830..51a863d 100755 (executable)
 # what you are doing.
 #----------------------------------------------------------------------
 
+# Need to cover macros with and without parameters
+VM_NAME=$DISTRO
+VM_NAME+=_xci_vm
+
 # skip the deployment if the patch doesn't impact the deployment
 if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
     echo "Skipping the deployment!"
     exit 0
 fi
 
-sudo virsh destroy ${DISTRO}_xci_vm || true
-sudo virsh undefine ${DISTRO}_xci_vm || true
+sudo virsh destroy $VM_NAME || true
+sudo virsh undefine $VM_NAME || true
index a92e490..11db4e1 100644 (file)
           recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
       # yamllint enable rule:line-length
       - email-jenkins-admins-on-failure
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
 
 - job-template:
     name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
index 492348d..7a5ef74 100644 (file)
               kill-phase-on: NEVER
               abort-all-job: true
 
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
+
 - job-template:
     name: 'xci-{phase}-{type}-{distro}-merge-{stream}'
 
index c54a1b9..82ca5ab 100644 (file)
               kill-phase-on: NEVER
               abort-all-job: true
 
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          builders:
+            - shell:
+                !include-raw: ./xci-cleanup.sh
+
+
 - job-template:
     name: 'xci-verify-{distro}-{phase}-{type}-{stream}'