Fix PR docker image pushing to wrong repo
This commit is contained in:
parent
3dc9b20543
commit
26064b20b8
10
Jenkinsfile
vendored
10
Jenkinsfile
vendored
@ -31,11 +31,11 @@ pipeline {
|
||||
// Docker Build
|
||||
sh 'docker build --pull --no-cache --squash --compress -t ${TEMP_IMAGE} .'
|
||||
|
||||
// Private Registry
|
||||
sh 'docker tag ${TEMP_IMAGE} ${DOCKER_PRIVATE_REGISTRY}/${IMAGE}:github-${BRANCH_LOWER}'
|
||||
withCredentials([usernamePassword(credentialsId: 'jc21-private-registry', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
|
||||
sh "docker login -u '${duser}' -p '${dpass}' ${DOCKER_PRIVATE_REGISTRY}"
|
||||
sh 'docker push ${DOCKER_PRIVATE_REGISTRY}/${IMAGE}:github-${BRANCH_LOWER}'
|
||||
// Dockerhub
|
||||
sh 'docker tag ${TEMP_IMAGE} docker.io/jc21/${IMAGE}:github-${BRANCH_LOWER}'
|
||||
withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) {
|
||||
sh "docker login -u '${duser}' -p '${dpass}'"
|
||||
sh 'docker push docker.io/jc21/${IMAGE}:github-${BRANCH_LOWER}'
|
||||
}
|
||||
|
||||
sh 'docker rmi ${TEMP_IMAGE}'
|
||||
|
Loading…
Reference in New Issue
Block a user