-
Notifications
You must be signed in to change notification settings - Fork 22
/
Jenkinsfile
97 lines (93 loc) · 3.18 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
pipeline {
agent {
label 'jdk21'
}
environment {
DOCKER_HUB_CREDENTIAL = credentials('dockerHub')
}
options {
// Configure an overall timeout for the build.
timeout(time: 3, unit: 'HOURS')
disableConcurrentBuilds()
}
stages {
stage('Git submodule init') {
steps {
sh 'git submodule init'
sh 'git submodule update'
}
}
stage('Compile') {
steps {
sh 'mvn clean install -Dmaven.javadoc.skip=true -DskipTests -T1C'
}
}
stage('Test') {
steps {
dir("tmail-backend") {
sh 'mvn -B surefire:test'
}
}
post {
always {
junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: false)
}
failure {
archiveArtifacts artifacts: '**/target/test-run.log' , fingerprint: true
archiveArtifacts artifacts: '**/surefire-reports/*' , fingerprint: true
}
}
}
stage('Deliver Docker images') {
when {
anyOf {
branch 'master'
buildingTag()
}
}
steps {
script {
env.DOCKER_TAG = 'branch-master'
if (env.TAG_NAME) {
env.DOCKER_TAG = env.TAG_NAME
}
echo "Docker tag: ${env.DOCKER_TAG}"
// build and push docker images
dir("tmail-backend") {
sh 'mvn -Pci jib:build -Djib.to.auth.username=$DOCKER_HUB_CREDENTIAL_USR -Djib.to.auth.password=$DOCKER_HUB_CREDENTIAL_PSW -Djib.to.tags=distributed-$DOCKER_TAG -pl apps/distributed -X'
sh 'mvn -Pci jib:build -Djib.to.auth.username=$DOCKER_HUB_CREDENTIAL_USR -Djib.to.auth.password=$DOCKER_HUB_CREDENTIAL_PSW -Djib.to.tags=memory-$DOCKER_TAG -pl apps/memory -X'
}
}
}
post {
always {
script {
if (env.BRANCH_NAME == "master") {
emailext(
subject: "[${currentBuild.result}]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'",
body: """
${currentBuild.result}: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]:
Check console output at "<a href="${env.BUILD_URL}">${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]</a>'"
""",
to: "[email protected]"
)
}
}
}
}
}
}
post {
always {
deleteDir() /* clean up our workspace */
}
success {
script {
if (env.BRANCH_NAME == "master") {
build (job: 'Gatling Imap build/master', propagate: false, wait: false)
build (job: 'James Gatling build/master', propagate: false, wait: false)
}
}
}
}
}