Skip to content

Commit a6db6a4

Browse files
committed
feat: BREAKING CHANGE. docker image now requires config file at runtime
instead of inserting the API key at build time. It now must be mounted during start up time.
1 parent 6bcad8a commit a6db6a4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

vars/runJenkinsPipeline.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,13 +657,19 @@ def call(){
657657
agent{
658658
label 'linux && docker && x86'
659659
}
660+
environment{
661+
DOCKER_CRED = credentials('jenkins-nexus')
662+
}
660663
steps{
661664
script{
662665
configFileProvider([configFile(fileId: 'getmarc_deployapi', variable: 'CONFIG_FILE')]) {
663666
def CONFIG = readJSON(file: CONFIG_FILE)['deploy']
664667
echo "CONFIG = ${CONFIG}"
665668
def build_args = CONFIG['docker']['build']['buildArgs'].collect{"--build-arg=${it}"}.join(' ')
666669
def dockerImage = docker.build("${IMAGE_NAME}:${DOCKER_TAG}", "${build_args} .")
670+
withEnv(['DOCKER_REGISTRY=${CONFIG["docker"]["server"]["registry"]}']){
671+
sh 'docker login $DOCKER_REGISTRY -u $DOCKER_CRED_USR -p $DOCKER_CRED_PSW'
672+
}
667673
// docker.withRegistry(CONFIG['docker']['server']['registry'], 'jenkins-nexus'){
668674
// dockerImage.push()
669675
// dockerImage.push('latest')

0 commit comments

Comments
 (0)