From: Kienan Stewart Date: Tue, 7 Jan 2025 19:13:47 +0000 (-0500) Subject: jjb: Add libsk pipeline X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4e87f7aba62c877546c37ee79b4dc067cc4ec68e;p=lttng-ci.git jjb: Add libsk pipeline Change-Id: Id50263d1cd32723acd9a70ee8bf428e5ef4a7bc5 Signed-off-by: Kienan Stewart --- diff --git a/jobs/libsk.yaml b/jobs/libsk.yaml new file mode 100644 index 0000000..885fd1e --- /dev/null +++ b/jobs/libsk.yaml @@ -0,0 +1,53 @@ +--- + +## Defaults +- defaults: + name: libsk + concurrent: true + description: | +

Job is managed by Jenkins Job Builder

+ project-type: pipeline + publishers: + - workspace-cleanup + dsl: !include-jinja2: pipelines/libsk/pipeline.groovy + sandbox: true + wrappers: + - workspace-cleanup + - timestamps + - ansicolor + - inject: {} + # Job template variables + job_prefix: '' + buildtypes: + - linuxbuild + cctype: gcc + ccs: + - gcc + versions: + - master + builds: !!python/tuple [std] + confs: !!python/tuple [std] + platforms: !!python/tuple [deb12-amd64, deb12-i386, deb12-arm64, deb12-armhf, deb12-ppc64el, deb13-riscv64, yocto40-ppc64, yocto40-powerpc] + libsk_git_url: ssh://git@git.internal.efficios.com/odion/libsk.git + filter: '' + email_to: '' + +- job-template: + name: "{job_prefix}libsk_{versions}_{buildtypes}_{cctype}" + defaults: libsk + +- view-template: + name: 'libsk' + view-type: list + regex: 'libsk[-_].*' + +- project: + name: libsk + email_to: 'odion@efficios.com' + jobs: + - '{job_prefix}libsk_{versions}_{buildtypes}_{cctype}': {} + +- project: + name: libsk-views + views: + - libsk diff --git a/pipelines/libsk/pipeline.groovy b/pipelines/libsk/pipeline.groovy new file mode 100644 index 0000000..ae08f1b --- /dev/null +++ b/pipelines/libsk/pipeline.groovy @@ -0,0 +1,192 @@ +#!groovy +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: 2025 Kienan Stewart + +pipeline { + agent none + + options { + ansiColor('xterm') + buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '2')) + skipDefaultCheckout() + preserveStashes() + timestamps() + } + + parameters { + string(name: 'email_to', defaultValue: '{{email_to}}', + description: 'Email(s) to notify on build completion') + string(name: 'LIBSK_GIT_URL', defaultValue: "{{libsk_git_url}}", + description: "Git URL to clone from") + string(name: 'LIBSK_GIT_BRANCH', defaultValue: "{{versions}}", + description: "Git branch to checkout") + booleanParam(name: 'LIBSK_TESTS_SKIP_TORTURE', defaultValue: true, + description: 'Skip torture tests') + booleanParam(name: 'LIBSK_TESTS_SKIP_REGRESSION', defaultValue: false, + description: 'Skip regression tests') + } + + triggers { + pollSCM('@hourly') + } + + stages { + stage('Checkout') { + agent { + label 'deb12-amd64' + } + + steps { + dir('src/libsk') { + checkout([$class: 'GitSCM', branches: [[name: "${params.LIBSK_GIT_BRANCH}"]], userRemoteConfigs: [[url: "${params.LIBSK_GIT_URL}", credentialsId: 'a6e08541-e7fd-4da2-b58a-b87ee37736ef']]]) + + } + stash name: 'libsk-source', includes: 'src/libsk/**' + } + } + + stage('matrix') { + matrix { + axes { + axis { + name 'platform' + values {{platforms|to_groovy(skip_list_wrap=true)}} + } + axis { + name 'conf' + values {{confs|to_groovy(skip_list_wrap=true)}} + } + axis { + name 'build' + values {{builds|to_groovy(skip_list_wrap=true)}} + } + axis { + name 'cc' + values {{ccs|to_groovy(skip_list_wrap=true)}} + } + } + + {% if filter != '' %} + when { + beforeAgent true + expression { + {{filter}} + } + } + {% endif %} + + agent { + label platform + } + + stages { + stage('Pre-build') { + steps { + cleanWs() + sh('env') + } + } + + stage('Configure') { + steps { + unstash('libsk-source') + sh("mkdir -p \$WORKSPACE/platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/{build,log}") + dir('src/libsk') { + sh('./bootstrap') + sh("./configure --prefix='/build'") + } + } + } + + stage('Build') { + steps { + dir('src/libsk') { + sh('make -j$(nproc)') + } + } + } + + stage('Install') { + steps { + dir('src/libsk') { + sh("DESTDIR=\"\$WORKSPACE/platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/\" make install") + } + + // Clean-up rpaths and .la files + sh("find \$WORKSPACE/platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/build/ -type f -name '*.so' -exec chrpath --delete {} \\;") + sh("find \$WORKSPACE/platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/build/ -name '*.la' -delete") + } + } + + stage('Test') { + options { + timeout(time: 30, unit: 'MINUTES') + } + + environment { + SK_TESTS_SKIP_REGRESSION = "{ -> params.LIBSK_TESTS_SKIP_REGRESSION }" + SK_TESTS_SKIP_TORTURE = "{ -> params.LIBSK_TESTS_SKIP_TORTURE }" + } + + steps { + dir('src/libsk') { + sh('make check') + } + } + + post { + always { + sh("rsync -ra --prune-empty-dirs --include='*/' --include='*.trs' --include='*.log' --exclude='*' src/libsk/ \$WORKSPACE/platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/log/") + sh("rsync -ra --prune-empty-dirs --include='*/' --exclude=test-suite.log --include='*.log' --exclude='*' src/libsk/tests/ \$WORKSPACE/platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/tap/") + + dir('src/libsk') { + sh('make clean') + } + + archiveArtifacts( + artifacts: 'platform*/**,build/**,tap/**,log/**,core.tar.xz', + allowEmptyArchive: true, + fingerprint: true, + onlyIfSuccessful: false + ) + + step($class: 'TapPublisher', + testResults: "platform=${platform}/conf=${conf}/build=${build}/cc=${cc}/tap/**/*.log", + failIfNoResults: true, + failedTestsMarkBuildAsFailure: true, + outputTapToConsole: true, + todoIsFailure: false, + includeCommentDiagnostics: true, + removeYamlIfCorrupted: true + ) + } + cleanup { + cleanWs(cleanWhenFailure: false) + } + } + } + + } // End stages + } // End matrix + } // End stage('matrix') + } // End stages + + post { + failure { + emailext( + subject: "${currentBuild.displayName} #${currentBuild.number} ${currentBuild.result} in ${currentBuild.durationString}", + to: params.email_to, + body: """ +${currentBuild.result} in ${currentBuild.durationString} +description: ${currentBuild.description} + +See job logs at ${currentBuild.absoluteUrl}/pipeline-console +See pipeline overview at ${currentBuild.absoluteUrl}/pipeline-graph + +-- scm -- +${env.CHANGE_URL} commit ${env.CHANGE_ID} branch ${env.CHANGE_BRANCH} +""" + ) + } + } +} // End pipeline