-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
119 lines (104 loc) · 3.7 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
// branches requiring changes in XML from default develop branch
def XML_BRANCH = BRANCH in ["main", "tickets/DM-39576"] ? BRANCH : "develop"
def CRIO_BRANCH = BRANCH in ["main", "tickets/DM-42413", "tickets/DM-42443"] ? BRANCH : "develop"
stage('Cloning sources')
{
dir("ts_cRIOcpp") {
git branch: CRIO_BRANCH, url: 'https://github.com/lsst-ts/ts_cRIOcpp'
}
dir("ts_m1m3support") {
git branch: BRANCH, url: 'https://github.com/lsst-ts/ts_m1m3support'
}
}
stage('Building dev container')
{
M1M3sim = docker.build("m1m3sim:" + env.BRANCH_NAME.replace("/", "_"), "--target crio-develop --build-arg XML_BRANCH=$XML_BRANCH " + (params.noCache ? "--no-cache " : " ") + "$WORKSPACE/ts_m1m3support")
}
stage("Running tests")
{
withEnv(["SALUSER_HOME=" + SALUSER_HOME]) {
M1M3sim.inside("--entrypoint=''") {
if (params.clean) {
sh """
cd $WORKSPACE/ts_cRIOcpp
make clean
cd $WORKSPACE/ts_m1m3support
make clean
"""
}
sh """
source $SALUSER_HOME/.crio_setup.sh
cd $WORKSPACE/ts_cRIOcpp
make
cd $WORKSPACE/ts_m1m3support
make SIMULATOR=1
LSST_DDS_PARTITION_PREFIX=test make SIMULATOR=1 junit || true
"""
}
}
junit 'ts_m1m3support/tests/*.xml'
}
stage('Build documentation')
{
M1M3sim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
cd $WORKSPACE/ts_m1m3support
make doc
"""
}
}
stage('Running container')
{
withEnv(["SALUSER_HOME=" + SALUSER_HOME]){
M1M3sim.inside("--entrypoint=''") {
sh """
source $SALUSER_HOME/.crio_setup.sh
export LSST_DDS_PARTITION_PREFIX=test
cd $WORKSPACE/ts_m1m3support
./ts-M1M3supportd -c SettingFiles -f &
echo "Waiting for 15 seconds"
sleep 15
cd tests
./runSimulator.py
killall -9 ts-M1M3supportd
"""
}
}
}
if (BRANCH == "main" || 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-m1m3support --git-ref """ + BRANCH + """ --dir $WORKSPACE/ts_m1m3support/doc/html
"""
}
}
}
}
}