forked from ToyotaResearchInstitute/task_behavior_engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
62 lines (58 loc) · 2.75 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
// define a tag according to the Docker tag rules https://docs.docker.com/engine/reference/commandline/tag/
// the hash sign (#) is problematic when using it in bash, instead of working around this problem, just replace all
// punctuation with dash (-)
def projectShortName = "${env.JOB_NAME}" - "/${env.BRANCH_NAME}"
def githubOrg = "ToyotaResearchInstitute"
def dockerTag = "${env.BRANCH_NAME}-${env.BUILD_NUMBER}".toLowerCase().replaceAll("\\p{Punct}", "-").replaceAll("\\p{Space}", "-")
def buildLink = "<${env.BUILD_URL}|${env.JOB_NAME} ${env.BUILD_NUMBER}>"
node {
timestamps {
ansiColor('xterm') {
try {
properties properties: [
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '50']],
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: "https://github.com/$githubOrg/$projectShortName"],
pipelineTriggers([pollSCM('H/2 * * * *')])
]
slackSend color: 'warning', message: "build $buildLink started"
stage('checkout') {
withEnv(["PATH+WSTOOL=${tool 'wstool'}/bin"]) {
sh """
rm -fr catkin_ws
"""
dir('catkin_ws/src'){
sh """
wstool init .
"""
dir('task_behavior_engine'){
checkout scm
}
}
}
}
stage('build') {
withEnv(["PATH+CATKIN=${tool 'catkin'}/bin"]) {
sh """
. /opt/ros/indigo/setup.sh
catkin_make install -C catkin_ws
"""
slackSend color: 'good', message: "stage 'build' of build $buildLink passed"
}
}
stage('test') {
withEnv(["PATH+CATKIN=${tool 'catkin'}/bin"]) {
sh """
. catkin_ws/install/setup.sh
catkin_make run_tests -C catkin_ws
catkin_test_results
"""
slackSend color: '#0000FF', message: "stage 'test' of build $buildLink passed"
}
}
} catch(Exception e) {
slackSend color: 'danger', message: "build $buildLink failed"
error "error building, ${e.getMessage()}"
}
}
}
}