Skip to content

Commit

Permalink
ninja tests main pipeline (dependency issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Oct 11, 2023
1 parent 2b82ded commit 43e7c78
Showing 1 changed file with 96 additions and 0 deletions.
96 changes: 96 additions & 0 deletions tools/jenkins/ninja-tests-main-pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

def verbose = params.VERBOSE ?: '0'

podTemplate(
nodeSelector: params.NODE_SELECTOR,
activeDeadlineSeconds: 21600, // 6h total build limit
idleMinutes: 1,
// Secret volume with maven settings.xml for deploy, see also sim-link in "build" stage.
volumes: [ secretVolume(secretName: "jenkins-nexus", mountPath: "/root/jenkins-nexus")],
// workspaceVolume: dynamicPVC(requestsSize: "20Gi"),
workspaceVolume: persistentVolumeClaimWorkspaceVolume(claimName: "ninja-tests"),
containers: [
containerTemplate(name: 'jnlp',
image: 'jenkins/inbound-agent:4.13-2-alpine',
runAsUser: '0',
resourceRequestCpu: '1',
resourceLimitCpu: '1',
resourceRequestMemory: '1Gi',
resourceLimitMemory: '1Gi'),
containerTemplate(name: 'maven',
image: params.BUILDER_IMAGE ?: 'maven:3.8.5-openjdk-17',
runAsUser: '0',
ttyEnabled: true,
command: 'cat',
resourceRequestCpu: params.BUILDER_CPU ?: '4',
resourceLimitCpu: params.BUILDER_CPU ?: '4',
resourceRequestMemory: '8Gi',
resourceLimitMemory: '8Gi') // see also -Xmx flag lower
]
) {
node(POD_LABEL) {
try {
stage("checkout") {
git branch: params.BRANCH ?: 'feature/ninja-jenkins-tests',
url: 'https://github.com/Evolveum/midpoint.git'
}
stage("build") {
container('maven') {
sh """#!/bin/bash -ex
# .m2 is mutable and short-term, we just sym-link the settings.xml there.
mkdir -p /root/.m2
ln -s ../jenkins-nexus/settings.xml /root/.m2/settings.xml

if [ "${verbose}" -ge 1 ]; then
env | sort
mvn --version
df -h
fi

if [ "${verbose}" -ge 1 ]; then
df -h
fi
"""
}
}
stage("tests-default") {
container('maven') {
sh """#!/bin/bash -ex
mvn -B -ntp -U -Dmaven.test.failure.ignore clean install -P -docs,-dist -DintegrationTestSuite=fast -pl :ninja
mvn -B -ntp -U -Dmaven.test.failure.ignore clean install -P -dist -DintegrationTestSuite=fast


if [ "${verbose}" -ge 1 ]; then
df -h
fi
"""
}
}

} catch (Exception e) {
currentBuild.result = 'FAILURE' // error below will not set result for mailer!
error 'Marking build as FAILURE because of: ' + e
} finally {
try {
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: env.DEFAULT_MAIL_RECIPIENT,
sendToIndividuals: false])

sh """#!/bin/bash -ex
if [ "${verbose}" -ge 1 ]; then
df -h
fi
"""
} catch (Exception e) {
println 'Could not send email: ' + e
}
}
}
}

0 comments on commit 43e7c78

Please sign in to comment.