| 
														
															@@ -2,6 +2,9 @@ pipeline { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   agent { 
														 | 
														
														 | 
														
															   agent { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     label "swarm" 
														 | 
														
														 | 
														
															     label "swarm" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  options { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ansiColor('xterm') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   environment { 
														 | 
														
														 | 
														
															   environment { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     DOCKER_REGISTRY='dev-registry.infoclinica.ru:5000' 
														 | 
														
														 | 
														
															     DOCKER_REGISTRY='dev-registry.infoclinica.ru:5000' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     DOCKER_IMAGE='node-lab' 
														 | 
														
														 | 
														
															     DOCKER_IMAGE='node-lab' 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -41,13 +44,13 @@ pipeline { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   stages { 
														 | 
														
														 | 
														
															   stages { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     stage("Build") { 
														 | 
														
														 | 
														
															     stage("Build") { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       steps { 
														 | 
														
														 | 
														
															       steps { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        echo "Building ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}." 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        echo "\u001B[32m \u2600 Building \u001B[35m ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}. \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         sh "docker build --build-arg repo=${repo} --build-arg version=${version} --no-cache -t ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ." 
														 | 
														
														 | 
														
															         sh "docker build --build-arg repo=${repo} --build-arg version=${version} --no-cache -t ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ." 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 /*    stage("Publish") { 
														 | 
														
														 | 
														
															 /*    stage("Publish") { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       steps { 
														 | 
														
														 | 
														
															       steps { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        echo "Publishing ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        echo "\u001B[32m \u2600 Publishing \u001B[35m ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         sh "docker push ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}" 
														 | 
														
														 | 
														
															         sh "docker push ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -57,7 +60,7 @@ pipeline { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         script { 
														 | 
														
														 | 
														
															         script { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           for (String item : service_update.split()) { 
														 | 
														
														 | 
														
															           for (String item : service_update.split()) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             try{ 
														 | 
														
														 | 
														
															             try{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-              echo "Updating $item" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              echo "\u001B[32m \u2600 Updating \u27A1 $item \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               if (cluster == 'prod') { 
														 | 
														
														 | 
														
															               if (cluster == 'prod') { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 withEnv(["service_name=${item}"]) { 
														 | 
														
														 | 
														
															                 withEnv(["service_name=${item}"]) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm 
														 | 
														
														 | 
														
															                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -76,7 +79,7 @@ pipeline { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               } 
														 | 
														
														 | 
														
															               } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             catch(err){ 
														 | 
														
														 | 
														
															             catch(err){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-              echo "Recovering service $item" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              echo "\u001B[32m \u2600 Recovering service \u27A1 $item \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               if (cluster == 'prod') { 
														 | 
														
														 | 
														
															               if (cluster == 'prod') { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 withEnv(["service_name=${item}"]) { 
														 | 
														
														 | 
														
															                 withEnv(["service_name=${item}"]) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm 
														 | 
														
														 | 
														
															                   sh '''export DOCKER_CERT_PATH=/run/secrets/swarm 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -101,10 +104,10 @@ pipeline { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     stage("Tagging"){ 
														 | 
														
														 | 
														
															     stage("Tagging"){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       steps{ 
														 | 
														
														 | 
														
															       steps{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        echo "Setting latest tag" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        echo "\u001B[32m \u2600 Setting latest tag \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         sh '''docker tag ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:latest 
														 | 
														
														 | 
														
															         sh '''docker tag ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:latest 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               docker push ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:latest''' 
														 | 
														
														 | 
														
															               docker push ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:latest''' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        echo "Updating tag info in ${SWARM_GIT_NAME} repository" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        echo "\u001B[32m \u2600 Updating tag info in \u001B[35m ${SWARM_GIT_NAME} repository \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         withCredentials([sshUserPrivateKey(credentialsId: 'provision', keyFileVariable: 'GIT_SSH_KEY', passphraseVariable: '', usernameVariable: 'GIT_SSH_USERNAME')]) { 
														 | 
														
														 | 
														
															         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' \ 
														 | 
														
														 | 
														
															           sh '''GIT_SSH_COMMAND='ssh -i ${GIT_SSH_KEY} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' \ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                   git clone ${SWARM_GIT_URL} 
														 | 
														
														 | 
														
															                   git clone ${SWARM_GIT_URL} 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -123,7 +126,7 @@ pipeline { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 */  } 
														 | 
														
														 | 
														
															 */  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   post { 
														 | 
														
														 | 
														
															   post { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     always { 
														 | 
														
														 | 
														
															     always { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      echo "CleaningUp work diretory" 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      echo "\u001B[32m \u2600 CleaningUp work diretory \u001B[0m" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       deleteDir() 
														 | 
														
														 | 
														
															       deleteDir() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     failure { 
														 | 
														
														 | 
														
															     failure { 
														 |