Compare commits
1 Commits
nebula
...
redesign-t
Author | SHA1 | Date | |
---|---|---|---|
c73ddac0fd |
@ -1,4 +1,4 @@
|
|||||||
@Library("cadoles") _
|
@Library("cadoles@redesign-tamarin") _
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ 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 {
|
||||||
|
|
||||||
@ -150,16 +149,17 @@ 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 sur la machine ${host}..."
|
println "En attente de l'accès SSH..."
|
||||||
while(true) {
|
waitUntil {
|
||||||
def status = sh script: "nc -zv ${host} 22", returnStatus: true
|
try {
|
||||||
if (status == 0) {
|
sh "ssh -q ${sshArgs} -o ConnectTimeout=1 root@${host} exit"
|
||||||
break;
|
return true
|
||||||
|
} 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
|
||||||
|
@ -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 -C -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 -i '${VULCAIN_SSH_KEY}' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '${it}' '${VULCAIN_SSH_USER}@${vulcainHost}:/home/${VULCAIN_SSH_USER}/packages/${packagesEnv}/${packagesBranch}/'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user