summaryrefslogtreecommitdiffstats
path: root/jjb/xci
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2018-02-21 10:12:11 +0000
committerMarkos Chandras <mchandras@suse.de>2018-03-07 14:03:49 +0000
commit1b88dcf23ea750880dd2ed70d07f66546a8dd41c (patch)
tree9e04dc9f93011b45c597f5a0c9905949ed6d690b /jjb/xci
parent84e4b164e8a513f17f52e463120ae8a8d2ac2053 (diff)
jjb: xci: Add postbuild publisher script to remove clean VM
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>
Diffstat (limited to 'jjb/xci')
-rw-r--r--jjb/xci/bifrost-verify-jobs.yml7
-rwxr-xr-xjjb/xci/xci-cleanup.sh8
-rw-r--r--jjb/xci/xci-daily-jobs.yml6
-rw-r--r--jjb/xci/xci-merge-jobs.yml8
-rw-r--r--jjb/xci/xci-verify-jobs.yml9
5 files changed, 36 insertions, 2 deletions
diff --git a/jjb/xci/bifrost-verify-jobs.yml b/jjb/xci/bifrost-verify-jobs.yml
index 7e0117565..2fb7c2167 100644
--- a/jjb/xci/bifrost-verify-jobs.yml
+++ b/jjb/xci/bifrost-verify-jobs.yml
@@ -162,6 +162,13 @@
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
# -------------------------------
diff --git a/jjb/xci/xci-cleanup.sh b/jjb/xci/xci-cleanup.sh
index ce84830aa..51a863da2 100755
--- a/jjb/xci/xci-cleanup.sh
+++ b/jjb/xci/xci-cleanup.sh
@@ -14,11 +14,15 @@
# 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
diff --git a/jjb/xci/xci-daily-jobs.yml b/jjb/xci/xci-daily-jobs.yml
index a92e49085..11db4e168 100644
--- a/jjb/xci/xci-daily-jobs.yml
+++ b/jjb/xci/xci-daily-jobs.yml
@@ -154,6 +154,12 @@
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}'
diff --git a/jjb/xci/xci-merge-jobs.yml b/jjb/xci/xci-merge-jobs.yml
index 492348d63..7a5ef7475 100644
--- a/jjb/xci/xci-merge-jobs.yml
+++ b/jjb/xci/xci-merge-jobs.yml
@@ -167,6 +167,14 @@
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}'
diff --git a/jjb/xci/xci-verify-jobs.yml b/jjb/xci/xci-verify-jobs.yml
index c54a1b941..82ca5abbc 100644
--- a/jjb/xci/xci-verify-jobs.yml
+++ b/jjb/xci/xci-verify-jobs.yml
@@ -188,6 +188,15 @@
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}'