diff --git a/Jenkinsfile b/Jenkinsfile index bc980b1..78f5232 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,15 +57,20 @@ pipeline { stage('#3 Deploy App') { steps { echo '#3 Deploy App' - - echo '######################################################################' - echo '### transfer files from jenkins pipeline to remote nginx as static ###' - echo '######################################################################' - sh ''' - scp -v -o StrictHostKeyChecking=no -i $PRIV_KEY -r ./public/* ubuntu@13.48.201.185:/home/ubuntu/docker-compose/volumes/https-nginx-static/kamil-zuk-cv.tk - ''' + withCredentials([sshUserPrivateKey(credentialsId: 'cv-kamil-zuk', keyFileVariable: 'PRIV_KEY')]) { + script { + echo '######################################################################' + echo '### transfer files from jenkins pipeline to remote nginx as static ###' + echo '######################################################################' + + sh ''' + scp -v -o StrictHostKeyChecking=no -i $PRIV_KEY -r ./public/* ubuntu@13.48.201.185:/home/ubuntu/docker-compose/volumes/https-nginx-static/kamil-zuk-cv.tk + ''' + } + } + echo 'Deploy Success' }