|
@@ -58,12 +58,16 @@ pipeline {
|
|
|
when { expression { service_update != "" } }
|
|
|
steps {
|
|
|
script {
|
|
|
+ def CLUSTER_TGT
|
|
|
+ echo "Cluster is $cluster"
|
|
|
switch (cluster) {
|
|
|
case 'prod':
|
|
|
- CLUSTER=CLUSTER_PROD
|
|
|
+ CLUSTER_TGT=CLUSTER_PROD
|
|
|
+ echo "prod - $CLUSTER_TGT"
|
|
|
break
|
|
|
case 'dev':
|
|
|
- CLUSTER=CLUSTER_DEV
|
|
|
+ CLUSTER_TGT=CLUSTER_DEV
|
|
|
+ echo "dev - $CLUSTER_TGT"
|
|
|
break
|
|
|
default:
|
|
|
currentBuild.result = 'ABORTED'
|
|
@@ -71,10 +75,10 @@ pipeline {
|
|
|
}
|
|
|
for (String item : service_update.split()) {
|
|
|
try{
|
|
|
- echo "Updating $item"
|
|
|
+ echo "Updating $item, cluster $CLUSTER_TGT"
|
|
|
withEnv(["service_name=${item}"]) {
|
|
|
sh '''export DOCKER_CERT_PATH=/run/secrets/swarm
|
|
|
- export DOCKER_HOST=tcp://${CLUSTER}:2376 DOCKER_TLS_VERIFY=1
|
|
|
+ export DOCKER_HOST=tcp://${CLUSTER_TGT}:2376 DOCKER_TLS_VERIFY=1
|
|
|
docker service update ${service_name} --image ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${NEWTAG}
|
|
|
'''
|
|
|
}
|
|
@@ -83,7 +87,7 @@ pipeline {
|
|
|
echo "Recovering service $item"
|
|
|
withEnv(["service_name=${item}"]) {
|
|
|
sh '''export DOCKER_CERT_PATH=/run/secrets/swarm
|
|
|
- export DOCKER_HOST=tcp://${CLUSTER}:2376 DOCKER_TLS_VERIFY=1
|
|
|
+ export DOCKER_HOST=tcp://${CLUSTER_TGT}:2376 DOCKER_TLS_VERIFY=1
|
|
|
docker service rollback ${service_name}
|
|
|
'''
|
|
|
}
|