forked from jenkinsci/blueocean-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
114 lines (102 loc) · 4.28 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
114
#!groovy
// only 20 builds
properties([buildDiscarder(logRotator(artifactNumToKeepStr: '20', numToKeepStr: '20'))])
node() {
stage('Setup') {
deleteDir()
checkout scm
sh 'docker build -t blueocean_build_env --build-arg GID=$(id -g ${USER}) --build-arg UID=$(id -u ${USER}) - < Dockerfile.build'
withCredentials([file(credentialsId: 'blueoceandeploy_ath', variable: 'FILE')]) {
sh 'mv $FILE acceptance-tests/live.properties'
}
configFileProvider([configFile(fileId: 'blueocean-maven-settings', variable: 'MAVEN_SETTINGS')]) {
sh 'mv $MAVEN_SETTINGS settings.xml'
}
withCredentials([file(credentialsId: 'blueocean-ath-private-repo-key', variable: 'FILE')]) {
sh 'mv $FILE acceptance-tests/bo-ath.key'
}
sh "./acceptance-tests/runner/scripts/start-selenium.sh"
sh "./acceptance-tests/runner/scripts/start-bitbucket-server.sh"
}
docker.image('blueocean_build_env').inside("--net=container:blueo-selenium") {
withEnv(['[email protected]','GIT_COMMITTER_NAME=Hates','GIT_AUTHOR_NAME=Cake','[email protected]']) {
try {
stage('Sanity check dependencies') {
sh "node ./bin/checkdeps.js"
sh "node ./bin/checkshrinkwrap.js"
}
stage('Building JS Libraries') {
sh 'node -v && npm -v'
sh 'npm --prefix ./js-extensions run build'
}
stage('Building BlueOcean') {
try {
sh "mvn clean install -B -DcleanNode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dmaven.test.failure.ignore -s settings.xml -Dmaven.artifact.threads=30"
} catch(e) {
throw e;
}
junit '**/target/surefire-reports/TEST-*.xml'
junit '**/target/jest-reports/*.xml'
archive '*/target/code-coverage/**/*'
archive '*/target/*.hpi'
archive '*/target/jest-coverage/**/*'
}
stage('ATH - Jenkins 2.121.1') {
sh "cd acceptance-tests && ./run.sh -v=2.121.1 --no-selenium --settings='-s ${env.WORKSPACE}/settings.xml'"
junit 'acceptance-tests/target/surefire-reports/*.xml'
archive 'acceptance-tests/target/screenshots/**/*'
}
if (env.JOB_NAME =~ 'blueocean-weekly-ath') {
stage('ATH - Jenkins 2.73.2') {
sh "cd acceptance-tests && ./run.sh -v=2.73.2 --no-selenium --settings='-s ${env.WORKSPACE}/settings.xml'"
junit 'acceptance-tests/target/surefire-reports/*.xml'
}
stage('ATH - Jenkins 2.73.3') {
sh "cd acceptance-tests && ./run.sh -v=2.73.3 --no-selenium --settings='-s ${env.WORKSPACE}/settings.xml'"
junit 'acceptance-tests/target/surefire-reports/*.xml'
}
stage('ATH - Jenkins 2.107.2') {
sh "cd acceptance-tests && ./run.sh -v=2.107.2 --no-selenium --settings='-s ${env.WORKSPACE}/settings.xml'"
junit 'acceptance-tests/target/surefire-reports/*.xml'
}
stage('ATH - Jenkins 2.121.1') {
sh "cd acceptance-tests && ./run.sh -v=2.121.1 --no-selenium --settings='-s ${env.WORKSPACE}/settings.xml'"
junit 'acceptance-tests/target/surefire-reports/*.xml'
}
}
} catch(err) {
currentBuild.result = "FAILURE"
if (err.toString().contains('exit code 143')) {
currentBuild.result = "ABORTED"
}
} finally {
stage('Cleanup') {
sh "${env.WORKSPACE}/acceptance-tests/runner/scripts/stop-selenium.sh"
sh "${env.WORKSPACE}/acceptance-tests/runner/scripts/stop-bitbucket-server.sh"
sendhipchat()
deleteDir()
}
}
}
}
}
def sendhipchat() {
res = currentBuild.result
if(currentBuild.result == null) {
res = "SUCCESS"
}
message = "${env.JOB_NAME} #${env.BUILD_NUMBER}, status: ${res} (<a href='${env.RUN_DISPLAY_URL}'>Open</a>)"
color = null
if(currentBuild.result == "UNSTABLE") {
color = "YELLOW"
} else if(currentBuild.result == "SUCCESS" || currentBuild.result == null){
color = "GREEN"
} else if(currentBuild.result == "FAILURE") {
color = "RED"
} else if(currentBuild.result == "ABORTED") {
color = "GRAY"
}
if(color != null) {
hipchatSend message: message, color: color
}
}