Update withCredentials

This commit is contained in:
2019-12-19 16:37:22 -05:00
parent 47a2da26c7
commit 5f20bcf0be

14
Jenkinsfile vendored
View File

@ -17,7 +17,7 @@ pipeline {
//Runs versioning in docker container //Runs versioning in docker container
stage('Self Version') { stage('Self Version') {
steps { steps {
withCredentials( [secret( credentialsId: 'RbnDockerRegistry', secretVariable: 'DOCKER_REGISTRY')]) { withCredentials([string(credentialsId: 'RbnDockerRegistry', variable: 'DOCKER_REGISTRY')]) {
runAutoSemver("${DOCKER_REGISTRY}/auto-semver:${SELF_SEMVER_TAG}") runAutoSemver("${DOCKER_REGISTRY}/auto-semver:${SELF_SEMVER_TAG}")
} }
} }
@ -36,9 +36,9 @@ pipeline {
echo "Building ${env.SERVICE} docker image" echo "Building ${env.SERVICE} docker image"
withCredentials( [secret( credentialsId: 'RbnDockerRegistry', secretVariable: 'DOCKER_REGISTRY')]) { withCredentials([string(credentialsId: 'RbnDockerRegistry', variable: 'DOCKER_REGISTRY')]) {
// Docker build flags are set via the getDockerBuildFlags() shared library. // Docker build flags are set via the getDockerBuildFlags() shared library.
sh "docker build ${getDockerBuildFlags()} -t ${env.DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION} ." sh "docker build ${getDockerBuildFlags()} -t ${DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION} ."
} }
sh "python setup.py sdist" sh "python setup.py sdist"
@ -57,14 +57,14 @@ pipeline {
{ {
steps { steps {
withEcr { withEcr {
withCredentials( [secret( credentialsId: 'RbnDockerRegistry', secretVariable: 'DOCKER_REGISTRY')]) { withCredentials([string(credentialsId: 'RbnDockerRegistry', variable: 'DOCKER_REGISTRY')]) {
sh "docker push ${env.DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION}" sh "docker push ${DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION}"
script script
{ {
if("${env.BRANCH_NAME}" == "develop") if("${env.BRANCH_NAME}" == "develop")
{ {
sh "docker tag ${env.DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION} ${env.DOCKER_REGISTRY}/${env.SERVICE}:latest" sh "docker tag ${DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION} ${DOCKER_REGISTRY}/${env.SERVICE}:latest"
sh "docker push ${env.DOCKER_REGISTRY}/${env.SERVICE}:latest" sh "docker push ${DOCKER_REGISTRY}/${env.SERVICE}:latest"
} }
} }
} }