Procházet zdrojové kódy

move funcs to shared-library

Tomishinets Vladimir před 4 roky
rodič
revize
c95d8bd2d7
1 změnil soubory, kde provedl 4 přidání a 20 odebrání
  1. 4 20
      IRURenewalWildcardJenkinsfile

+ 4 - 20
IRURenewalWildcardJenkinsfile

@@ -65,20 +65,20 @@ pipeline {
     stage("Update secret in CLUSTERS") {
       steps {
         script {
-          git_clone(PKI_GIT_URL)
-          git_clone(STACK_DEPLOY_GIT_URL)
+          gitOps.clone(PKI_GIT_URL)
+          gitOps.clone(STACK_DEPLOY_GIT_URL)
           def NEW_ENDDATE = sh (script: "openssl x509 -enddate -noout -in ${CONFIG_DIR}/live/${DOMAIN}/cert.pem", returnStdout: true).trim()
           ENDDATE = sh (script: "echo|openssl s_client -servername ${REGISTRY_PROD} -connect ${REGISTRY_PROD}:5000 2>/dev/null|openssl x509 -noout -enddate", returnStdout: true).trim()
           if (ENDDATE != NEW_ENDDATE) {
             echo "Update docker secret in ${CLUSTER_NAME_PROD}"
             def NODE_IP = sh (script: "DOCKER_HOST=tcp://${CLUSTER_NAME_PROD}:2376 DOCKER_TLS_VERIFY=1 docker node inspect self -f '{{.Status.Addr}}'" , returnStdout: true).trim()
-            update_secret(NODE_IP, STACK_DEPLOY_GIT_NAME, DOMAIN, CONFIG_DIR)
+            dockerWCrenewal.update_secretIRU(NODE_IP, STACK_DEPLOY_GIT_NAME, DOMAIN, CONFIG_DIR)
           }
           ENDDATE = sh (script: "echo|openssl s_client -servername ${REGISTRY_DEV} -connect ${REGISTRY_DEV}:5000 2>/dev/null|openssl x509 -noout -enddate", returnStdout: true).trim()
           if (ENDDATE != NEW_ENDDATE) {
             echo "Update docker secret in ${CLUSTER_NAME_DEV}"
             NODE_IP = sh (script: "DOCKER_HOST=tcp://${CLUSTER_NAME_DEV}:2376 DOCKER_TLS_VERIFY=1 docker node inspect self -f '{{.Status.Addr}}'" , returnStdout: true).trim()
-            update_secret(NODE_IP, STACK_DEPLOY_GIT_NAME, DOMAIN, CONFIG_DIR)
+            dockerWCrenewal.update_secretIRU(NODE_IP, STACK_DEPLOY_GIT_NAME, DOMAIN, CONFIG_DIR)
           }
         }
       }
@@ -105,19 +105,3 @@ pipeline {
     }
   }
 }
-def git_clone(String REPO) {
-        withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) {
-          sh """GIT_SSH_COMMAND='ssh -i ${GIT_SSH_KEY} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \
-                git clone ${REPO}
-             """
-        }
-}
-def update_secret(String NODE_IP, String STACK_DEPLOY_GIT_NAME, String DOMAIN, String CONFIG_DIR) {
-        sh """export DOCKER_HOST=tcp://${NODE_IP}:2376 DOCKER_TLS_VERIFY=1
-              docker service rm infrastructure_registry
-              docker secret rm infoclinica_full
-              docker secret create infoclinica_full ${CONFIG_DIR}/archive/${DOMAIN}/${DOMAIN}.full-bundle
-              cd ${STACK_DEPLOY_GIT_NAME}
-              ./infrastructure.sh
-           """
-}