Skip to content

Commit

Permalink
Merge branch 'master' into plugins-4x
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jan 12, 2024
2 parents 961cff9 + 0d046da commit 4f3fe08
Show file tree
Hide file tree
Showing 1,326 changed files with 32,541 additions and 18,492 deletions.
2 changes: 2 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ github:
squash: true
merge: false
rebase: true
autolink_jira:
- MNG
notifications:
commits: commits@maven.apache.org
issues: issues@maven.apache.org
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- uses: actions/setup-java@v3
with:
java-version: 8
java-version: 11
distribution: 'temurin'
cache: 'maven'

Expand All @@ -61,7 +61,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
java: [8, 11, 17]
java: [11, 17, 21]

fail-fast: false
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -106,19 +106,21 @@ jobs:
ref: ${{ env.REPO_BRANCH }}
persist-credentials: false

- name: Download built Maven
uses: actions/download-artifact@v3
with:
name: built-maven
path: built-maven/

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
# cache: 'maven' - don't use cache for integration tests

- uses: actions/checkout@v3
with:
path: maven/
persist-credentials: false

- name: Build Maven
run: mvn install -e -B -V -DdistributionFileName=apache-maven -DskipTests -f maven/pom.xml

- name: Running integration tests
shell: bash
run: mvn install -e -B -V -Prun-its,embedded -DmavenDistro="$GITHUB_WORKSPACE/built-maven/apache-maven-bin.zip" -f maven-integration-testing/pom.xml
run: mvn install -e -B -V -Prun-its,embedded -DmavenDistro="$GITHUB_WORKSPACE/maven/apache-maven/target/apache-maven-bin.zip" -f maven-integration-testing/pom.xml
2 changes: 1 addition & 1 deletion .github/workflows/maven_build_itself.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java: [8, 17]
java: [11, 17, 21]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down
78 changes: 45 additions & 33 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'5':'1'))])

