-
Notifications
You must be signed in to change notification settings - Fork 45
/
Jenkinsfile
82 lines (76 loc) · 2.51 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
@Library('lifecycle-utils@main') _
Map pipelineParams = [
"agent": "ubuntu-14.04",
"jdk": "JDK8",
"maven": "Maven (latest)",
"projectKey": "mule-maven-plugin",
"mavenAdditionalArgs": "",
"deployArtifacts": true,
"binariesScan": true,
"skipTestsArgs": "-DskipIntegrationTests"
]
def CURRENT_STAGE
pipeline {
options {
timeout(time: 10, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '5'))
}
tools {
jdk pipelineParams.jdk
maven pipelineParams.maven
}
agent {
label pipelineParams.agent
}
stages {
stage('Build') {
steps {
script {
CURRENT_STAGE = env.STAGE_NAME
buildWithMaven("clean install ${pipelineParams.skipTestsArgs} ${pipelineParams.mavenAdditionalArgs} -pl '!:mmp-sonar'")
}
}
}
stage('MMP Sonar') {
steps {
script {
CURRENT_STAGE = env.STAGE_NAME
buildWithMaven("clean install ${pipelineParams.skipTestsArgs} ${pipelineParams.mavenAdditionalArgs} -pl ':mmp-sonar'")
}
}
}
stage('Binaries Scan') {
tools {
jdk "adoptopenjdk-17"
}
when {
expression { pipelineParams.binariesScan }
}
steps {
script {
CURRENT_STAGE = env.STAGE_NAME
scanSonarQube(pipelineParams.projectKey)
scanNexusIQ()
}
}
}
stage('Deploy Artifacts') {
steps {
script {
CURRENT_STAGE = env.STAGE_NAME
if (isUnix() && !isDevBranch()) {
echo "Performing artifacts deployment..."
buildWithMaven("clean deploy -DskipTests -P '!default'")
} else {
echo "Artifacts deployment skipped..."
}
}
}
}
}
post {
failure {
notifyBuildToSlack(CURRENT_STAGE)
}
}
}