Browse Source

Jenkinsfile development

wadim 7 years ago
parent
commit
9bf3912c08
1 changed files with 14 additions and 0 deletions
  1. 14 0
      Jenkinsfile

+ 14 - 0
Jenkinsfile

@@ -5,6 +5,8 @@ pipeline {
   environment {
     docker_registry='dev-registry.infoclinica.ru:5000'
     docker_image='node'
+    jenkins_ssh_key='/run/secrets/provision-ssh-key'
+    
   }
   parameters {
     string(
@@ -54,6 +56,18 @@ pipeline {
         }
       }
     }
+    stage("Tagging"){
+      steps{
+        echo "Setting latest tag"
+        sh '''docker tag ${docker_registry}/${docker_image}:${repo}-${BUILD_NUMBER} ${docker_registry}/${docker_image}:latest
+              docker pull ${docker_registry}/${docker_image}:latest'''
+        echo "Updating tag info in iru/stack-deploy repository"
+        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 ${swarm_git_url}'''
+        }
+      }
+    }
   }
   post {
     always {