def buildOs = 'linux'
def buildJdk = '8'
def buildJdk = '11'
def buildMvn = '3.8.x'
def runITsOses = ['linux']
def runITsJdks = ['8', '11', '17']
def runITsJdks = ['11', '17', '21']
def runITsMvn = '3.8.x'
def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
def tests
Expand Down Expand Up @@ -58,9 +58,6 @@ node(jenkinsEnv.nodeSelection(osNode)) {
} finally {
junit testResults: '**/target/surefire-reports/*.xml,**/target/failsafe-reports/*.xml', allowEmptyResults: true
}
dir ('apache-maven/target') {
stash includes: 'apache-maven-bin.zip', name: 'maven-dist'
}
}
}
}
Expand All @@ -84,39 +81,54 @@ for (String os in runITsOses) {
// will not trample each other plus workaround for JENKINS-52657
dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") {
def WORK_DIR=pwd()
checkout([$class: 'GitSCM',
branches: [[name: "*/master"]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])
if (isUnix()) {
sh "rm -rvf $WORK_DIR/dists $WORK_DIR/it-local-repo"
} else {
bat "if exist it-local-repo rmdir /s /q it-local-repo"
bat "if exist dists rmdir /s /q dists"
}
dir('dists') {
unstash 'maven-dist'
}
try {
withEnv(["JAVA_HOME=${ tool "$jdkName" }",
"PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
String cmd = "${runITscommand} -Dmaven.repo.local=$WORK_DIR/it-local-repo -DmavenDistro=$WORK_DIR/dists/apache-maven-bin.zip -Dmaven.test.failure.ignore"
dir ('maven') {
checkout scm
withEnv(["JAVA_HOME=${ tool "$jdkName" }",
"PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
sh "mvn clean install -B -U -e -DskipTests -V -PversionlessMavenDist -Dmaven.repo.local=${WORK_DIR}/.repository"
}
}
dir ('its') {
def ITS_BRANCH = env.CHANGE_BRANCH != null ? env.CHANGE_BRANCH : env.BRANCH_NAME;
try {
echo "Checkout ITs from branch: ${ITS_BRANCH}"
checkout([$class: 'GitSCM',
branches: [[name: ITS_BRANCH]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])
} catch (Throwable e) {
echo "Failure checkout ITs branch: ${ITS_BRANCH} - fallback master branch"
checkout([$class: 'GitSCM',
branches: [[name: "*/master"]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])
}

try {
withEnv(["JAVA_HOME=${ tool "$jdkName" }",
"PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
String cmd = "${runITscommand} -Dmaven.repo.local=$WORK_DIR/.repository -DmavenDistro=$WORK_DIR/maven/apache-maven/target/apache-maven-bin.zip -Dmaven.test.failure.ignore"

if (isUnix()) {
sh 'df -hT'
sh "${cmd}"
} else {
bat 'wmic logicaldisk get size,freespace,caption'
bat "${cmd}"
if (isUnix()) {
sh 'df -hT'
sh "${cmd}"
} else {
bat 'wmic logicaldisk get size,freespace,caption'
bat "${cmd}"
}
}
} finally {
// in ITs test we need only reports from test itself
// test projects can contain reports with tested failed builds
junit testResults: '**/core-it-suite/target/surefire-reports/*.xml,**/core-it-support/**/target/surefire-reports/*.xml', allowEmptyResults: true
archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
}
}
} finally {
// in ITs test we need only reports from test itself
// test projects can contain reports with tested failed builds
junit testResults: '**/core-it-suite/target/surefire-reports/*.xml,**/core-it-support/**/target/surefire-reports/*.xml', allowEmptyResults: true
archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
deleteDir() // clean up after ourselves to reduce disk space
}
}
Expand Down
171 changes: 171 additions & 0 deletions Jenkinsfile.s390x
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

properties([buildDiscarder(logRotator(artifactNumToKeepStr: '5', numToKeepStr: env.BRANCH_NAME=='master'?'5':'1'))])

def buildOs = 'linux'
def buildJdk = '11'
def buildMvn = '3.8.x'
def runITsOses = ['linux']
def runITsJdks = ['11', '17']
def runITsMvn = '3.8.x'
def runITscommand = "mvn clean install -Prun-its,embedded -B -U -V" // -DmavenDistro=... -Dmaven.test.failure.ignore=true
def tests

try {

def osNode = jenkinsEnv.labelForOS(buildOs)
node('s390x') {
dir('build') {
stage('Checkout') {
checkout scm
}

def WORK_DIR=pwd()
def MAVEN_GOAL='verify'

stage('Build / Unit Test') {
String jdkName = jenkinsEnv.jdkFromVersion(buildOs, buildJdk)
String mvnName = jenkinsEnv.mvnFromVersion(buildOs, buildMvn)
try {
withEnv(["JAVA_HOME=${ tool "$jdkName" }",
"PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
sh "mvn clean ${MAVEN_GOAL} -B -U -e -fae -V -Dmaven.test.failure.ignore -PversionlessMavenDist -Dmaven.repo.local=${WORK_DIR}/.repository"
}
} finally {
junit testResults: '**/target/surefire-reports/*.xml,**/target/failsafe-reports/*.xml', allowEmptyResults: true
}
dir ('apache-maven/target') {
stash includes: 'apache-maven-bin.zip', name: 'maven-dist-s390x'
}
}
}
}

Map runITsTasks = [:]
for (String os in runITsOses) {
for (def jdk in runITsJdks) {
String osLabel = jenkinsEnv.labelForOS(os);
String jdkName = jenkinsEnv.jdkFromVersion(os, "${jdk}")
String mvnName = jenkinsEnv.mvnFromVersion(os, "${runITsMvn}")
echo "OS: ${os} JDK: ${jdk} => Label: ${osLabel} JDK: ${jdkName} Arch: s390x"

String stageId = "${os}-jdk${jdk}-s390x"
String stageLabel = "Run ITs ${os.capitalize()} Java ${jdk} on s390x"
runITsTasks[stageId] = {
node('s390x') {
stage("${stageLabel}") {
echo "NODE_NAME = ${env.NODE_NAME}"
// on Windows, need a short path or we hit 256 character limit for paths
// using EXECUTOR_NUMBER guarantees that concurrent builds on same agent
// will not trample each other plus workaround for JENKINS-52657
dir(isUnix() ? 'test' : "c:\\mvn-it-${EXECUTOR_NUMBER}.tmp") {
def WORK_DIR=pwd()
def ITS_BRANCH = env.CHANGE_BRANCH != null ? env.CHANGE_BRANCH : env.BRANCH_NAME;
try {
echo "Checkout ITs from branch: ${ITS_BRANCH}"
checkout([$class: 'GitSCM',
branches: [[name: ITS_BRANCH]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])
} catch (Throwable e) {
echo "Failure checkout ITs branch: ${ITS_BRANCH} - fallback master branch"
checkout([$class: 'GitSCM',
branches: [[name: "*/master"]],
extensions: [[$class: 'CloneOption', depth: 1, noTags: true, shallow: true]],
userRemoteConfigs: [[url: 'https://github.com/apache/maven-integration-testing.git']]])
}
if (isUnix()) {
sh "rm -rvf $WORK_DIR/dists $WORK_DIR/it-local-repo"
} else {
bat "if exist it-local-repo rmdir /s /q it-local-repo"
bat "if exist dists rmdir /s /q dists"
}
dir('dists') {
unstash 'maven-dist-s390x'
}
try {
withEnv(["JAVA_HOME=${ tool "$jdkName" }",
"PATH+MAVEN=${ tool "$jdkName" }/bin:${tool "$mvnName"}/bin",
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
String cmd = "${runITscommand} -Dmaven.repo.local=$WORK_DIR/it-local-repo -DmavenDistro=$WORK_DIR/dists/apache-maven-bin.zip -Dmaven.test.failure.ignore"

if (isUnix()) {
sh 'df -hT'
sh "${cmd}"
} else {
bat 'wmic logicaldisk get size,freespace,caption'
bat "${cmd}"
}
}
} finally {
// in ITs test we need only reports from test itself
// test projects can contain reports with tested failed builds
junit testResults: '**/core-it-suite/target/surefire-reports/*.xml,**/core-it-support/**/target/surefire-reports/*.xml', allowEmptyResults: true
archiveDirs(stageId, ['core-it-suite-logs':'core-it-suite/target/test-classes',
'core-it-suite-reports':'core-it-suite/target/surefire-reports'])
deleteDir() // clean up after ourselves to reduce disk space
}
}
}
}
}
}
}

// run the parallel ITs
parallel(runITsTasks)

// JENKINS-34376 seems to make it hard to detect the aborted builds
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
echo "[FAILURE-002] FlowInterruptedException ${e}"
// this ambiguous condition means a user probably aborted
if (e.causes.size() == 0) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
throw e
} catch (hudson.AbortException e) {
echo "[FAILURE-003] AbortException ${e}"
// this ambiguous condition means during a shell step, user probably aborted
if (e.getMessage().contains('script returned exit code 143')) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
throw e
} catch (InterruptedException e) {
echo "[FAILURE-004] ${e}"
currentBuild.result = "ABORTED"
throw e
} catch (Throwable e) {
echo "[FAILURE-001] ${e}"
currentBuild.result = "FAILURE"
throw e
}

def archiveDirs(stageId, archives) {
archives.each { archivePrefix, pathToContent ->
if (fileExists(pathToContent)) {
zip(zipFile: "${archivePrefix}-${stageId}.zip", dir: pathToContent, archive: true)
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ Do you like Apache Maven? Then [donate back to the ASF](https://www.apache.org/f
Quick Build
-------
If you want to bootstrap Maven, you'll need:
- Java 8+
- Maven 3.0.5 or later
- Java 11+
- Maven 3.6.3 or later
- Run Maven, specifying a location into which the completed Maven distro should be installed:
```
mvn -DdistributionTargetDir="$HOME/app/maven/apache-maven-4.0.x-SNAPSHOT" clean package
Expand Down
Loading

0 comments on commit 4f3fe08

Please sign in to comment.