-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ninja tests main pipeline (dependency issues)
- Loading branch information
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |