Update Jenkinsfile

This commit is contained in:
Nana Janashia
2020-11-06 10:50:51 +00:00
parent 57b5004ec8
commit 2f4822a421

14
Jenkinsfile vendored
View File

@@ -2,6 +2,9 @@ def gv
pipeline { pipeline {
agent any agent any
tools {
maven: 'my-mvn'
}
stages { stages {
stage("init") { stage("init") {
steps { steps {
@@ -10,17 +13,22 @@ pipeline {
} }
} }
} }
stage("build") { stage("build jar") {
steps { steps {
script { script {
gv.buildApp() gv.buildApp()
mvn package
} }
} }
} }
stage("test") { stage("build image") {
steps { steps {
script { script {
gv.testApp() withCredentials([usernamePassword(credentialsId: 'docker-hub', 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")
}
} }
} }
} }