Update Jenkinsfile

This commit is contained in:
Nana Janashia
2020-11-06 11:26:28 +00:00
parent 845783dbc6
commit e637047b84

21
Jenkinsfile vendored
View File

@@ -1,33 +1,36 @@
def gv
pipeline { pipeline {
agent any agent any
tools { tools {
maven 'Maven' maven 'Maven'
} }
stages { stages {
stage("init") {
steps {
script {
gv = load "script.groovy"
}
}
}
stage("build jar") { stage("build jar") {
steps { steps {
script { script {
echo "building the application..." gv.buildJar()
sh 'mvn package'
} }
} }
} }
stage("build image") { stage("build image") {
steps { steps {
script { script {
echo "building the docker image..." gv.buildImage()
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'
}
} }
} }
} }
stage("deploy") { stage("deploy") {
steps { steps {
script { script {
echo "deploying the application..." gv.deployApp()
} }
} }
} }