-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathJenkinsfile
113 lines (101 loc) · 3.87 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
@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
rtMaven.deployer.artifactDeploymentPatterns.addExclude("*celesta-test*")
rtMaven.deployer.deployArtifacts = (env.BRANCH_NAME == 'dev')
buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = true
def downloadSpec = """
{"files": [
{
"pattern": "warn/celesta/*/warnings.yml",
"build": "celesta :: 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 celesta-documentation/src/main/asciidoc/en -name '*.adoc'); do cat \$f | sed "s/-/ /g" | aspell --master=en --personal=./dict-en 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 dict-en."
}
result = sh (returnStdout: true,
script:
"""for f in \$(find celesta-documentation/src/main/asciidoc/ru -name '*.adoc'); do cat \$f | sed "s/-/ /g" | aspell --master=ru --personal=./dict-ru 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 dict-ru."
}
}
stage ('Docker cleanup') {
sh '''docker ps -a -q &> /dev/null
if [ $? != 0 ]; then
docker rm $(docker ps -a -q)
fi'''
}
try{
stage ('Exec Maven') {
rtMaven.run pom: 'pom.xml', goals: 'clean install -P dev -pl !celesta-documentation', buildInfo: buildInfo
}
} finally {
junit '**/surefire-reports/**/*.xml'
recordIssues tool: checkStyle(pattern: '**/target/checkstyle-result.xml')
recordIssues tool: spotBugs(pattern: '**/target/spotbugsXml.xml')
publishHTML (target: [
allowMissing: true,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'coverage-report/target/site/jacoco-aggregate',
reportFiles: 'index.html',
reportName: "JaCoCo report"
])
}
stage ('Ratcheting') {
def modules = ['celesta-sql',
'celesta-core',
'celesta-maven-plugin',
'celesta-system-services',
'dbschemasync',
'celesta-unit']
def warningsMap = countWarnings modules
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/celesta/${currentBuild.number}/warnings.yml"
}
]
}"""
def buildInfo2 = server.upload spec: uploadSpec
buildInfo.append(buildInfo2)
server.publishBuildInfo buildInfo
}
}
}