pipeline updated

This commit is contained in:
Benjamin Bohard 2020-09-02 16:52:06 +02:00
parent d2b965f341
commit 122f86e724

View File

@ -2,6 +2,7 @@
def buildTag def buildTag
def buildContext def buildContext
def distBranch def distBranch
pipeline { pipeline {
agent { agent {
@ -89,6 +90,17 @@ pipeline {
} }
stage("Checkout ref") { stage("Checkout ref") {
dir(env.projectDir) { dir(env.projectDir) {
withCredentials([
sshUserPrivateKey(credentialsId: 'jenkins-forge-ssh', keyFileVariable: 'FORGE_SSH_KEY')]) {
writeFile(
file : "./sshForJenkins.sh",
text: '''
#!/bin/sh
ssh -i "${FORGE_SSH_KEY}" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@"
'''
)
sh(script: "chmod +x ./sshForJenkins.sh")
withEnv(["GIT_SSH=./sshForJenkins.sh"]) {
sh """ sh """
git checkout ${env.ref} git checkout ${env.ref}
""" """
@ -105,6 +117,8 @@ pipeline {
return return
} }
} }
}
}
//stage("Build package") { //stage("Build package") {
// dir(env.projectDir) { // dir(env.projectDir) {