|
@@ -28,22 +28,19 @@ pipeline {
|
|
|
}
|
|
|
stages {
|
|
|
stage("Build") {
|
|
|
- when { expression { service_update == "" } } // tmp
|
|
|
steps {
|
|
|
echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
|
|
|
sh "docker build --build-arg repo=${repo} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ."
|
|
|
}
|
|
|
}
|
|
|
stage("Publish") {
|
|
|
- when { expression { service_update == "" } } // tmp
|
|
|
steps {
|
|
|
echo "Publishing ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}"
|
|
|
sh "docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}"
|
|
|
}
|
|
|
}
|
|
|
stage("Update") {
|
|
|
-// when { expression { service_update != "" } }
|
|
|
- when { expression { service_update == "" } } // tmp
|
|
|
+ when { expression { service_update != "" } }
|
|
|
steps {
|
|
|
script {
|
|
|
for (String item : service_update.split()) {
|
|
@@ -63,8 +60,8 @@ 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'''
|
|
|
+ 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' \
|
|
@@ -72,7 +69,7 @@ pipeline {
|
|
|
ls
|
|
|
cd ${SWARM_GIT_NAME}
|
|
|
ls
|
|
|
- echo ${BUILD_NUMBER} > tags/${DOCKER_IMAGE}.version
|
|
|
+ echo -n ${BUILD_NUMBER} > tags/${DOCKER_IMAGE}.version
|
|
|
git add -A
|
|
|
git config --global user.email "${JENKINS_MAIL}"
|
|
|
git config --global user.name "Jenkins"
|