forked from daticahealth/java-tomcat-maven-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
52 lines (42 loc) · 1.56 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
node {
def server
def buildInfo
def rtMaven
stage ('Clone') {
git url: 'https://github.com/gitta-jfrog/java-tomcat-maven-example',
credentialsId: 'git-jenkins-user'
}
stage ('Artifactory configuration') {
// Obtain an Artifactory server instance, defined in Jenkins --> Manage:
server = Artifactory.server 'artifactory01'
rtMaven = Artifactory.newMavenBuild()
rtMaven.tool = 'MAVEN_HOME'
rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', server: server
rtMaven.resolver releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot', server: server
rtMaven.deployer.deployArtifacts = false // Disable artifacts deployment during Maven run
buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = true
buildInfo.env.collect()
}
stage ('Test') {
rtMaven.run pom: 'pom.xml', goals: 'clean test'
}
stage ('Install') {
rtMaven.run pom: 'pom.xml', goals: 'install', buildInfo: buildInfo
}
stage ('Deploy') {
rtMaven.deployer.deployArtifacts buildInfo
}
stage ('Publish build info') {
server.publishBuildInfo buildInfo
}
stage ('Xray Scan') {
def scanConfig = [
'buildName' : buildInfo.name,
'buildNumber' : buildInfo.number,
'failBuild' : false
]
def scanResult = server.xrayScan scanConfig
echo scanResult as String
}
}