From e473acb3c921bc3954740b9e005b4486c1570de5 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 10 Oct 2020 01:37:03 -0700 Subject: Use an SSH username and private key combination --- Jenkinsfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Jenkinsfile') diff --git a/Jenkinsfile b/Jenkinsfile index 5573a1c..8b9dba7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,9 +46,16 @@ pipeline { unstash 'public_html' unstash 'public_css' - withCredentials([file(credentialsId: 'ryuslash.org-deploy-key-2', variable: 'KEY_FILE'), - file(credentialsId: 'ryuslash-known-hosts', variable: 'KNOWN_HOSTS_FILE')]) { - sh 'rsync -e "ssh -p 4511 -o \\"UserKnownHostsFile $KNOWN_HOSTS_FILE\\" -i $KEY_FILE" -v -c -r --delete public/ "site@ryuslash.org:"' + withCredentials([ + sshUserPrivateKey( + credentialsId: 'ryuslash.org-deploy-key-2', + keyFileVariable: 'KEY_FILE', + usernameVariable: 'USERNAME'), + file( + credentialsId: 'ryuslash-known-hosts', + variable: 'KNOWN_HOSTS_FILE') + ]) { + sh 'rsync -e "ssh -p 4511 -o \\"UserKnownHostsFile $KNOWN_HOSTS_FILE\\" -i $KEY_FILE" -v -c -r --delete public/ "$USERNAME@ryuslash.org:"' } } } -- cgit v1.2.3-54-g00ecf