From c611ab2bc7458a0bc84c5023817a5d165fb52442 Mon Sep 17 00:00:00 2001 From: zhouxiunai <154707516@qq.com> Date: Sun, 28 Apr 2019 14:41:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8sudo=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=89=A7=E8=A1=8Cdocker=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 7ca5f605..8248ecf2 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -53,13 +53,13 @@ pipeline { steps { withCredentials([sshUserPrivateKey(credentialsId: "${env.credentialsId}", keyFileVariable: 'kfIdentity', passphraseVariable: 'pVariable', usernameVariable: 'userName')]) { sshCommand(remote: [ name: "${env.deployName}" ,host: "${env.deployHost}" ,allowAnyHosts: true,user: "${userName}",identityFile: "${kfIdentity}" ] , - command: "docker stop ${env.containerName}",sudo: false ,failOnError: false) + command: "docker stop ${env.containerName}",sudo: true ,failOnError: false) sshCommand(remote: [ name: "${env.deployName}" ,host: "${env.deployHost}" ,allowAnyHosts: true,user: "${userName}",identityFile: "${kfIdentity}" ] , - command: "docker rm ${env.containerName}",sudo: false ,failOnError: false) + command: "docker rm ${env.containerName}",sudo: true ,failOnError: false) sshCommand(remote: [ name: "${env.deployName}" ,host: "${env.deployHost}" ,allowAnyHosts: true,user: "${userName}",identityFile: "${kfIdentity}" ] , - command: "docker rmi ${env.dockerRegistry}/${env.GROUP}/${env.ARTIFACTID}:${env.VERSION}",sudo: false ,failOnError: false) + command: "docker rmi ${env.dockerRegistry}/${env.GROUP}/${env.ARTIFACTID}:${env.VERSION}",sudo: true ,failOnError: false) sshCommand(remote: [ name: "${env.deployName}" ,host: "${env.deployHost}" ,allowAnyHosts: true,user: "${userName}",identityFile: "${kfIdentity}" ] , - command: "docker run -d -p ${env.export}:8080 --name ${env.containerName} ${env.dockerRegistry}/${env.GROUP}/${env.ARTIFACTID}:${env.VERSION}",sudo: false ,failOnError: true) + command: "docker run -d -p ${env.export}:8080 --name ${env.containerName} ${env.dockerRegistry}/${env.GROUP}/${env.ARTIFACTID}:${env.VERSION}",sudo: true ,failOnError: true) } } }