Tomishinets Vladimir %!s(int64=3) %!d(string=hai) anos
pai
achega
c3cf532442
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      Jenkinsfile

+ 6 - 2
Jenkinsfile

@@ -9,6 +9,7 @@ pipeline {
   environment {
     DOCKER_IMAGE='lab/analis-wineservice'
     DOCKER_REGISTRY='registry.infoclinica.ru:5000'
+    BASE_REGISTRY='images.sdsys.ru'
     SWARM_GIT_URL='ssh://git@git.sdsys.ru:8022/labportal/stack-deploy.git'
     SWARM_GIT_NAME='stack-deploy'
     JENKINS_MAIL='jenkins@sdsys.ru'
@@ -42,8 +43,11 @@ pipeline {
           REV_NUMBER=sh (script: "svn info --show-item last-changed-revision analis", returnStdout: true ).trim()
           echo "Last-Changed-Revision number is '$REV_NUMBER'"
         }
-        sh "docker build -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${REV_NUMBER}-${BUILD_NUMBER} ."
-        sh "docker tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${REV_NUMBER}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest"
+        withCredentials([usernamePassword(credentialsId: 'registry', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
+          sh "docker login -u ${USERNAME} -p ${PASSWORD} ${BASE_REGISTRY}"
+          sh "docker build -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${REV_NUMBER}-${BUILD_NUMBER} ."
+          sh "docker tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${REV_NUMBER}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest"
+        }
       }
     }
     stage("Publish") {