From fef7d8eb3fcb125e7693fe63b1643f88092aa933 Mon Sep 17 00:00:00 2001 From: Gregory Hendrickson Date: Fri, 9 Jun 2023 16:19:24 -0700 Subject: [PATCH] s --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6e6d420..9dd8631 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,15 +26,16 @@ pipeline { stage('Pull and Deploy') { steps { - def remote [:] - remote.name = 'ubuntu-kc' - remote.host = '172.16.11.90' - remote.allowAnyHosts = true withCredentials([ sshUserPrivateKey(credentialsId: 'ssh-cred', keyFileVariable: 'identity', usernameVariable: 'userName') ]) { + script { + def remote = [:] + remote.name = 'ubuntu-kc' + remote.host = '172.16.11.90' remote.user = userName remote.identityFile = identity + remote.allowAnyHosts = true writeFile file: 'run-pull-deploy.sh', text: ''' docker pull aisthanestha/docker-test-image:latest @@ -49,6 +50,7 @@ pipeline { // Execute the script file on the remote host sshCommand remote: remote, command: 'chmod +x ~/run-pull-deploy.sh && ~/run-pull-deploy.sh' } + } } } }