-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
66 lines (48 loc) · 1.73 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
pipeline {
agent {
kubernetes {
yamlFile 'kubernetesPod.yaml'
}
}
options {
buildDiscarder(logRotator(numToKeepStr: '3'))
}
stages {
stage('Load maven cache repository from S3') {
steps {
container('builder') {
sh """
aws --region 'eu-west-1' s3 sync s3://oa-phaedra2-jenkins-maven-cache/ /home/jenkins/maven-repository --quiet
"""
}
}
}
stage('Build') {
steps {
container('builder') {
configFileProvider([configFile(fileId: 'maven-settings-rsb', variable: 'MAVEN_SETTINGS_RSB')]) {
sh 'mvn -s $MAVEN_SETTINGS_RSB -U clean install -DskipTests -Ddockerfile.skip -Dmaven.repo.local=/home/jenkins/maven-repository'
}
}
}
}
stage("Deploy to Nexus") {
steps {
container('builder') {
configFileProvider([configFile(fileId: 'maven-settings-rsb', variable: 'MAVEN_SETTINGS_RSB')]) {
sh 'mvn -s $MAVEN_SETTINGS_RSB deploy -DskipTests -Ddockerfile.skip -Dmaven.repo.local=/home/jenkins/maven-repository'
}
}
}
}
stage('Cache maven repository to S3') {
steps {
container('builder') {
sh """
aws --region 'eu-west-1' s3 sync /home/jenkins/maven-repository s3://oa-phaedra2-jenkins-maven-cache/ --quiet --exclude "*eu/openanalytics/*"
"""
}
}
}
}
}