|
@@ -57,7 +57,7 @@ pipeline {
|
|
|
error('Unknown cluster')
|
|
|
}
|
|
|
}
|
|
|
-/* echo "Building ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
|
|
|
+ echo "Building ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
|
|
|
sh "docker build --build-arg repo=${repo} --no-cache -t ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ."
|
|
|
script {
|
|
|
NEWTAG = sh script: "docker run --rm ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} rpm -q --qf %{VERSION}-%{RELEASE} ${PACKAGE_NAME} 2> /dev/null", returnStdout: true
|
|
@@ -65,28 +65,26 @@ pipeline {
|
|
|
echo "NEWTAG is $NEWTAG"
|
|
|
}
|
|
|
sh "docker tag ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
-*/ }
|
|
|
+ }
|
|
|
}
|
|
|
-/* stage("Publish") {
|
|
|
+ stage("Publish") {
|
|
|
steps {
|
|
|
echo "Publishing ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
sh "docker push ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
}
|
|
|
}
|
|
|
-*/ stage("Update") {
|
|
|
+ stage("Update") {
|
|
|
when { expression { service_update != "" } }
|
|
|
steps {
|
|
|
script {
|
|
|
for (String item : service_update.split()) {
|
|
|
try{
|
|
|
echo "Updating ${item}"
|
|
|
- sh """echo Docker host is $DOCKER_HOST, cert $DOCKER_CERT_PATH
|
|
|
- DOCKER_HOST=$DOCKER_HOST DOCKER_CERT_PATH=$DOCKER_CERT_PATH docker node ls"""
|
|
|
- sh "docker service update ${service_name} --image ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
+ sh "DOCKER_HOST=$DOCKER_HOST DOCKER_CERT_PATH=$DOCKER_CERT_PATH docker service update ${service_name} --image ${DOCKER_REGISTRY}/iru/${DOCKER_IMAGE}:${NEWTAG}"
|
|
|
}
|
|
|
catch(err){
|
|
|
echo "Recovering service $item"
|
|
|
- sh "docker service rollback ${service_name}"
|
|
|
+ sh "DOCKER_HOST=$DOCKER_HOST DOCKER_CERT_PATH=$DOCKER_CERT_PATH docker service rollback ${service_name}"
|
|
|
throw err
|
|
|
}
|
|
|
}
|