Files

50 lines
1.3 KiB
Groovy
Raw Permalink Normal View History

/*
* 依赖插件:
* SSH Pipeline Steps
* Pipeline Utility Steps
*
*/
pipeline {
agent any
environment {
credentialsId = 'e41b57a4-436a-4617-817c-9e3f25a8a47f'
2020-08-28 17:23:11 +08:00
dockerProtocol = "https"
dockerRegistry = 'reg.int.it2000.com.cn'
GROUP = readMavenPom().getGroupId()
ARTIFACTID = readMavenPom().getArtifactId()
VERSION = readMavenPom().getVersion()
PACKAGING = readMavenPom(). getPackaging()
}
stages {
stage('maven build') {
agent {
docker {
image 'maven:3-alpine'
args '-v /root/.m2:/root/.m2'
reuseNode true
}
}
steps {
sh 'mvn clean package -Dmaven.test.skip=true'
}
}
stage('docker build And Push'){
steps {
script{
docker.withRegistry("${env.dockerProtocol}://${env.dockerRegistry}", 'privateDockerId') {
docker.build("${env.dockerRegistry}/${env.GROUP}/${env.ARTIFACTID}:${env.VERSION}","--no-cache --build-arg JAR_FILE=target/${env.ARTIFACTID}-${env.VERSION}.${env.PACKAGING} .").push()
}
}
}
}
2020-08-28 17:23:11 +08:00
}
2018-11-05 11:32:43 +08:00
}