3 // SPDX-FileCopyrightText: 2022 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 // SPDX-FileCopyrightText: 2024 Michael Jeanson <mjeanson@efficios.com>
6 // SPDX-License-Identifier: GPL-3.0-or-later
11 /* Global options for the pipeline */
14 buildDiscarder(logRotator(numToKeepStr: '5'))
15 timeout(time: 2, unit: 'HOURS')
16 disableConcurrentBuilds()
26 string(name: 'LIBURCU_GIT_URL', defaultValue: 'https://github.com/urcu/userspace-rcu', description: 'The http git repo to be cloned for the liburcu project')
27 string(name: 'LIBURCU_GIT_BRANCH', defaultValue: '{{ urcu_version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
28 string(name: 'LTTNG_MODULES_GIT_URL', defaultValue: 'https://github.com/lttng/lttng-modules', description: 'The http git repo to be cloned for the lttng-modules project')
29 string(name: 'LTTNG_MODULES_GIT_BRANCH', defaultValue: '{{ version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
30 string(name: 'LTTNG_UST_GIT_URL', defaultValue: 'https://github.com/lttng/lttng-ust', description: 'The http git repo to be cloned for the lttng-ust project')
31 string(name: 'LTTNG_UST_GIT_BRANCH', defaultValue: '{{ version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
32 string(name: 'LTTNG_TOOLS_GIT_URL', defaultValue: 'https://github.com/lttng/lttng-tools', description: 'The http git repo to be cloned for the lttng-tools project')
33 string(name: 'LTTNG_TOOLS_GIT_BRANCH', defaultValue: '{{ version }}', description: 'The {{ version }} equivalent branch to be checkout-ed')
36 /* Default environment for the pipeline */
41 JAVA_HOME = '/usr/lib/jvm/default-java'
42 CLASSPATH = '/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar'
47 * i386 artifacts cannot be reused because we need to ensure that the
48 * lttng-ust used is the same for the amd64 and i386 and that for now we do
49 * not have this guarantee since we used 2 different jobs.
51 stage('Checkout all sources') {
52 agent { label 'deb12-amd64' }
57 dir("src/userspace-rcu") {
58 checkout([$class: 'GitSCM', branches: [[name: "${params.LIBURCU_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LIBURCU_GIT_URL}"]]])
61 dir("src/lttng-modules") {
62 checkout([$class: 'GitSCM', branches: [[name: "${params.LTTNG_MODULES_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LTTNG_MODULES_GIT_URL}"]]])
65 dir("src/lttng-ust") {
66 checkout([$class: 'GitSCM', branches: [[name: "${params.LTTNG_UST_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LTTNG_UST_GIT_URL}"]]])
69 dir("src/lttng-tools") {
70 checkout([$class: 'GitSCM', branches: [[name: "${params.LTTNG_TOOLS_GIT_BRANCH}"]], extensions: [], gitTool: 'Default', userRemoteConfigs: [[url: "${params.LTTNG_TOOLS_GIT_URL}"]]])
73 stash name: 'dep-sources', includes: 'src/userspace-rcu/**,src/lttng-ust/**'
74 stash name: 'modules-sources', includes: 'src/lttng-modules/**'
75 stash name: 'tools-sources', includes: 'src/lttng-tools/**,'
79 stage('Parallel build of i386 and amd64 artifacts') {
80 /* Build the i386 and amd64 artifacts in parallel */
82 stage('Build amd64 artifacts') {
83 agent { label 'deb12-amd64' }
86 BASEDIR_64 = "$WORKSPACE/deps-64"
87 BASEDIR_BUILD_64 = "$BASEDIR_64/build"
88 INCLUDE_DIR_64 = "$BASEDIR_BUILD_64/include"
90 CPPFLAGS = "-I$INCLUDE_DIR_64"
91 LDFLAGS = "-L$BASEDIR_BUILD_64/lib"
92 PKG_CONFIG_PATH = "$BASEDIR_BUILD_64/lib/pkgconfig"
93 LD_LIBRARY_PATH = "$BASEDIR_BUILD_64/lib:$LD_LIBRARY_PATH"
94 PATH = "$PATH:$BASEDIR_64/bin"
98 stage('Unstash sources') {
102 unstash name: 'dep-sources'
106 stage('Build amd64 liburcu') {
108 /* Prevent non existent include dir warnings */
109 sh 'mkdir -p $INCLUDE_DIR_64'
111 dir("src/userspace-rcu") {
113 sh './configure --prefix="$PREFIX"'
114 sh 'make -j"$(nproc)" V=1'
115 sh 'make install DESTDIR="$WORKSPACE"'
116 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
117 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
120 /* Move the artifacts of the recently built project to the deps
121 * directory and remove the "build" directory to prevent `make install`
122 * shenanigans for lttng-ust 2.12 */
123 sh 'cp -rv build $BASEDIR_64/'
128 stage('Build amd64 lttng-ust') {
130 dir("src/lttng-ust") {
132 sh './configure --prefix="$PREFIX" --enable-java-agent-all --enable-jni-interface --enable-python-agent'
133 sh 'make -j"$(nproc)" V=1'
134 sh 'make install DESTDIR="$WORKSPACE"'
136 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
137 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
140 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
141 sh 'cp -rv build $BASEDIR_64/'
146 stage('Stash amd64 artifacts') {
148 stash name: "amd64-deps-lttng-tools", includes: 'deps-64/**'
155 cleanWs cleanWhenFailure: false
158 } /* stage('Build amd64 artifacts') */
160 stage('Build i386 artifacts') {
161 agent { label 'deb12-i386' }
164 BASEDIR_32 = "$WORKSPACE/deps-32"
165 BASEDIR_BUILD_32 = "$BASEDIR_32/build"
166 INCLUDE_DIR_32 = "$BASEDIR_BUILD_32/include"
168 CPPFLAGS = "-I$INCLUDE_DIR_32"
169 LDFLAGS = "-L$BASEDIR_BUILD_32/lib"
170 PKG_CONFIG_PATH = "$BASEDIR_BUILD_32/lib/pkgconfig"
171 LD_LIBRARY_PATH = "$BASEDIR_BUILD_32/lib"
172 PATH = "$PATH:$BASEDIR_32/bin"
176 stage('Unstash sources and artifacts') {
180 /* Fetch the babeltrace artifacts */
181 copyArtifacts projectName: "babeltrace_{{ babelversion }}_portbuild/platform=deb12-i386,conf=std,build=std", selector: lastCompleted(), filter: 'build/**', target: 'deps-32', fingerprintArtifacts: false
183 unstash name: 'dep-sources'
184 unstash name: 'tools-sources'
188 stage('Build i386 liburcu') {
191 /* Prevent non existent include dir warnings */
192 sh 'mkdir -p $INCLUDE_DIR_32'
194 dir("src/userspace-rcu") {
196 sh './configure --prefix="$PREFIX"'
197 sh 'make -j"$(nproc)" V=1'
198 sh 'make install DESTDIR="$WORKSPACE"'
200 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
201 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
204 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
205 sh 'cp -rv build $BASEDIR_32/'
210 stage('Build i386 lttng-ust') {
212 dir("src/lttng-ust") {
214 sh './configure --prefix="$PREFIX"'
216 sh 'make install DESTDIR="$WORKSPACE"'
217 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
218 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
221 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
222 sh 'cp -rv build $BASEDIR_32/'
227 stage('Build i386 lttng-tools') {
229 dir("src/lttng-tools") {
231 sh './configure --prefix="$PREFIX"'
233 sh 'make install DESTDIR="$WORKSPACE"'
234 sh 'find "$WORKSPACE/build/bin" -type f -perm -0500 -exec chrpath --delete {} \\;'
235 sh 'find "$WORKSPACE/build/lib" -name "*.so" -exec chrpath --delete {} \\;'
236 sh 'find "$WORKSPACE/build/lib" -name "*.la" -exec rm -vf {} \\;'
239 /* Move the artifacts of the recently built project to the deps directory and remove the "build" directory to prevent `make install` shenanigans for lttng-ust 2.12 */
240 sh 'cp -rv build $BASEDIR_32/'
245 stage('Stash i386 artifacts') {
247 stash name: "i386-deps-lttng-tools", includes: 'deps-32/**'
249 {% if version != 'stable-2.12' %}
250 /* Save the i386 ld_preloaded libraries for sessiond pausing */
251 stash name: "i386-deps-sessiond-notification-pause-lib", includes: 'src/lttng-tools/tests/regression/tools/notification/.libs/libpause_sessiond.so'
259 cleanWs cleanWhenFailure: false
262 } /* stage('Build i386 artifacts') */
264 } /* stage('Parallel build of all artifacts') */
266 stage('Testing on rootnodes') {
268 {% for test_type in ["64bit-canary", "32bit-sessiond", "32bit-relayd", "32bit-cli" ] %}
269 stage('Testing {{ test_type }}') {
270 {% if version == 'stable-2.12' %}
271 agent { label 'deb12-amd64-rootnode-linux5' }
273 agent { label 'deb12-amd64-rootnode' }
277 BASEDIR_32 = "$WORKSPACE/deps-32"
278 BASEDIR_BUILD_32 = "$BASEDIR_32/build"
279 INCLUDE_DIR_32 = "$BASEDIR_BUILD_32/include"
281 BASEDIR_64 = "$WORKSPACE/deps-64"
282 BASEDIR_BUILD_64 = "$BASEDIR_64/build"
283 INCLUDE_DIR_64 = "$BASEDIR_BUILD_64/include"
285 CPPFLAGS = "-I$BASEDIR_BUILD_64/include"
286 LDFLAGS = "-L$BASEDIR_BUILD_64/lib"
287 PKG_CONFIG_PATH = "$BASEDIR_BUILD_64/lib/pkgconfig"
288 LD_LIBRARY_PATH = "$BASEDIR_BUILD_64/lib:$BASEDIR_BUILD_32/lib"
289 PATH = "$PATH:$BASEDIR_BUILD_64/bin"
292 * Disable the TAP autotime feature, it uses stdbuf which doesn't work in a
293 * mixed 32/64 environment.
295 LTTNG_TESTS_TAP_AUTOTIME = 0
297 BABELTRACE_PLUGIN_PATH = "$BASEDIR_BUILD_64/lib/babeltrace2/plugins/"
298 LIBBABELTRACE2_PLUGIN_PROVIDER_DIR = "$BASEDIR_BUILD_64/lib/babeltrace2/plugin-providers/"
300 DEPS_JAVA = "$WORKSPACE/deps-64/build/share/java"
301 CLASSPATH = "$DEPS_JAVA/lttng-ust-agent-all.jar:/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar"
305 script: 'python3 -c \'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))\''
309 * Most build configs require access to the babeltrace 2 python bindings.
310 * This also makes the lttngust python agent available for `agents` builds.
312 PYTHONPATH = "$BASEDIR_BUILD_64/lib/python$P3_VERSION/site-packages"
314 LTTNG_CONSUMERD32_BIN = "$BASEDIR_BUILD_32/lib/lttng/libexec/lttng-consumerd"
315 LTTNG_CONSUMERD32_LIBDIR = "$BASEDIR_BUILD_32/lib"
316 LTTNG_CONSUMERD64_BIN = "$BASEDIR_BUILD_64/lib/lttng/libexec/lttng-consumerd"
317 LTTNG_CONSUMERD64_LIBDIR = "$BASEDIR_BUILD_64/lib/"
321 stage('Unstash sources and artifacts') {
325 /* Fetch the babeltrace artifacts */
326 copyArtifacts projectName: "babeltrace_{{ babelversion }}_linuxbuild/platform=deb12-amd64,conf=std,build=std", selector: lastCompleted(), filter: 'build/**', target: 'deps-64', fingerprintArtifacts: false
328 unstash name: 'modules-sources'
329 unstash name: 'tools-sources'
330 unstash name: "i386-deps-lttng-tools"
331 unstash name: "amd64-deps-lttng-tools"
333 {% if version != 'stable-2.12' %}
334 dir('testing-overlay/sessiond') {
335 /* Save the i386 LD_PRELOAD libraries for sessiond pausing */
336 unstash name: "i386-deps-sessiond-notification-pause-lib"
340 /* Stable 2.12 and 2.13 still look for "babeltrace" */
341 sh 'ln -s "$BASEDIR_BUILD_64/bin/babeltrace2" "$BASEDIR_BUILD_64/bin/babeltrace"'
345 stage('Build and install lttng-modules for the current kernel') {
347 dir("src/lttng-modules") {
348 sh 'make -j"$(nproc)" V=1'
349 sh 'make modules_install'
355 stage('Build amd64 lttng-tools') {
357 /* Bootstrap and configure lttng-tools */
358 dir("src/lttng-tools") {
360 sh './configure --prefix="$PREFIX" --enable-test-java-agent-all --enable-test-python3-agent'
363 // Deativate health test, simply because there is little value
364 // for this integration testing and because the ld_preloaded
365 // object is for both lttng-sessiond/consumer leading to
366 // difficult ld_preloading Deactivate clock plugin test since
367 // the app must load the correct bitness so and the sessiond its
368 // bitness so, this is simply not feasible from outside the
369 // script. There is little value for this test in this testing
371 dir("src/lttng-tools/tests/regression") {
372 sh 'sed -i "#tools/health/test_thread_ok#d" Makefile.am'
373 sh 'sed -i "#ust/clock-override/test_clock_override#d" Makefile.am'
376 /* Build lttng-tools */
377 dir("src/lttng-tools") {
378 sh 'make -j"$(nproc)" V=1'
383 stage('Run lttng-tools testsuite') {
385 timeout(time: 15, unit: 'MINUTES', activity: true)
389 {% if test_type == '64bit-canary' %}
390 /* Nothing to do for 64bit-canary */
392 {% elif test_type == '32bit-sessiond' %}
394 /* Replace the lttng-sessiond binary with the 32-bit version */
395 dir("src/lttng-tools/src/bin/lttng-sessiond") {
396 sh 'rm -f lttng-sessiond'
397 sh 'ln -s "$BASEDIR_32/bin/lttng-sessiond" lttng-sessiond'
400 {% if version != 'stable-2.12' %}
401 sh 'cp -rv "testing-overlay/sessiond/"* ./'
404 {% elif test_type == '32bit-relayd' %}
406 /* Replace the lttng-relayd binary with the 32-bit version */
407 dir("src/lttng-tools/src/bin/lttng-relayd") {
408 sh 'rm -f lttng-relayd'
409 sh 'ln -s "$BASEDIR_32/bin/lttng-relayd" lttng-relayd'
412 {% elif test_type == '32bit-cli' %}
414 /* Replace the lttng cli binary with the 32-bit version */
415 dir("src/lttng-tools/src/bin/lttng") {
417 sh 'ln -s "$BASEDIR_32/bin/lttng" lttng'
421 {% include 'error: invalid test_type' %}
424 /* Run the test suite */
425 dir("src/lttng-tools/tests") {
427 * This will mark the job as FAILED if the test suite is not
428 * successful but will continue the execution of the stages.
431 sh 'make --keep-going check'
435 } /* stage('Build amd64 artifacts') */
440 dir("src/lttng-tools/tests") {
441 /* Gather the TAP logs */
443 mkdir -p "$WORKSPACE/tap/{{ test_type }}"
444 rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' ./ "$WORKSPACE/tap/{{ test_type }}"
447 /* Gather the test suites top-level log which includes all tests failures */
449 mkdir -p "$WORKSPACE/log/{{ test_type }}"
450 rsync -a --include 'test-suite.log' --include '*/' --exclude='*' ./ "$WORKSPACE/log/{{ test_type }}"
454 step([$class: 'TapPublisher', testResults: 'tap/**/*.log', verbose: true, failIfNoResults: true, failedTestsMarkBuildAsFailure: true, planRequired: true])
455 archiveArtifacts artifacts: 'tap/**,log/**', fingerprint: false
457 recordIssues skipBlames: true, tools: [gcc(id: "{{ test_type }}")]
461 cleanWs cleanWhenFailure: false
467 } /* stage('Testing on rootnodes') */