cpkg: allow use of ssh credentials for git
This commit is contained in:
@ -27,4 +27,18 @@ def withHTTPCredentials(String credentialsId, Closure fn) {
|
||||
sh(script: "rm -f '${tmpAskPassScript}'")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def withSSHCredentials(String credentialsId, Closure fn) {
|
||||
def randomUUID = UUID.randomUUID().toString()
|
||||
withCredentials([
|
||||
sshUserPrivateKey(
|
||||
credentialsId: credentialsId,
|
||||
keyFileVariable: 'GIT_SSH_IDENTITY_FILE',
|
||||
)
|
||||
]) {
|
||||
withEnv(['GIT_SSH_VARIANT=ssh', 'GIT_SSH_COMMAND=ssh -i $GIT_SSH_IDENTITY_FILE -o IdentitiesOnly=yes -o StrictHostKeyChecking=no']) {
|
||||
fn.call()
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user