Restart deployment when new image built (#2)

This commit is contained in:
Marcus Noble 2019-12-24 11:59:17 +00:00 committed by Marcus Noble
parent fc1066c455
commit 45049de87b

16
Jenkinsfile vendored
View File

@ -22,7 +22,23 @@ pipeline {
container('docker') { container('docker') {
sh """ sh """
docker login docker.cloud.cluster.fun -u $DOCKER_CREDS_USR -p $DOCKER_CREDS_PSW docker login docker.cloud.cluster.fun -u $DOCKER_CREDS_USR -p $DOCKER_CREDS_PSW
docker tag docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT} docker.cloud.cluster.fun/averagemarcus/blog:latest
docker push docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT} docker push docker.cloud.cluster.fun/averagemarcus/blog:${env.GIT_COMMIT}
docker push docker.cloud.cluster.fun/averagemarcus/blog:latest
"""
}
}
}
stage('Restart deployment') {
when { branch 'master' }
steps {
container('kubectl') {
sh """
set +x
mkdir -p ~/.kube/
printf "\$CLOUD_KUBECONFIG" > ~/.kube/config
kubectl --kubeconfig ~/.kube/config rollout restart deployment/blog --namespace default
""" """
} }
} }