소스 검색

Обновить 'Jenkinsfile'

Vladimir Tomishinets 6 년 전
부모
커밋
0eb09a9c1b
1개의 변경된 파일21개의 추가작업 그리고 7개의 파일을 삭제
  1. 21 7
      Jenkinsfile

+ 21 - 7
Jenkinsfile

@@ -1,3 +1,5 @@
+def SERIAL
+
 pipeline {
   agent {
     label "swarm"
@@ -5,29 +7,41 @@ pipeline {
   environment {
     DOCKER_REGISTRY='dev-registry.infoclinica.ru:5000'
     DOCKER_IMAGE='ovpn'
+    SERVICE_NAME='ovpn_server'
     SERVICE_IMAGE='container_run'
-    SERVICE_NAME='ovpn'
     SWARM_GIT_URL='ssh://git@git.sdsys.ru:8022/iru/stack-deploy.git'
     SWARM_GIT_NAME='stack-deploy'
     PKI_GIT_URL='ssh://git@git.sdsys.ru:8022/iru/openvpn-pki.git'
     PKI_GIT_NAME='openvpn-pki'
-    GOST_GIT_DIR='openvpn'
+    OVPN_GIT_DIR='openvpn'
     JENKINS_MAIL='jenkins@sdsys.ru'
-    CLUSTER_NAME='iru-swarm1-open.infoclinica.ru'
+    CLUSTER_NAME='dev-iru-swarm.infoclinica.lan'
   }
   parameters {
+    string(
+      name: "branch",
+      defaultValue: "97009",
+      description: "Which branch to use"
+    )
     string(
       name: "mailto",
-      defaultValue: "admin@sdsys.ru",
+      defaultValue: "tomishinets.v@sdsys.ru",
       description: "Email which has to be notified."
     )
   }
   stages {
+    stage ("Discover SERIAL") {
+      steps {
+        script {
+          SERIAL = sh script: "echo -n `date +%y%m%d``printf %03d $BUILD_NUMBER`", returnStdout: true
+        }
+      }
+    }
     stage("Pull PKI repo") {
       steps {
         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 ${PKI_GIT_URL}
+                git clone ${PKI_GIT_URL} && cd ${WORKSPACE}/${PKI_GIT_NAME} && git checkout ${branch} && cd ${WORKSPACE}
              '''
         }
           sh '''cp ${WORKSPACE}/openvpn-pki/open/easy-rsa/keys/ca.crt \
@@ -43,7 +57,7 @@ pipeline {
              '''
       }
     }
-    stage("Build") {
+/*    stage("Build") {
       steps {
         echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER}."
         sh "docker build --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} ."
@@ -137,7 +151,7 @@ pipeline {
          }
        }
      }
-  }
+*/  }
   post {
     always {
       echo "CleaningUp work directory"