This is an automated email from the ASF dual-hosted git repository. mapohl pushed a commit to branch release-1.18 in repository https://gitbox.apache.org/repos/asf/flink.git
commit afa434d404048e5e43b49302c518e78bd07a3253 Author: Matthias Pohl <[email protected]> AuthorDate: Mon Nov 6 18:10:14 2023 +0100 [FLINK-33501][ci] Makes use of Maven wrapper --- .mvn/wrapper/maven-wrapper.properties | 2 ++ azure-pipelines.yml | 2 +- tools/azure-pipelines/build-apache-repo.yml | 2 +- tools/azure-pipelines/build-nightly-dist.yml | 2 -- tools/azure-pipelines/e2e-template.yml | 1 - tools/ci/maven-utils.sh | 36 ++++++---------------------- 6 files changed, 11 insertions(+), 34 deletions(-) diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 57bb584385e..12a80f7956e 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. + +# updating the Maven version requires updates to certain documentation and verification logic distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a8b446bd870..d5357a8e1b0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,7 +36,7 @@ trigger: resources: containers: - # Container with Maven 3.8.6, SSL to have the same environment everywhere. + # Container with SSL to have the same environment everywhere. # see https://github.com/apache/flink-connector-shared-utils/tree/ci_utils - container: flink-build-container image: chesnay/flink-ci:java_8_11_17_maven_386_v2 diff --git a/tools/azure-pipelines/build-apache-repo.yml b/tools/azure-pipelines/build-apache-repo.yml index 15551710402..2cf6fc96c56 100644 --- a/tools/azure-pipelines/build-apache-repo.yml +++ b/tools/azure-pipelines/build-apache-repo.yml @@ -36,7 +36,7 @@ trigger: resources: containers: - # Container with Maven 3.8.6, SSL to have the same environment everywhere. + # Container with SSL to have the same environment everywhere. # see https://github.com/apache/flink-connector-shared-utils/tree/ci_utils - container: flink-build-container image: chesnay/flink-ci:java_8_11_17_maven_386_v3 diff --git a/tools/azure-pipelines/build-nightly-dist.yml b/tools/azure-pipelines/build-nightly-dist.yml index 4c5b8151c0f..5f2d76b6321 100644 --- a/tools/azure-pipelines/build-nightly-dist.yml +++ b/tools/azure-pipelines/build-nightly-dist.yml @@ -40,7 +40,6 @@ jobs: inputs: script: | source ./tools/ci/maven-utils.sh - setup_maven run_mvn -version export MVN="run_mvn" @@ -93,7 +92,6 @@ jobs: inputs: script: | source ./tools/ci/maven-utils.sh - setup_maven run_mvn -version cd tools diff --git a/tools/azure-pipelines/e2e-template.yml b/tools/azure-pipelines/e2e-template.yml index 6ec29f20897..ca0d6c89111 100644 --- a/tools/azure-pipelines/e2e-template.yml +++ b/tools/azure-pipelines/e2e-template.yml @@ -98,7 +98,6 @@ jobs: - script: | echo "Setting up Maven" source ./tools/ci/maven-utils.sh - setup_maven # the APT mirrors access is based on a proposal from https://github.com/actions/runner-images/issues/7048#issuecomment-1419426054 echo "Configure APT mirrors" diff --git a/tools/ci/maven-utils.sh b/tools/ci/maven-utils.sh index 15a92575feb..2ac16179b23 100755 --- a/tools/ci/maven-utils.sh +++ b/tools/ci/maven-utils.sh @@ -16,38 +16,13 @@ # Utility for invoking Maven in CI function run_mvn { - MVN_CMD="mvn" - if [[ "$M2_HOME" != "" ]]; then - MVN_CMD="${M2_HOME}/bin/mvn" - fi - if [[ "$MVN_RUN_VERBOSE" != "false" ]]; then echo "Invoking mvn with '$MVN_GLOBAL_OPTIONS ${@}'" fi - $MVN_CMD $MVN_GLOBAL_OPTIONS "${@}" + $MAVEN_WRAPPER $MVN_GLOBAL_OPTIONS "${@}" } export -f run_mvn -function setup_maven { - set -e # fail if there was an error setting up maven - if [ ! -d "${MAVEN_VERSIONED_DIR}" ]; then - wget -nv https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${MAVEN_VERSION}/apache-maven-${MAVEN_VERSION}-bin.zip - unzip -d "${MAVEN_CACHE_DIR}" -qq "apache-maven-${MAVEN_VERSION}-bin.zip" - rm "apache-maven-${MAVEN_VERSION}-bin.zip" - fi - - export M2_HOME="${MAVEN_VERSIONED_DIR}" - echo "##vso[task.setvariable variable=M2_HOME]$M2_HOME" - - # just in case: clean up the .m2 home and remove invalid jar files - if [ -d "${HOME}/.m2/repository/" ]; then - find ${HOME}/.m2/repository/ -name "*.jar" -exec sh -c 'if ! zip -T {} >/dev/null ; then echo "deleting invalid file: {}"; rm -f {} ; fi' \; - fi - - echo "Installed Maven ${MAVEN_VERSION} to ${M2_HOME}" - set +e -} - function set_mirror_config { if [[ "$MAVEN_MIRROR_CONFIG_FILE" != "" ]]; then echo "[WARN] Maven mirror already configured to $MAVEN_MIRROR_CONFIG_FILE" @@ -81,10 +56,13 @@ function collect_coredumps { CI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -MAVEN_VERSION="3.8.6" -MAVEN_CACHE_DIR=${HOME}/maven_cache -MAVEN_VERSIONED_DIR=${MAVEN_CACHE_DIR}/apache-maven-${MAVEN_VERSION} +if [[ ! "${CI_DIR}" =~ .*/tools/ci[/]{0,1}$ ]]; then + echo "Error: ${BASH_SOURCE[0]} is expected to be located in the './tools/ci/' subfolder to make the Maven wrapper path resolution work." + exit 1 +fi +MAVEN_WRAPPER="${CI_DIR}/../../mvnw" +export MAVEN_WRAPPER MAVEN_MIRROR_CONFIG_FILE="" NPM_PROXY_PROFILE_ACTIVATION=""
