-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
88 lines (76 loc) · 2.44 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
#!/usr/bin/env groovy
properties(
[
buildDiscarder
(logRotator (
artifactDaysToKeepStr: '',
artifactNumToKeepStr: '',
daysToKeepStr: '14',
numToKeepStr: ''
) ),
disableConcurrentBuilds(),
parameters
( [
booleanParam(defaultValue: false, description: 'Adds --no-cache to Docker build command', name: 'noCache'),
booleanParam(defaultValue: false, description: 'Calls make clean before building the code', name: 'clean')
] )
]
)
node {
def SALUSER_HOME = "/home/saluser"
def BRANCH = (env.CHANGE_BRANCH != null) ? env.CHANGE_BRANCH : env.BRANCH_NAME
stage('Cloning sources')
{
dir("ts_cRIOcpp") {
checkout scm
}
}
stage('Building dev container')
{
M1M3sim = docker.build("lsstts/criocpp:" + env.BRANCH_NAME.replace("/", "_"), (params.noCache ? "--no-cache " : " ") + "ts_cRIOcpp")
}
stage("Running tests")
{
withEnv(["SALUSER_HOME=" + SALUSER_HOME]) {
M1M3sim.inside("--entrypoint=''") {
if (params.clean) {
sh """
cd $WORKSPACE/ts_cRIOcpp
make clean
"""
}
sh """
source $SALUSER_HOME/.crio_setup.sh
cd $WORKSPACE/ts_cRIOcpp
make
make junit
"""
}
}
junit 'ts_cRIOcpp/tests/*.xml'
}
stage('Build documentation')
{
M1M3sim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
cd $WORKSPACE/ts_cRIOcpp
make doc
"""
}
}
if (BRANCH == "master" || BRANCH == "develop")
{
stage('Publish documentation')
{
withCredentials([usernamePassword(credentialsId: 'lsst-io', usernameVariable: 'LTD_USERNAME', passwordVariable: 'LTD_PASSWORD')]) {
M1M3sim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
ltd upload --product ts-criocpp --git-ref """ + BRANCH + """ --dir $WORKSPACE/ts_cRIOcpp/doc/html
"""
}
}
}
}
}