forked from MetaBorgCube/metaborg-calc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JenkinsFile
66 lines (53 loc) · 1.48 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
properties([
pipelineTriggers([
upstream(
threshold: hudson.model.Result.SUCCESS,
upstreamProjects: '/metaborg/spoofax-releng/master' // build this project after Spoofax-master is built
)
]),
buildDiscarder(logRotator(artifactNumToKeepStr: '3')),
disableConcurrentBuilds() //disableds parallel builds
])
node{
try{
notifyBuild('Started')
stage('Checkout') {
checkout scm
sh "git clean -fXd"
}
stage('Build and Test') {
withMaven(
//mavenLocalRepo: "${env.JENKINS_HOME}/m2repos/${env.EXECUTOR_NUMBER}", //http://yellowgrass.org/issue/SpoofaxWithCore/173
mavenLocalRepo: ".repository",
mavenOpts: '-Xmx1G -Xms1G -Xss16m'
){
sh 'mvn -B -U clean verify -DforceContextQualifier=\$(date +%Y%m%d%H%M)'
}
}
stage('Archive') {
archiveArtifacts(
artifacts: 'calc.eclipse.site/target/site/',
excludes: null,
onlyIfSuccessful: true
)
}
stage('Cleanup') {
sh "git clean -fXd"
}
notifyBuild('Succeeded')
} catch (e) {
notifyBuild('Failed')
throw e
}
}
def notifyBuild(String buildStatus) {
def message = """${buildStatus}: ${env.JOB_NAME} [${env.BUILD_NUMBER}] ${env.BUILD_URL}"""
if (buildStatus == 'Succeeded') {
color = 'good'
} else if (buildStatus == 'Failed') {
color = 'danger'
} else {
color = '#4183C4' // Slack blue
}
slackSend (color: color, message: message, channel: '#some-slack-channel')
}