Update withCredentials

This commit is contained in:
Layla 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
stage('Self Version') {
steps {
withCredentials( [secret( credentialsId: 'RbnDockerRegistry', secretVariable: 'DOCKER_REGISTRY')]) {
withCredentials([string(credentialsId: 'RbnDockerRegistry', variable: 'DOCKER_REGISTRY')]) {
runAutoSemver("${DOCKER_REGISTRY}/auto-semver:${SELF_SEMVER_TAG}")
}
}
@ -36,9 +36,9 @@ pipeline {
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.
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"
@ -57,14 +57,14 @@ pipeline {
{
steps {
withEcr {
withCredentials( [secret( credentialsId: 'RbnDockerRegistry', secretVariable: 'DOCKER_REGISTRY')]) {
sh "docker push ${env.DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION}"
withCredentials([string(credentialsId: 'RbnDockerRegistry', variable: 'DOCKER_REGISTRY')]) {
sh "docker push ${DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION}"
script
{
if("${env.BRANCH_NAME}" == "develop")
{
sh "docker tag ${env.DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION} ${env.DOCKER_REGISTRY}/${env.SERVICE}:latest"
sh "docker push ${env.DOCKER_REGISTRY}/${env.SERVICE}:latest"
sh "docker tag ${DOCKER_REGISTRY}/${env.SERVICE}:${env.VERSION} ${DOCKER_REGISTRY}/${env.SERVICE}:latest"
sh "docker push ${DOCKER_REGISTRY}/${env.SERVICE}:latest"
}
}
}