From e637047b84222ac77b1490fbe010edce5074e270 Mon Sep 17 00:00:00 2001 From: Nana Janashia Date: Fri, 6 Nov 2020 11:26:28 +0000 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 22e07da..8b55f4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,33 +1,36 @@ +def gv + pipeline { agent any tools { maven 'Maven' } stages { + stage("init") { + steps { + script { + gv = load "script.groovy" + } + } + } stage("build jar") { steps { script { - echo "building the application..." - sh 'mvn package' + gv.buildJar() } } } stage("build image") { steps { script { - echo "building the docker image..." - withCredentials([usernamePassword(credentialsId: 'docker-hub-repo', passwordVariable: 'PASS', usernameVariable: 'USER')]) { - sh 'docker build -t nanajanashia/demo-app:jma-2.0 .' - sh "echo $PASS | docker login -u $USER --password-stdin" - sh 'docker push nanajanashia/demo-app:jma-2.0' - } + gv.buildImage() } } } stage("deploy") { steps { script { - echo "deploying the application..." + gv.deployApp() } } }