-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
119 lines (103 loc) · 3.49 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
115
116
117
118
119
#!/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
def SAME_CRIO_BRANCH = ["main"]
def XML_BRANCH = BRANCH in ["main"] ? BRANCH : "develop"
stage('Cloning sources')
{
dir("ts_cRIOcpp") {
git branch: (BRANCH in SAME_CRIO_BRANCH) ? BRANCH : "develop", url: 'https://github.com/lsst-ts/ts_cRIOcpp'
}
dir("ts_vms") {
checkout scm
}
}
stage('Building dev container')
{
VMSsim = docker.build("lsstts/vms_sim:" + env.BRANCH_NAME.replace("/", "_"), "--target crio-develop --build-arg XML_BRANCH=$XML_BRANCH " + (params.noCache ? "--no-cache " : " ") + "$WORKSPACE/ts_vms")
}
stage("Running tests")
{
withEnv(["SALUSER_HOME=" + SALUSER_HOME]) {
VMSsim.inside("--entrypoint=''") {
if (params.clean) {
sh """
cd $WORKSPACE/ts_cRIOcpp
make clean
cd $WORKSPACE/ts_vms
make clean
"""
}
sh """
source $SALUSER_HOME/.crio_setup.sh
cd $WORKSPACE/ts_cRIOcpp
make
cd $WORKSPACE/ts_vms
make SIMULATOR=1
LSST_DDS_PARTITION_PREFIX=test make junit || true
"""
}
}
}
stage('Build documentation')
{
VMSsim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
cd $WORKSPACE/ts_vms
make doc
"""
}
}
stage('Running container')
{
withEnv(["SALUSER_HOME=" + SALUSER_HOME]){
VMSsim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
export LSST_DDS_PARTITION_PREFIX=test
cd $WORKSPACE/ts_vms
./ts-VMSd -c SettingFiles M1M3 &
echo "Waiting for 30 seconds"
sleep 30
cd $SALUSER_HOME/repos
./ts_sal/test/MTVMS/cpp/src/sacpp_MTVMS_start_commander Default
sleep 30
killall ts-VMSd
"""
}
}
}
if (BRANCH == "master" || BRANCH == "develop")
{
stage('Publish documentation')
{
withCredentials([usernamePassword(credentialsId: 'lsst-io', usernameVariable: 'LTD_USERNAME', passwordVariable: 'LTD_PASSWORD')]) {
VMSsim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
ltd upload --product ts-vms --git-ref """ + BRANCH + """ --dir $WORKSPACE/ts_vms/doc/html
"""
}
}
}
}
}