Commit 32cc9ecc authored by Frederic Gurr's avatar Frederic Gurr 👷

Update Jenkinsfile

parent dd428234
......@@ -13,6 +13,9 @@
image: buildpack-deps:stable
command:
- cat
env:
- name: "MAVEN_OPTS"
value: "-Duser.home=/home/jenkins"
tty: true
resources:
limits:
......@@ -33,20 +36,24 @@
memory: "2Gi"
cpu: "1"
volumeMounts:
- name: mvnw
mountPath: /home/jenkins/.m2/wrapper
readOnly: false
- name: tools
mountPath: /opt/tools
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
- name: settings-xml
mountPath: /home/jenkins/.m2/settings.xml
subPath: settings.xml
readOnly: true
- name: settings-security-xml
mountPath: /home/jenkins/.m2/settings-security.xml
subPath: settings-security.xml
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: mvnw
emptyDir: {}
- name: tools
persistentVolumeClaim:
claimName: tools-claim-jiro-webdev
- name: m2-repo
emptyDir: {}
- name: tmp
......@@ -57,6 +64,12 @@
items:
- key: settings.xml
path: settings.xml
- name: settings-security-xml
secret:
secretName: m2-secret-dir
items:
- key: settings-security.xml
path: settings-security.xml
'''
}
}
......@@ -93,6 +106,11 @@
buildDiscarder(logRotator(numToKeepStr: '10'))
}
tools {
maven 'apache-maven-latest'
jdk 'adoptopenjdk-hotspot-jdk11-latest'
}
triggers {
// build once a week to keep up with parents images updates
cron('H H * * H')
......@@ -101,31 +119,24 @@
stages {
stage('Build Java code') {
steps {
sh './mvnw -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode package'
stash includes: 'target/', name: 'target'
sh 'mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B package'
}
}
stage('Push package image to Nexus') {
agent {
label 'docker-build'
}
when {
anyOf {
environment name: 'ENVIRONMENT', value: 'production'
}
}
steps {
sh '''
sh './mvnw -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode clean deploy'
'''
sh 'mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B clean deploy'
}
}
}
post {
always {
deleteDir() /* clean up workspace */
sendNotifications currentBuild
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment