simplify jenkinsfile
Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
parent
f8d0442d2f
commit
19c6ae6347
|
@ -31,8 +31,6 @@ LABEL = 'ubuntu'
|
||||||
buildJdk = 'JDK 1.8 (latest)'
|
buildJdk = 'JDK 1.8 (latest)'
|
||||||
buildJdk9 = 'JDK 1.9 (latest)'
|
buildJdk9 = 'JDK 1.9 (latest)'
|
||||||
buildJdk10 = 'JDK 10 (latest)'
|
buildJdk10 = 'JDK 10 (latest)'
|
||||||
buildMvn = 'Maven 3.5.2'
|
|
||||||
deploySettings = 'archiva-uid-jenkins'
|
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
|
@ -40,65 +38,31 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
stage('Builds') {
|
||||||
stage('BuildAndDeploy') {
|
|
||||||
steps {
|
|
||||||
timeout(120) {
|
|
||||||
withMaven(maven: buildMvn, jdk: buildJdk,
|
|
||||||
mavenSettingsConfig: deploySettings,
|
|
||||||
mavenLocalRepo: ".repository",
|
|
||||||
options: [concordionPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true),
|
|
||||||
findbugsPublisher(disabled: true), artifactsPublisher(disabled: true),
|
|
||||||
invokerPublisher(disabled: true), jgivenPublisher(disabled: true),
|
|
||||||
junitPublisher(disabled: true, ignoreAttachments: false),
|
|
||||||
openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]
|
|
||||||
)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Run test phase / ignore test failures
|
|
||||||
// -B: Batch mode
|
|
||||||
// -U: Force snapshot update
|
|
||||||
// -e: Produce execution error messages
|
|
||||||
// -fae: Fail at the end
|
|
||||||
// -Dmaven.compiler.fork=false: Do not compile in a separate forked process
|
|
||||||
// -Dmaven.test.failure.ignore=true: Do not stop, if some tests fail
|
|
||||||
// -Pci-build: Profile for CI-Server
|
|
||||||
sh "mvn clean deploy -B -U -e -fae -T2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
post {
|
|
||||||
always {
|
|
||||||
junit testResults: '**/target/surefire-reports/TEST-*.xml'
|
|
||||||
}
|
|
||||||
success {
|
|
||||||
archiveArtifacts '**/target/*.jar'
|
|
||||||
}
|
|
||||||
failure {
|
|
||||||
notifyBuild("Failure in BuildAndDeploy Stage")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('JDKs') {
|
|
||||||
parallel {
|
parallel {
|
||||||
|
|
||||||
|
stage('BuildAndDeploy-JDK8') {
|
||||||
|
steps {
|
||||||
|
timeout(120) {
|
||||||
|
mavenBuild(buildJdk,"mvn clean deploy -B -U -e -fae -T2",
|
||||||
|
[artifactsPublisher(disabled: false),
|
||||||
|
junitPublisher(disabled: false, ignoreAttachments: false),
|
||||||
|
pipelineGraphPublisher(disabled: false)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
failure {
|
||||||
|
notifyBuild("Failure in BuildAndDeploy Stage")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('JDK9') {
|
stage('JDK9') {
|
||||||
steps {
|
steps {
|
||||||
ws("${env.JOB_NAME}-JDK9") {
|
ws("${env.JOB_NAME}-JDK9") {
|
||||||
checkout scm
|
checkout scm
|
||||||
timeout(120) {
|
timeout(120) {
|
||||||
withMaven(maven: buildMvn, jdk: buildJdk9,
|
mavenBuild(buildJdk9,"mvn clean install -B -U -e -fae -T2", [])
|
||||||
mavenSettingsConfig: deploySettings,
|
|
||||||
mavenLocalRepo: ".repository",
|
|
||||||
options: [concordionPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true),
|
|
||||||
findbugsPublisher(disabled: true), artifactsPublisher(disabled: true),
|
|
||||||
invokerPublisher(disabled: true), jgivenPublisher(disabled: true),
|
|
||||||
junitPublisher(disabled: true, ignoreAttachments: false),
|
|
||||||
openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sh "mvn clean install -B -U -e -fae -T2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,18 +72,7 @@ pipeline {
|
||||||
ws("${env.JOB_NAME}-JDK10") {
|
ws("${env.JOB_NAME}-JDK10") {
|
||||||
checkout scm
|
checkout scm
|
||||||
timeout(120) {
|
timeout(120) {
|
||||||
withMaven(maven: buildMvn, jdk: buildJdk10,
|
mavenBuild(buildJdk10,"mvn clean install -B -U -e -fae -T2", [])
|
||||||
mavenSettingsConfig: deploySettings,
|
|
||||||
mavenLocalRepo: ".repository",
|
|
||||||
options: [concordionPublisher(disabled: true), dependenciesFingerprintPublisher(disabled: true),
|
|
||||||
findbugsPublisher(disabled: true), artifactsPublisher(disabled: true),
|
|
||||||
invokerPublisher(disabled: true), jgivenPublisher(disabled: true),
|
|
||||||
junitPublisher(disabled: true, ignoreAttachments: false),
|
|
||||||
openTasksPublisher(disabled: true), pipelineGraphPublisher(disabled: true)]
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sh "mvn clean install -B -U -e -fae -T2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,6 +99,23 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def mavenBuild(jdk, cmdline, options) {
|
||||||
|
buildMvn = 'Maven 3.5.2'
|
||||||
|
deploySettings = 'archiva-uid-jenkins'
|
||||||
|
def mavenOpts = '-Xms1g -Xmx2g -Djava.awt.headless=true'
|
||||||
|
|
||||||
|
withMaven(maven: buildMvn, "$jdk": buildJdk,
|
||||||
|
publisherStrategy: 'EXPLICIT',
|
||||||
|
mavenOpts: mavenOpts,
|
||||||
|
mavenSettingsConfig: deploySettings,
|
||||||
|
mavenLocalRepo: ".repository",
|
||||||
|
options: options
|
||||||
|
)
|
||||||
|
{
|
||||||
|
sh "$cmdline"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Send a notification about the build status
|
// Send a notification about the build status
|
||||||
def notifyBuild(String buildStatus) {
|
def notifyBuild(String buildStatus) {
|
||||||
// default the value
|
// default the value
|
||||||
|
|
Loading…
Reference in New Issue