Add choosing slave for offline build
PROD:PROD-35358
Change-Id: Id5ed0580131fac82c5df746dd7bf35c9d099c3f1
diff --git a/packer-image-buid.groovy b/packer-image-buid.groovy
index 5a5bdd2..b615cdc 100644
--- a/packer-image-buid.groovy
+++ b/packer-image-buid.groovy
@@ -86,9 +86,28 @@
}
return data_list
}
+// Necessary to have ~100G of volume on node for build offline image. Code below chooses huge available slave.
+def getHugeSlave() {
+ slaves = nodesByLabel("virtual")
+ def targetSlave = ''
+ for (slave in slaves) {
+ node(slave){
+ outputMsg = sh(returnStdout: true, script: '''#!/bin/bash
+ df --block-size=G / | awk '{print $4}' | sed -n 2p | sed 's/.$//'
+ ''')
+ }
+ if(outputMsg.toInteger() >= 120){
+ targetSlave = slave
+ break
+ }
+ }
+ return targetSlave
+}
+
+nodeForBuild = getHugeSlave()
timeout(time: 6, unit: 'HOURS') {
- node(slaveNode) {
+ node(nodeForBuild) {
def workspace = common.getWorkspace()
def openstackEnv = "${workspace}/venv"
def rcFile = ''