Browse Source

Add labels

Владимир Томишинец 5 years ago
parent
commit
ae37e149e9
1 changed files with 7 additions and 5 deletions
  1. 7 5
      updateVersionJenkinsfile

+ 7 - 5
updateVersionJenkinsfile

@@ -17,6 +17,8 @@ pipeline {
     JENKINS_MAIL='jenkins.dev@sdsys.ru'
     DOCKER_CERT_PATH='/run/secrets/swarm'
     DOCKER_IMAGE='analis-wineservice'
+    SERVICE_LABEL='analis-std'
+    STACK_LABEL='analis-wineservice'
   }
   parameters {
     string(
@@ -57,7 +59,7 @@ pipeline {
         script {
           ENAMES.each { item ->
             echo "Viewing: ${item} services, on ${CLUSTERS.get((item))}"
-            LIST_SERVICE = sh (script: "set +x && DOCKER_HOST=${DHOST.get((item))} DOCKER_TLS_VERIFY=1 docker service ls -f label=com.docker.stack.namespace=analis-wineservice --format '{{.Name}}'" , returnStdout: true).split('\n')
+            LIST_SERVICE = sh (script: "set +x && DOCKER_HOST=${DHOST.get((item))} DOCKER_TLS_VERIFY=1 docker service ls -f label=com.docker.stack.namespace=$STACK_LABEL -f label=ru.infoclinica.service=$SERVICE_LABEL --format '{{.Name}}'" , returnStdout: true).split('\n')
             switch (TASK_ACTION) {
               case 'up':
                 echo "These services will be updated $LIST_SERVICE to version $VERSION_TO_UPDATE"
@@ -70,7 +72,7 @@ pipeline {
         }
       }
     }
-    stage("Update Services") {
+/*    stage("Update Services") {
       steps {
         script {
           ENAMES.each { item ->
@@ -110,7 +112,7 @@ pipeline {
           sh "cat commit.txt"
           sh "cat $SWARM_GIT_NAME/tags/lab/analis-wineservice.stable-version"
           sh "cat $SWARM_GIT_NAME/tags/lab/analis-wineservice.old-stable-version"
-/*          withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
+          withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
             sh """cd $SWARM_GIT_NAME
                   git add -A
                   git config --global user.email "${JENKINS_MAIL}"
@@ -120,10 +122,10 @@ pipeline {
                   git push origin master
                """
           }
-*/        }
+        }
       }
     }
-  }
+*/  }
   post {
     always {
       echo "CleaningUp work directory"