-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
254 lines (237 loc) · 8.32 KB
/
.gitlab-ci.yml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
variables:
# CI parameters and options
GIT_SUBMODULE_STRATEGY: recursive # clone submodules
GIT_LFS_SKIP_SMUDGE: "1" # ignore lfs (some problems with vadere submodule)
CROWNET_HOME: '${CI_PROJECT_DIR}' # all files relative to this
DOCKER_CLIENT_TIMEOUT: '300' # timeout for docker client (needs to be higher than default)
# the image tag env VARIABLES are specified in ${CI_PROJECT_DIR}/config/CONTAINER_VERSION.config
# the container registry env VARIABLES are specified in ${CI_PROJECT_DIR}/config/CONTAINER_REGISTRY.config
# Paths and aliases
ANALYZER_M: '${CI_PROJECT_DIR}/analysis/crownetutils'
FLOWCONTROL_M: '${CI_PROJECT_DIR}/flowcontrol'
VADERE_PATH: '${CI_PROJECT_DIR}/vadere'
stages:
- build
- test
- uq-test
- simulation-campaign
- deploy
# TODO: fix the caching. Currently, old cached versions of (flowcontrol, crownetutils, suq-controller) are used instead of the updated versions despite "omnetpp exec make analysis-clean"
# cache:
# key: ${CI_COMMIT_REF_SLUG}
# paths:
# - ./out/crownet_user
# Build all dependencies of the crownet project (default: release mode)
# This is the base for running simulation campaings on a dedicated
# gitlab runner with more cores and memmory. Use latest version of containers
build-for-sim:
stage: build
tags:
- crownet-sim
variables:
ARTERY_M: '${CI_PROJECT_DIR}/artery'
INET_M: '${CI_PROJECT_DIR}/inet4'
MOBILENETWORK_M: '${CI_PROJECT_DIR}/simu5g'
CROWNET_M: '${CI_PROJECT_DIR}/crownet'
VEINS_M: '${CI_PROJECT_DIR}/veins'
VEINS_INET_M: '${CI_PROJECT_DIR}/veins/subprojects/veins_inet'
MODE: 'release'
script:
# ## update required docker images
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- "source setup -i"
- docker pull ${CROWNET_IMAGE_BASE}/omnetpp:${CROWNET_OPP_CONT_TAG}
- docker pull ${CROWNET_IMAGE_BASE}/sumo:${CROWNET_SUMO_CONT_TAG}
- docker pull ${CROWNET_IMAGE_BASE}/vadere:${CROWNET_VADERE_CONT_TAG}
- docker pull ${CROWNET_IMAGE_BASE}/flowcontrol:${CROWNET_CONTROL_CONT_TAG}
# ## build all models
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make makefiles"
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make MODE=${MODE}"
# ## export inet version
- "cd ${INET_M}"
- "export INET_VERSION=$(./_scripts/get_version)"
# inet> cleanup not needed directories
- rm -rf doc examples showcases tutorials
# ## cleanup not needed directories in veins
- "cd ${VEINS_M}"
- rm -rf doc examples subprojects/veins_catch subprojects/veins_inet3 subprojects/veins_testsims
# ## global cleanup
- "cd ${CROWNET_HOME}"
- "find . -name \"*.o\" -type f -delete"
- "cd ${INET_M}"
# inet> only delete inet sources for artefacts. We may need the other ones.
- "find . -name \"*.cc\" -type f -delete"
# artery> only use keep libs and h files.
- "cd ${ARTERY_M}"
- rm -rf scenarios cmake
- "find . -name \"*.o\" -type f -delete"
- "find . -name \"*.cc\" -type f -delete"
- "find build/ -type f -not -path '*.so' -delete"
- "find extern/vanetza/build -type f -not -path '*.so' -delete"
artifacts:
paths:
- ${CROWNET_HOME}/scripts
- ${CROWNET_HOME}/out
- ${CROWNET_HOME}/simu5g
- ${CROWNET_HOME}/inet4
- ${CROWNET_HOME}/crownet
- ${CROWNET_HOME}/veins
- ${CROWNET_HOME}/artery
expire_in: 1 weeks
build-analysis-tools:
stage: build
tags:
- crownet-sim
script:
# ## update required docker images
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- "source setup -i"
- docker pull $CI_REGISTRY/rover/crownet/omnetpp
# ## build python project and setup user enviroment
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make analysis-clean"
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make analysis-build"
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make out/crownet_user"
artifacts:
paths:
- ${CROWNET_HOME}/out
# run the unit tests
gtests:
stage: test
tags:
- crownet-sim
script:
- "source setup -i"
- "cd ${CROWNET_HOME}/crownet"
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make test"
artifacts:
when: always
paths:
- ${CROWNET_HOME}/crownet/tests/fingerprint
expire_in: 8 weeks
# run the fingerprint tests
fingerprints:
stage: test
tags:
- crownet-sim
variables:
ANALYZER_M: '${CI_PROJECT_DIR}/analysis/crownetutils/'
script:
- "source setup -i"
- "source ./out/crownet_user/bin/activate"
- "cd ${CROWNET_HOME}/crownet/tests/fingerprint"
- "export DOCKER_CLIENT_TIMEOUT=${DOCKER_CLIENT_TIMEOUT}"
- "export COMPOSE_HTTP_TIMEOUT=${DOCKER_CLIENT_TIMEOUT}"
- "./fingerprints"
artifacts:
when: always
paths:
- "${CROWNET_HOME}/crownet/tests/fingerprint/results"
- "${CROWNET_HOME}/crownet/tests/fingerprint/*csv*"
- "${CROWNET_HOME}/crownet/tests/fingerprint/*.csv"
- "${CROWNET_HOME}/crownet/tests/fingerprint/*.out"
expire_in: 8 weeks
# run the fingerprint tests
fingerprints_crownet:
stage: test
tags:
- crownet-sim
variables:
ANALYZER_M: '${CI_PROJECT_DIR}/analysis/crownetutils/'
script:
- "source setup -i"
- "source ./out/crownet_user/bin/activate"
- "cd ${CROWNET_HOME}/crownet/tests/fingerprint"
- "export DOCKER_CLIENT_TIMEOUT=${DOCKER_CLIENT_TIMEOUT}"
- "export COMPOSE_HTTP_TIMEOUT=${DOCKER_CLIENT_TIMEOUT}"
- "./fingerprints_crownet"
artifacts:
when: always
paths:
- "${CROWNET_HOME}/crownet/tests/fingerprint/yml_out.d"
- "${CROWNET_HOME}/crownet/tests/fingerprint/hash.d"
- "${CROWNET_HOME}/crownet/tests/fingerprint/*.yml"
expire_in: 8 weeks
# run the opp tests
opp-tests:
stage: test
tags:
- crownet-sim
script:
- "source setup -i"
- "cd ${CROWNET_HOME}/crownet"
- "${CI_PROJECT_DIR}/scripts/omnetpp_rnd ${CROWNET_OPP_CONT_TAG} exec make opp-test"
artifacts:
when: always
paths:
- ${CROWNET_HOME}/crownet/tests/omnetpp/work
expire_in: 8 weeks
# run uq simulation studies
uq-unit-tests:
stage: uq-test
tags:
- crownet-sim
variables:
ANALYSIS_UQ_M: '${CROWNET_HOME}/analysis/uq'
script:
- "source setup -i"
- "source ./out/crownet_user/bin/activate"
- "cd ${CROWNET_HOME}/analysis/uq"
- "python3 -m unittest discover -v"
uq-integration-tests:
stage: uq-test
tags:
- crownet-sim
variables:
ANALYSIS_UQ_M: '${CROWNET_HOME}/analysis/uq'
script:
- "source setup -i"
- "source ./out/crownet_user/bin/activate"
- "cd ${CROWNET_HOME}/analysis/uq/simulation_studies"
- "python3 run_integration_tests.py"
artifacts:
when: always
paths:
- ${CROWNET_HOME}/analysis/uq/simulation_studies/unittest_sim_output
exclude:
- ${CROWNET_HOME}/analysis/uq/simulation_studies/unittest_sim_output/**/simulation_runs/**
- ${CROWNET_HOME}/analysis/uq/simulation_studies/unittest_sim_output/**/simulation_runs/**/*
expire_in: 4 weeks
# run given simulation-campaign
simulation-campaign:
stage: simulation-campaign
tags:
- crownet-sim
rules:
- if: '$SIM_TRIGGER'
script:
- "source setup -i"
- "/bin/bash ${CROWNET_HOME}/$SIM_SCRIPT"
- "echo ${CI_COMMIT_SHA} > ${CROWNET_HOME}/$SIM_SCRIPT-results/commit-hash"
- "echo ${CI_PIPELINE_IID} > ${CROWNET_HOME}/$SIM_SCRIPT-results/pipeline-id"
- "cat /proc/cpuinfo > > ${CROWNET_HOME}/$SIM_SCRIPT-results/cpuinfo"
artifacts:
paths:
- ${CROWNET_HOME}/$SIM_SCRIPT
- ${CROWNET_HOME}/$SIM_SCRIPT-results
- ${CROWNET_HOME}/scripts
- ${CROWNET_HOME}/simu5g/src
- ${CROWNET_HOME}/inet4/src
- ${CROWNET_HOME}/crownet
- ${CROWNET_HOME}/veins/src
- ${CROWNET_HOME}/veins/subprojects/veins_inet/src
expire_in: 4 weeks
build_images:
stage: deploy
when: manual
tags:
- crownet-sim
script:
- eval $(ssh-agent -s)
- "ls -a /home/gitlab-runner/.ssh/"
- "ssh-add /home/gitlab-runner/.ssh/crownet_CI_docker"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- "cd ${CROWNET_HOME}"
- "docker system prune -a -f"
- "source setup -i -u"
- "bash -x ${CROWNET_HOME}/scripts/build_all_images -p -q"
- "bash -x ${CROWNET_HOME}/scripts/pull_and_push_images -s ${CROWNET_IMAGE_BASE} -t ghcr.io/rover-hm -p -k"