Jelajahi Sumber

Обновить 'Jenkinsfile'

Vladimir Tomishinets 6 tahun lalu
induk
melakukan
1fb4cf87d2
1 mengubah file dengan 9 tambahan dan 4 penghapusan
  1. 9 4
      Jenkinsfile

+ 9 - 4
Jenkinsfile

@@ -17,6 +17,11 @@ pipeline {
       defaultValue: "prod",
       description: "Repository to build and/or deploy from."
     )
+    string(
+      name: "cluster",
+      defaultValue: "dev",
+      description: "Cluster to deploy (dev or prod)."
+    )
     string(
       name: "service_update",
       defaultValue: "info_admin",
@@ -48,7 +53,7 @@ pipeline {
           for (String item : service_update.split()) {
             try{
               echo "Updating $item"
-              if (repo == 'prod') {
+              if (cluster == 'prod') {
                 withEnv(["service_name=${item}"]) {
                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm
                         export DOCKER_HOST=tcp://${CLUSTER_PROD}:2376 DOCKER_TLS_VERIFY=1
@@ -56,7 +61,7 @@ pipeline {
                       '''
                 }
               }
-              if (repo == 'dev') {
+              if (cluster == 'dev') {
                 withEnv(["service_name=${item}"]) {
                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm
                         export DOCKER_HOST=tcp://${CLUSTER_DEV}:2376 DOCKER_TLS_VERIFY=1
@@ -67,7 +72,7 @@ pipeline {
             }
             catch(err){
               echo "Recovering service $item"
-              if (repo == 'prod') {
+              if (cluster == 'prod') {
                 withEnv(["service_name=${item}"]) {
                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm
                         export DOCKER_HOST=tcp://${CLUSTER_PROD}:2376 DOCKER_TLS_VERIFY=1
@@ -75,7 +80,7 @@ pipeline {
                      '''
                 }
               }
-              if (repo == 'dev') {
+              if (cluster == 'dev') {
                 withEnv(["service_name=${item}"]) {
                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm
                         export DOCKER_HOST=tcp://${CLUSTER_DEV}:2376 DOCKER_TLS_VERIFY=1