Correct Jenkins file for cord 3.0
Change-Id: I83318116c9d7449c3b010605d378d95ae386e8c6
diff --git a/Jenkinsfile b/Jenkinsfile
index 380f33f..d0a538f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -88,19 +88,6 @@
}
}
- try {
- def provCompleted = 0
- for(int i=0; i < config.compute_nodes.size(); i++) {
- def count = runCmd("${config.head.ip}",
- "${config.head.user}",
- "${config.head.pass}",
- "cord prov list '|' grep -i ${config.compute_nodes[i].ip} '|' grep -i complete '|' wc -l").trim()
- provCompleted = provCompleted + count.toInteger()
- }
- return provCompleted == config.compute_nodes.size()
- } catch (exception) {
- return false
- }
stage ("Wait for compute nodes to get deployed") {
sh "ssh-keygen -f /home/${config.dev_node.user}/.ssh/known_hosts -R ${config.head.ip}"
def cordApiKey = runCmd("${config.head.ip}",
@@ -118,7 +105,7 @@
"${config.head.user}",
"${config.head.pass}",
"maas pod-maas nodes list | grep -i deployed | wc -l").trim()
- return num == '2'
+ return num.toInteger() == config.compute_nodes.size()
} catch (exception) {
return false
}
@@ -137,7 +124,7 @@
out = runCmd("${config.head.ip}",
"${config.head.user}",
"${config.head.pass}",
- "curl -sS http://$ip:4243/provision/ | jq -c '.[] | select(.status | contains(2))'").trim()
+ "curl -sS http://$ip:4243/provision/ | jq -c \".[] | select(.status | contains(${config.compute_nodes.size()}))\"".trim())
return out != ""
} catch (exception) {
return false
@@ -197,7 +184,7 @@
"${config.head.user}",
"${config.head.pass}",
"cord harvest list '|' grep -i fabric '|' wc -l").trim()
- return harvestCompleted == config.fabric_switches.size().toString()
+ return harvestCompleted.toInteger() == config.fabric_switches.size()
} catch (exception) {
return false
}
@@ -268,7 +255,7 @@
* @return the output of the command
*/
def runCmd(ip, user, pass, command) {
- return sh(returnStdout: true, script: "sshpass -p ${pass} ssh -o UserKnownHostsFile=/dev/null -l ${user} ${ip} ${command}")
+ return sh(returnStdout: true, script: "sshpass -p ${pass} ssh -oStrictHostKeyChecking=no -l ${user} ${ip} ${command}")
}
/**
@@ -284,8 +271,5 @@
* @return the output of the command
*/
def runFabricCmd(headIp, headUser, headPass, ip, user, pass, command) {
- return runCmd("${haedIp}",
- "${headUser}",
- "${headPass}",
- "sshpass -p ${pass} ssh -o UserKnownHostsFile=/dev/null -l ${user} ${ip} ${command}")
+ return sh(returnStdout: true, script: "sshpass -p ${headPass} ssh -oStrictHostKeyChecking=no -l ${headUser} ${headIp} \"sshpass -p ${pass} ssh -oStrictHostKeyChecking=no -l ${user} ${ip} ${command}\"")
}
\ No newline at end of file