Tomishinets Vladimir 3 years ago
parent
commit
e28e572e3a
1 changed files with 19 additions and 19 deletions
  1. 19 19
      updateK8s.Jenkinsfile

+ 19 - 19
updateK8s.Jenkinsfile

@@ -53,32 +53,32 @@ pipeline {
           def data_build = readYaml file: VALUES_FILE_DEV
           TAG_PATH_BUILD = "images." + DOCKER_IMAGE.split("/")[1] + ".build"
           TAG = yamlOps.getBuilder(TAG_PATH_BUILD, data_build)
-          echo "TAG = ${TAG}"
           def data_stable = readYaml file: VALUES_FILE_PROD
-          echo "Next TAG = ${data_stable}"
           TAG_PATH_STABLE = "images." + DOCKER_IMAGE.split("/")[1] + ".stable"
           yamlOps.updateBuilder(TAG_PATH_STABLE, data_stable, TAG)
           writeYaml file: VALUES_FILE_PROD, data: data_stable, overwrite: true
-          sh "cat ${VALUES_FILE_PROD}"
         }
       }
     }
-    // stage("Update APP") {
-    //   steps {
-    //     script {
-    //       RELEASENAME = CHART_SUBPATH.split("/")[1]
-    //       try {
-    //         echo "Update APP"
-    //         k8sHelmOps.upgrade(CLOUD, NAMESPACE, RELEASENAME, CHART_PATH, 'dev')
-    //       }
-    //       catch(err) {
-    //         echo "Recovering APP"
-    //         k8sHelmOps.rollback(CLOUD, NAMESPACE, RELEASENAME)
-    //         throw err
-    //       }
-    //     }
-    //   }
-    // }
+    stage("Update APP") {
+      steps {
+        script {
+          RELEASENAME = CHART_SUBPATH.split("/")[1]
+          NAMESPACE = DOCKER_IMAGE.split("/")[0]
+          IMAGE_TO_PUSH = "${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${TAG}"
+          try {
+            echo "Update APP"
+            k8sHelmOps.upgrade(CONTEXT, NAMESPACE, RELEASENAME, CHART_PATH, VALUES_FILE_PROD, HELM_REPO)
+            echo "Update success!!!"
+          }
+          catch(err) {
+            echo "Recovering APP"
+            k8sHelmOps.rollback(CONTEXT, NAMESPACE, RELEASENAME)
+            throw err
+          }
+        }
+      }
+    }
     stage("Push changes to REPO") {
       steps {
         script {