forked from CourseOrchestra/celesta
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
93 lines (83 loc) · 3.11 KB
/
Jenkinsfile
File metadata and controls
93 lines (83 loc) · 3.11 KB
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
@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*")
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 -name '*.adoc'); do cat \$f | sed "s/-/ /g" | aspell --master=ru --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."
}
}
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', buildInfo: buildInfo
}
} finally {
junit '**/surefire-reports/**/*.xml'
step( [ $class: 'JacocoPublisher', execPattern: '**/target/jacoco.exec' ] )
checkstyle pattern: '**/target/checkstyle-result.xml' //, canComputeNew: true, useDeltaValues: true, shouldDetectModules: true
findbugs pattern: '**/target/spotbugsXml.xml'
}
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
}
}
}