Obtain versions
Some checks failed
Homelab/java-spring-microservice/pipeline/head There was a failure building this commit
Some checks failed
Homelab/java-spring-microservice/pipeline/head There was a failure building this commit
This commit is contained in:
parent
6eec750041
commit
14720420d0
22
Jenkinsfile
vendored
22
Jenkinsfile
vendored
@ -1,7 +1,11 @@
|
||||
|
||||
def label = "servicedemo-${UUID.randomUUID().toString()}"
|
||||
def POD_LABEL="servicedemo-${UUID.randomUUID().toString()}"
|
||||
|
||||
podTemplate(label: label, containers: [
|
||||
def REGISTRY="docker.home.thejimnicholson.com/servicedemo"
|
||||
|
||||
def POM_VERSION="unknown"
|
||||
|
||||
podTemplate(label: POD_LABEL, containers: [
|
||||
containerTemplate(
|
||||
name: 'maven',
|
||||
image: 'maven:3.8.4-openjdk-11',
|
||||
@ -12,7 +16,7 @@ podTemplate(label: label, containers: [
|
||||
name: 'kaniko',
|
||||
image: 'gcr.io/kaniko-project/executor:debug',
|
||||
command: 'sleep',
|
||||
args: '99d'
|
||||
args: '30d'
|
||||
)
|
||||
], workspaceVolume: dynamicPVC()) {
|
||||
node(label) {
|
||||
@ -27,12 +31,16 @@ podTemplate(label: label, containers: [
|
||||
script: 'git describe --tags --always --dirty=-dirty',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
container('maven') {
|
||||
stage('Build') {
|
||||
sh '''
|
||||
mvn clean package -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
|
||||
ls ~/.m2/fr/brouillard/oss/jgitver/0.14.0
|
||||
'''
|
||||
POM_VERSION=sh (
|
||||
script: "java -jar /root/.m2/repository/fr/brouillard/oss/jgitver/0.14.0/jgitver-0.14.0-executable.jar",
|
||||
returnStdout: true
|
||||
)
|
||||
}
|
||||
}
|
||||
container('kaniko') {
|
||||
@ -43,9 +51,9 @@ podTemplate(label: label, containers: [
|
||||
-c `pwd` \
|
||||
--insecure \
|
||||
--skip-tls-verify \
|
||||
--no-push \
|
||||
--tarPath ./target/servicedemo.image.tar \
|
||||
--destination=servicedemo:${GIT_HASH}"
|
||||
--tarPath ./target/servicedemo-${POM_VERSION}.image.tar \
|
||||
--destination=${registry}servicedemo:${POM_VERSION} \
|
||||
--destination=${registry}servicedemo:${GIT_TAG}"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user