-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
66 lines (59 loc) · 1.9 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 none
stages{
stage('Test') {
when {
anyOf {
branch 'development'; branch pattern: 'PR-\\d+', comparator: 'REGEXP'
}
}
agent {
docker {
image 'maven:latest'
args '-v $HOME/.m2:/root/.m2 -e HOME="." --network docker-ci_default'
}
}
steps {
sh 'mvn clean test sonar:sonar -Dsonar.host.url=http://sonarqube:9000/sonarqube -Dsonar.login=$SONAR_TOKEN'
}
}
stage('Build'){
when {
anyOf{
branch 'master'; branch 'main'; branch pattern: 'iteration\\d+', comparator: 'REGEXP'
}
}
agent {
docker {
image 'maven:latest'
args '-v $HOME/.m2:/root/.m2 --network docker-ci_default'
}
}
steps {
sh 'java -version'
sh 'mvn clean package -U'
}
}
stage('Docker'){
when {
branch 'main'
}
agent { label 'master' }
steps {
script{
def img
if (env.BRANCH_NAME == 'main') {
env.VERSION = readMavenPom().getVersion()
img = docker.build('de4a/de4a-ssi-authority-agent-base',".")
docker.withRegistry('','docker-hub-token') {
img.push('latest')
img.push("${env.VERSION}")
}
}
}
sh 'docker system prune -f'
sh 'docker network create docker-ci_default'
}
}
}
}