Skip to content

Commit

Permalink
pipelines: returned jnlp and explicit checkout, removed try-catch
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed May 5, 2022
1 parent b471d91 commit 46d5dd3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 56 deletions.
87 changes: 36 additions & 51 deletions tools/jenkins/midpoint-main-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ podTemplate(
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")],
volumes: [ secretVolume(secretName: "jenkins-nexus", mountPath: "/root/jenkins-nexus")],
workspaceVolume: dynamicPVC(requestsSize: "20Gi"),
containers: [
containerTemplate(name: 'jnlp',
Expand All @@ -28,69 +28,54 @@ podTemplate(
}
stage("build") {
container('maven') {
try {
sh """#!/bin/bash
# .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
sh """#!/bin/bash
# .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}' = '1' ]
then
env | sort
mvn --version
df -h
fi
if [ '${VERBOSE}' = '1' ]
then
env | sort
mvn --version
df -h
fi

mvn -B -ntp -DskipTests clean deploy -DdeployAtEnd=true
mvn -B -ntp -DskipTests clean deploy -DdeployAtEnd=true

if [ '${VERBOSE}' = '1' ]
then
df -h
fi
"""
} catch (err) {
echo "Caught: ${err}"
currentBuild.result = 'FAILURE'
}
if [ '${VERBOSE}' = '1' ]
then
df -h
fi
"""
}
}
stage("tests-default") {
container('maven') {
try {
sh """
mvn -B -ntp -Dmaven.test.failure.ignore verify
sh """
mvn -B -ntp -Dmaven.test.failure.ignore verify

if [ '${VERBOSE}' = '1' ]
then
df -h
fi
"""
} catch (err) {
echo "Caught: ${err}"
currentBuild.result = 'FAILURE'
} finally {
step([$class: 'Publisher', reportFilenamePattern: '**/testng-results.xml'])
}
if [ '${VERBOSE}' = '1' ]
then
df -h
fi
"""
}
}
stage("tests-extra") {
container('maven') {
try {
// -Xmx6g should fit into 8GB of RAM, 4g is on the edge for some tests
sh """
mvn -B -ntp -Dmaven.test.failure.ignore verify -P extratest -Dfailsafe.args="-Xms2g -Xmx6g -Duser.language=en --add-exports java.management/sun.management=ALL-UNNAMED"
// -Xmx6g should fit into 8GB of RAM, 4g is on the edge for some tests
sh """
mvn -B -ntp -Dmaven.test.failure.ignore verify -P extratest -Dfailsafe.args="-Xms2g -Xmx6g -Duser.language=en --add-exports java.management/sun.management=ALL-UNNAMED" -pl testing

if [ '${VERBOSE}' = '1' ]
then
df -h
fi
"""
} catch (err) {
echo "Caught: ${err}"
currentBuild.result = 'FAILURE'
} finally {
step([$class: 'Publisher', reportFilenamePattern: '**/testng-results.xml'])
}
if [ '${VERBOSE}' = '1' ]
then
df -h
fi
"""

// Collects results for all tests (main + extra).
// Using this step in each phase produces multiple graphs, but all have the same results from the last run.
step([$class: 'Publisher', reportFilenamePattern: 'testing/**/testng-results.xml'])
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions tools/jenkins/midpoint-quick-pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ podTemplate(
// No need for secret volume, no mvn deploy done here.
workspaceVolume: dynamicPVC(requestsSize: "10Gi"),
containers: [
/*
containerTemplate(name: 'jnlp',
image: 'jenkins/inbound-agent:4.10-3-alpine',
runAsUser: '0',
resourceLimitCpu: '900m',
resourceLimitMemory: '1Gi',
resourceRequestCpu: '900m',
resourceRequestMemory: '1Gi'),
*/
containerTemplate(name: 'maven',
image: 'maven:3.8.5-openjdk-11-slim',
ttyEnabled: true,
Expand All @@ -22,14 +20,11 @@ podTemplate(
]
) {
node(POD_LABEL) {
/* TODO experimentally disabled, Jenkins should still do it on its own
stage("checkout") {
git branch: "${BRANCH}",
url: 'https://github.com/Evolveum/midpoint.git'
echo "git checkout done..."
}
*/

stage("build") {
container('maven') {
sh """#!/bin/bash
Expand Down

0 comments on commit 46d5dd3

Please sign in to comment.