From 9d0d7a4c70d3eab606421260caee2e3ce827e358 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 31 Jan 2020 21:29:10 +0100 Subject: [PATCH] Jenkinsfile refactor --- Jenkinsfile | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4945f56..e7d7a1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,38 +8,24 @@ pipeline { stages { stage('Checkout') { steps { - script { - util.setEnv() - } - } - } - stage('Build') { - when { - branch 'master' - } - environment { - CREDS = credentials('docker-registry') - } - steps { - sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY' - sh 'docker-compose build --parallel' - sh 'docker-compose push' + setEnv() } } stage('Deploy') { when { branch 'master' } + environment { + CREDENTIALS = credentials('docker-registry') + } steps { - sh "docker stack deploy --with-registry-auth --prune --compose-file docker-compose.yml ${env.PROJECT_NAME}" + dockerDeploy() } } } post { always { - script { - util.sendEmail() - } + sendEmail() } } } \ No newline at end of file