Browse Source

Обновить 'Jenkinsfile'

Vladimir Tomishinets 6 years ago
parent
commit
d2663304f5
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Jenkinsfile

+ 4 - 3
Jenkinsfile

@@ -1,4 +1,5 @@
 def SERIAL
+def CONTAINER_ID_CLIENT
 def ENAMES = [ 'prod', 'dev' ]
 def CLUSTERS = ['prod': 'iru-swarm1-open.infoclinica.lan', 'dev': 'dev-iru-swarm.infoclinica.lan']
 def REGISTRIES = ['prod': 'registry.infoclinica.ru:5000', 'dev': 'dev-registry.infoclinica.ru:5000']
@@ -93,11 +94,11 @@ pipeline {
              """
           def NODE = sh (script: "DOCKER_HOST=tcp://${CLUSTERS.get((ENAMES[1]))}:2376 DOCKER_TLS_VERIFY=1 docker service ps \${SERVICE_NAME} --format '{{.Node}}' --filter desired-state=Running" , returnStdout: true).trim()
           echo "${NODE}"
-          def CONTAINER_ID_CLIENT = sh script: "docker run --name ${DOCKER_IMAGE} -e mode=client -e server=${NODE} --privileged -d --rm  ${DOCKER_IMAGE}:${SERIAL}" , returnStdout: true
+          CONTAINER_ID_CLIENT = sh script: "docker run -e mode=client -e server=${NODE} --privileged -d --rm  ${DOCKER_IMAGE}:${SERIAL}" , returnStdout: true
           sh """docker exec -t \${CONTAINER_ID_CLIENT} ping -c 3 -q 10.10.20.1
                 if [ \$? != 0 ]; then exit 1; else echo 'OVPN_RSA is working!!!'; fi
              """
-          echo "${CONTAINER_ID_CLIENT}"
+          
              
         }
       }
@@ -129,7 +130,7 @@ pipeline {
   }
   post {
     always {
-      sh "docker stop ${DOCKER_IMAGE}"
+      sh "docker stop  ${CONTAINER_ID_CLIENT}"
       sh "DOCKER_HOST=tcp://${CLUSTERS.get((ENAMES[1]))}:2376 DOCKER_TLS_VERIFY=1 docker stack rm ${DOCKER_IMAGE}"
       echo "CleaningUp work directory"
       deleteDir()