-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJenkinsfile
79 lines (69 loc) · 2.61 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
@Library('ratcheting') _
node {
def server = Artifactory.server 'ART'
def rtMaven = Artifactory.newMavenBuild()
def buildInfo
def oldWarnings
stage ('Clone') {
checkout scm
}
stage ('Artifactory configuration') {
rtMaven.tool = 'M3'
rtMaven.deployer releaseRepo: 'libs-release-local', snapshotRepo: 'libs-snapshot-local', server: server
rtMaven.resolver releaseRepo: 'libs-release', snapshotRepo: 'libs-snapshot', server: server
buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = true
def downloadSpec = """
{"files": [
{
"pattern": "warn/xylophone/*/warnings.yml",
"build": "xylophone :: dev/LATEST",
"target": "previous.yml",
"flat": "true"
}
]
}"""
server.download spec: downloadSpec
oldWarnings = readYaml file: 'previous.yml'
}
stage ('Spellcheck'){
result = sh (returnStdout: true,
script: """for f in \$(find . -name '*.adoc'); do cat \$f | sed "s/-/ /g" | aspell --master=en --personal=./dict list; done | sort | uniq""")
.trim()
if (result) {
echo "The following words are probaly misspelled:"
echo result
error "Please correct the spelling or add the words above to the local dictionary."
}
}
try{
stage ('Exec Maven') {
rtMaven.run pom: 'pom.xml', goals: 'clean install', buildInfo: buildInfo
}
} finally {
junit 'target/surefire-reports/**/*.xml'
recordIssues tool: checkStyle(pattern: 'target/checkstyle-result.xml')
recordIssues tool: spotBugs(pattern: 'target/spotbugsXml.xml')
}
stage ('Ratcheting') {
def warningsMap = countWarnings()
writeYaml file: 'target/warnings.yml', data: warningsMap
compareWarningMaps oldWarnings, warningsMap
}
if (env.BRANCH_NAME == 'dev') {
stage ('Publish build info') {
def uploadSpec = """
{
"files": [
{
"pattern": "target/warnings.yml",
"target": "warn/xylophone/${currentBuild.number}/warnings.yml"
}
]
}"""
def buildInfo2 = server.upload spec: uploadSpec
buildInfo.append(buildInfo2)
server.publishBuildInfo buildInfo
}
}
}