Skip to content
Snippets Groups Projects
Commit bf88aa68 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

fix/feat: improvements for Jenkins

parent 5c4ec3e5
No related branches found
No related tags found
No related merge requests found
......@@ -34,14 +34,15 @@ RUN zypper refresh && \
zypper install -y libmodbus-devel && \
zypper install -y nlohmann_json-devel gawk && \
bash "-c" "echo \"Defaults set_home\" >> /etc/sudoers" && \
bash "-c" "echo \"root ALL = (ALL) NOPASSWD: ALL\" >> /etc/sudoers" && \
useradd -u 30996 msk_jenkins && \
rm -f /var/run /var/lock && \
mkdir -p /var/run/lock && \
chmod ugo+rwX /var/run/lock && \
ln -sfn /var/run/lock /var/lock && \
ln -sfn /usr/lib64/libzmq.so.5 /usr/lib64/libzmq.so.3 && \
pip3 install --break-system-packages meson && \
# zypper install -y java-1_8_0-openjdk && \
# Fix to provide clang-format-14. In tumbleweed only the variant with full version name is available
ln -sfn `find /usr/bin/clang-format-14*` /usr/bin/clang-format-14
ln -sfn `find /usr/bin/clang-format-14*` /usr/bin/clang-format-14 # Fix to provide clang-format-14. In tumbleweed only the variant with full version name is available
# git config --system http.proxy http://xfelproxy.desy.de:3128 && \
# git config --system https.proxy http://xfelproxy.desy.de:3128
......
......@@ -57,7 +57,7 @@ def call() {
source /home/msk_jenkins/dragon/bin/setup.sh
dragon updatedb
dragon select --all
dragon update --https
dragon update --https --reset-url --default-branch --reset-hard-and-clean
rm -rf "${dragon_builds.getArtefactsDir()}"
dragon list --selected > \${WORKSPACE}/joblist.txt
"""
......@@ -103,24 +103,25 @@ def dragonRunner(String label, String build) {
withCredentials([string(credentialsId: 'gitllab-msksw-group-access-token-as-text', variable: 'GITLAB_TOKEN')]) {
sh """
mkdir -p /scratch
cd /scratch
cp -r /home/msk_jenkins/dragon/ dragon/
source dragon/bin/setup.sh
dragon build -t ${build} -k
dragon test -t ${build} -k
dragon foreach -t ${build} tar zcf /scratch/\\\${PROJECT}.tar.gz .
tar zcf /scratch/install-${label}-${build}.tar.gz -C /scratch/dragon/install-${build} .
mkdir -p "${dragon_builds.getArtefactsDir()}/${label}/${build}"
chown msk_jenkins:msk_jenkins "${dragon_builds.getArtefactsDir()}"
chown msk_jenkins:msk_jenkins "${dragon_builds.getArtefactsDir()}/${label}"
chown msk_jenkins:msk_jenkins "${dragon_builds.getArtefactsDir()}/${label}/${build}"
cd "${dragon_builds.getArtefactsDir()}/${label}/${build}"
cp /scratch/*.tar.gz .
chown msk_jenkins:msk_jenkins *
chown msk_jenkins:msk_jenkins /scratch
cat > /scratch/script <<EOF
#!/bin/bash
cd /scratch
cp -r /home/msk_jenkins/dragon/ dragon/
source dragon/bin/setup.sh
dragon build -t ${build} -k
dragon test -t ${build}
echo Building artefacts...
dragon foreach -t ${build} tar zcf /scratch/\\\\\\\${PROJECT}.tar.gz .
tar zcf /scratch/install-${label}-${build}.tar.gz -C /scratch/dragon/install-${build} .
mkdir -p "${dragon_builds.getArtefactsDir()}/${label}/${build}"
cd "${dragon_builds.getArtefactsDir()}/${label}/${build}"
cp /scratch/*.tar.gz .
EOF
cat /scratch/script
chmod +x /scratch/script
sudo -H -E -u msk_jenkins /scratch/script
"""
}
}}
......@@ -168,4 +169,4 @@ def transformIntoStep(String buildName) {
}
}
/**********************************************************************************************************************/
\ No newline at end of file
/**********************************************************************************************************************/
......@@ -22,9 +22,11 @@ def call(String name) {
stage('Generate report') {
// Run the dragonRunnerfor all labels + build types in parallel
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script {
parallel dragon_builds.getBuilds().collectEntries { ["${it}" : transformIntoStep(name, it)] }
}
}
}
}
stage('Scan for warnings') {
......@@ -32,7 +34,7 @@ def call(String name) {
node('Docker') {
script {
// report compiler warnings
recordIssues filters: [excludeMessage('.*-Wstrict-aliasing.*')], qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]], tools: [gcc()], sourceDirectory: '/scratch/dragon/sources'
recordIssues filters: [excludeMessage('.*-Wstrict-aliasing.*')], qualityGates: [[threshold: 1, type: 'TOTAL', unstable: true]], tools: [gcc()], sourceDirectory: '/scratch/dragon/sources', enabledForFailure: true
}
}
}
......@@ -76,8 +78,12 @@ def generateReport(String name, String label, String buildType) {
cat .dragon.configure.log
echo ================= build ==================
cat .dragon.build.log
echo ================= configure ==================
cat .dragon.test.log
echo ================= tests ==================
if [ -e .dragon.test.log ]; then
cat .dragon.test.log
else
echo "*** NO TESTS EXECUTED ***"
fi
"""
// Change names of tests inside ctest XML files to make test results from different builds distinguishable
......@@ -89,12 +95,17 @@ def generateReport(String name, String label, String buildType) {
// report ctest results
if(fileExists('CTestTestfile.cmake')) {
if(buildType != 'asan' && buildType != 'tsan') {
xunit (thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ], tools: [ CTest(pattern: "Testing/*/*.xml") ])
}
else {
xunit (thresholds: [ skipped(unstableThreshold: '0'), failed(unstableThreshold: '0') ], tools: [ CTest(pattern: "Testing/*/*.xml") ])
}
}
// report build/test failures through job status
// report build failures through job status (test failures are reported through xunit plugin)
if(!fileExists('.dragon.build.success')) {
echo("================= FAIL ==================")
echo("================= BUILD FAILED ==================")
if(buildType != 'asan' && buildType != 'tsan') {
currentBuild.result = 'ERROR'
}
......@@ -104,7 +115,7 @@ def generateReport(String name, String label, String buildType) {
}
}
else {
echo("================= SUCCESS ==================")
echo("================= BUILD SUCCESS (for test result, see xunit plugin) ==================")
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment