diff options
author | Tom Willemse | 2020-10-10 01:37:03 -0700 |
---|---|---|
committer | Tom Willemse | 2020-10-10 01:37:03 -0700 |
commit | e473acb3c921bc3954740b9e005b4486c1570de5 (patch) | |
tree | c564c98d3ab6be77b6d7cff8a07c7f9d06494ede /Jenkinsfile | |
parent | 5a6f49d2865cb4499fd843e79523382dd9aabe7c (diff) | |
download | new-ryuslash.org-e473acb3c921bc3954740b9e005b4486c1570de5.tar.gz new-ryuslash.org-e473acb3c921bc3954740b9e005b4486c1570de5.zip |
Use an SSH username and private key combination
Diffstat (limited to 'Jenkinsfile')
-rw-r--r-- | Jenkinsfile | 13 |
1 files changed, 10 insertions, 3 deletions
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:"' } } } |