You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ma...@apache.org on 2020/04/18 17:07:33 UTC
[logging-log4j2] branch master updated: Clean up and document
Jenkinsfile
This is an automated email from the ASF dual-hosted git repository.
mattsicker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/master by this push:
new 3efde38 Clean up and document Jenkinsfile
3efde38 is described below
commit 3efde38294b6ded8822778281bc9aa242d858580
Author: Matt Sicker <bo...@gmail.com>
AuthorDate: Sat Apr 18 12:04:11 2020 -0500
Clean up and document Jenkinsfile
Signed-off-by: Matt Sicker <bo...@gmail.com>
---
Jenkinsfile | 147 +++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 91 insertions(+), 56 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 1f903d5..9a1c0ee 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -16,77 +16,111 @@
* limitations under the License.
*/
+// =================================================================
+// https://cwiki.apache.org/confluence/display/LOGGING/Jenkins+Setup
+// =================================================================
+
+// general pipeline documentation: https://jenkins.io/doc/book/pipeline/syntax/
pipeline {
+ // https://jenkins.io/doc/book/pipeline/syntax/#options
options {
- ansiColor('xterm')
+ // support ANSI colors in stdout/stderr
+ ansiColor 'xterm'
+ // only keep the latest 10 builds
buildDiscarder logRotator(numToKeepStr: '10')
+ // cancel build if not complete within two hours of scheduling
timeout time: 2, unit: 'HOURS'
+ // fail parallel stages as soon as any of them fail
parallelsAlwaysFailFast()
- durabilityHint 'PERFORMANCE_OPTIMIZED'
}
+ // https://jenkins.io/doc/book/pipeline/syntax/#agent
+ // start with no Jenkins agent allocated as they will only be needed for the individual stages
+ // therefore, anything in the top level post section can only contain steps that don't require a Jenkins agent
+ // (such as slackSend, mail, etc.)
agent none
stages {
- stage('Checkout') {
- parallel {
- stage('Ubuntu') {
- agent { label 'ubuntu' }
- tools {
- jdk 'JDK 1.8 (latest)'
- maven 'Maven 3 (latest)'
- }
- environment {
- LANG = 'C.UTF-8'
- }
- steps {
- sh 'mvn -fae -t toolchains-jenkins-ubuntu.xml -Djenkins -V clean install deploy'
- }
- post {
- success {
- archiveArtifacts artifacts: '**/*.jar', fingerprint: true
+ stage('Continuous Integration') {
+ // https://jenkins.io/doc/book/pipeline/syntax/#parallel
+ parallel {
+ stage('Ubuntu') {
+ agent {
+ // https://cwiki.apache.org/confluence/display/INFRA/Jenkins+node+labels
+ label 'ubuntu'
}
- always {
- junit '**/*-reports/*.xml'
- recordIssues enabledForFailure: true,
- sourceCodeEncoding: 'UTF-8',
- referenceJobName: 'log4j/master',
- tools: [mavenConsole(), errorProne(), java(),
- taskScanner(highTags: 'FIXME', normalTags: 'TODO', includePattern: '**/*.java', excludePattern: '*/target/**')]
+ // https://jenkins.io/doc/book/pipeline/syntax/#tools
+ tools {
+ // https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix
+ jdk 'JDK 1.8 (latest)'
+ // https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix
+ maven 'Maven 3 (latest)'
+ }
+ // https://jenkins.io/doc/book/pipeline/syntax/#environment
+ environment {
+ LANG = 'C.UTF-8'
+ }
+ steps {
+ // build, test, and deploy snapshots
+ // note that the jenkins system property is set here to activate certain pom properties in
+ // some log4j modules that compile against system jars (e.g., log4j-jmx-gui)
+ // also note that the Jenkins agents on builds.a.o already have an ~/.m2/settings.xml for snapshots
+ sh 'mvn --show-version --fail-at-end --toolchains toolchains-jenkins-ubuntu.xml -Djenkins clean install deploy'
+ }
+ post {
+ always {
+ // record linux run of tests
+ junit '**/*-reports/*.xml'
+ // additional warnings generated during build
+ // TODO: would be nice to be able to include checkstyle, cpd, pmd, and spotbugs,
+ // but current site build takes too long
+ recordIssues enabledForFailure: true,
+ sourceCodeEncoding: 'UTF-8',
+ referenceJobName: 'log4j/master',
+ tools: [mavenConsole(), errorProne(), java(),
+ taskScanner(highTags: 'FIXME', normalTags: 'TODO', includePattern: '**/*.java', excludePattern: '*/target/**')]
+ }
}
}
- }
- stage('Windows') {
- agent { label 'Windows' }
- tools {
- jdk 'JDK 1.8 (latest)'
- maven 'Maven 3 (latest)'
- }
- environment {
- LANG = 'C.UTF-8'
- }
- steps {
- bat '''
+ stage('Windows') {
+ agent {
+ // https://cwiki.apache.org/confluence/display/INFRA/Jenkins+node+labels
+ label 'Windows'
+ }
+ tools {
+ // https://cwiki.apache.org/confluence/display/INFRA/JDK+Installation+Matrix
+ jdk 'JDK 1.8 (latest)'
+ // https://cwiki.apache.org/confluence/display/INFRA/Maven+Installation+Matrix
+ maven 'Maven 3 (latest)'
+ }
+ environment {
+ LANG = 'C.UTF-8'
+ }
+ steps {
+ // note that previous test runs of log4j-mongodb* may have left behind an embedded mongo folder
+ // also note that we don't need to use the jenkins system property here as it's ubuntu-specific
+ bat '''
if exist %userprofile%\\.embedmongo\\ rd /s /q %userprofile%\\.embedmongo
- mvn -fae -t toolchains-jenkins-win.xml -V clean install
+ mvn --show-version --fail-at-end --toolchains toolchains-jenkins-win.xml clean install
'''
- }
- post {
- always {
- junit '**/*-reports/*.xml'
+ }
+ post {
+ always {
+ // record windows run of tests
+ junit '**/*-reports/*.xml'
+ }
}
}
}
}
}
- }
post {
fixed {
slackSend channel: 'logging',
- color: 'good',
- message: ":excellent: <${env.JOB_URL}|${env.JOB_NAME}> was fixed in <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>."
+ color: 'good',
+ message: ":excellent: <${env.JOB_URL}|${env.JOB_NAME}> was fixed in <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>."
mail to: 'notifications@logging.apache.org',
- from: 'Mr. Jenkins <je...@builds.apache.org>',
- subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal",
- body: """
+ from: 'Mr. Jenkins <je...@builds.apache.org>',
+ subject: "[CI][SUCCESS] ${env.JOB_NAME}#${env.BUILD_NUMBER} back to normal",
+ body: """
The build for ${env.JOB_NAME} completed successfully and is back to normal.
Build: ${env.BUILD_URL}
@@ -100,16 +134,17 @@ Director of Continuous Integration
}
failure {
slackSend channel: 'logging',
- color: 'danger',
- message: ":doh: <${env.JOB_URL}|${env.JOB_NAME}> failed in <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>."
+ color: 'danger',
+ message: ":doh: <${env.JOB_URL}|${env.JOB_NAME}> failed in <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>. <${env.BUILD_URL}testReport/|Tests>."
mail to: 'notifications@logging.apache.org',
- from: 'Mr. Jenkins <je...@builds.apache.org>',
- subject: "Jenkins job ${env.JOB_NAME}#${env.BUILD_NUMBER} failed",
- body: """
+ from: 'Mr. Jenkins <je...@builds.apache.org>',
+ subject: "[CI][FAILURE] ${env.JOB_NAME}#${env.BUILD_NUMBER} has potential issues",
+ body: """
There is a build failure in ${env.JOB_NAME}.
Build: ${env.BUILD_URL}
Logs: ${env.BUILD_URL}console
+Test results: ${env.BUILD_URL}testReport/
Changes: ${env.BUILD_URL}changes
--
@@ -119,8 +154,8 @@ Director of Continuous Integration
}
unstable {
slackSend channel: 'logging',
- color: 'warning',
- message: ":disappear: <${env.JOB_URL}|${env.JOB_NAME}> is unstable in <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>."
+ color: 'warning',
+ message: ":disappear: <${env.JOB_URL}|${env.JOB_NAME}> is unstable in <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>."
}
}
}