forked from eclipse/xtext-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
70 lines (61 loc) · 1.64 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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr:'15'))
}
tools {
maven 'M3'
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Build Xtext BOM') {
steps {
dir('.m2/repository/org/eclipse/xtext') { deleteDir() }
dir('.m2/repository/org/eclipse/xtend') { deleteDir() }
sh './1-install-bom.sh'
}
}
stage('Gradle Build') {
steps {
sh './2-gradle-build.sh'
step([$class: 'JUnitResultArchiver', testResults: '**/build/test-results/test/*.xml'])
}
}
stage('Maven Build') {
steps {
sh './3-maven-build.sh'
}
}
}
post {
success {
archiveArtifacts artifacts: 'build/**'
}
changed {
script {
def envName = ''
if (env.JENKINS_URL.contains('ci.eclipse.org/xtext')) {
envName = ' (JIPP)'
} else if (env.JENKINS_URL.contains('jenkins.eclipse.org/xtext')) {
envName = ' (CBI)'
} else if (env.JENKINS_URL.contains('typefox.io')) {
envName = ' (TF)'
}
def curResult = currentBuild.currentResult
def color = '#00FF00'
if (curResult == 'SUCCESS' && currentBuild.previousBuild != null) {
curResult = 'FIXED'
} else if (curResult == 'UNSTABLE') {
color = '#FFFF00'
} else if (curResult == 'FAILURE') {
color = '#FF0000'
}
slackSend message: "${curResult}: <${env.BUILD_URL}|${env.JOB_NAME}#${env.BUILD_NUMBER}${envName}>", botUser: true, channel: 'xtext-builds', color: "${color}"
}
}
}
}