From f400932f4017fe0008331cf79f0ce65b89e8ae23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Cl=C3=A9ment?= Date: Thu, 1 Mar 2018 19:53:51 +0100 Subject: [PATCH 1/3] test --- Jenkinsfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 83fa391..4278272 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,16 +32,18 @@ node { * First, the incremental build number from Jenkins * Second, the 'latest' tag. * Pushing multiple tags is cheap, as all the layers are reused. */ - def docker_tag - script { - if (env.BRANCH_NAME == 'master') { - app.push() - } else { - app.push("devel") - } + docker.withRegistry('https://docker.io', 'docker-hub-credentials') { + script { + if (env.BRANCH_NAME == 'master') { + app.push() + } else { + app.push("devel") + } + } } + } stage('Cleaning'){ sh "docker image prune -f" From 15975d8582d96d620957a6f7bac14544a6365f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Cl=C3=A9ment?= Date: Thu, 1 Mar 2018 19:58:45 +0100 Subject: [PATCH 2/3] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4278272..502b13b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,7 +32,8 @@ node { * First, the incremental build number from Jenkins * Second, the 'latest' tag. * Pushing multiple tags is cheap, as all the layers are reused. */ - docker.withRegistry('https://docker.io', 'docker-hub-credentials') { + withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker-hub-credentials', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { + sh 'docker login -u $USERNAME -p $PASSWORD script { if (env.BRANCH_NAME == 'master') { app.push() From c2494dbad5492c3f1b145bb3de5b1700da641119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Cl=C3=A9ment?= Date: Thu, 1 Mar 2018 20:00:44 +0100 Subject: [PATCH 3/3] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 502b13b..e2a1a57 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ node { * Second, the 'latest' tag. * Pushing multiple tags is cheap, as all the layers are reused. */ withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker-hub-credentials', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { - sh 'docker login -u $USERNAME -p $PASSWORD + sh 'docker login -u $USERNAME -p $PASSWORD' script { if (env.BRANCH_NAME == 'master') { app.push()