5 Commits

3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
@Library("cadoles@redesign-tamarin") _ @Library("cadoles") _
pipeline { pipeline {

View File

@ -4,6 +4,7 @@ import groovy.util.XmlSlurper
import groovy.util.slurpersupport.GPathResult import groovy.util.slurpersupport.GPathResult
import groovy.util.slurpersupport.NodeChild import groovy.util.slurpersupport.NodeChild
import groovy.xml.XmlUtil import groovy.xml.XmlUtil
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
class Client { class Client {
@ -149,17 +150,16 @@ def runInNewVM(Map args) {
initWithCredentials(urlCredentialsId, userCredentialsId) { client -> initWithCredentials(urlCredentialsId, userCredentialsId) { client ->
client.withNewVM(vmTemplate, terminateOnExit) { host -> client.withNewVM(vmTemplate, terminateOnExit) { host ->
def sshArgs = "-i ${VM_SSH_KEY} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" def sshArgs = "-i '${VM_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
// On attend que la connexion SSH soit disponible // On attend que la connexion SSH soit disponible
println "En attente de l'accès SSH..." println "En attente de l'accès SSH sur la machine ${host}..."
waitUntil { while(true) {
try { def status = sh script: "nc -zv ${host} 22", returnStatus: true
sh "ssh -q ${sshArgs} -o ConnectTimeout=1 root@${host} exit" if (status == 0) {
return true break;
} catch (e) {
return false
} }
sleep(5)
} }
// On créait un script temporaire à exécuter sur la machine distante // On créait un script temporaire à exécuter sur la machine distante

View File

@ -14,7 +14,7 @@ def publish(
echo "Publishing packages to '${packagesEnv}/${packagesBranch}'" echo "Publishing packages to '${packagesEnv}/${packagesBranch}'"
sh "ssh -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${VULCAIN_SSH_USER}@${vulcainHost}' mkdir -p '/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}'" sh "ssh -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${VULCAIN_SSH_USER}@${vulcainHost}' mkdir -p '/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}'"
packages.each { packages.each {
sh "scp -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${it}' '${VULCAIN_SSH_USER}@${vulcainHost}:/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}/'" sh "scp -C -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${it}' '${VULCAIN_SSH_USER}@${vulcainHost}:/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}/'"
} }
} }
} }