diff --git a/.github/actions/setup-java-with-cache/action.yml b/.github/actions/setup-java-with-cache/action.yml index 39d119bc81d3..4598b1c728e3 100644 --- a/.github/actions/setup-java-with-cache/action.yml +++ b/.github/actions/setup-java-with-cache/action.yml @@ -58,8 +58,15 @@ runs: - name: Calculate cache key id: cache-key shell: bash - run: | - echo "value=maven-repo-${{ hashFiles('**/pom.xml', '.mvn/extensions.xml', '.mvn/wrapper/maven-wrapper.properties') }}" >> "$GITHUB_OUTPUT" + run: > + echo "value=maven-repo-${{ hashFiles( + '**/pom.xml', + '.mvn/extensions.xml', + '.mvn/wrapper/maven-wrapper.properties', + 'dev-support/ci/populate-cache.sh' + ) }}-$JAVA_VERSION" >> "$GITHUB_OUTPUT" + env: + JAVA_VERSION: ${{ inputs.java-version }} - name: Remove any leftover Maven repo id: cleanup diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 6e05b867949e..6f3b0cf2b213 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -247,6 +247,15 @@ jobs: path: ~/.cache/ozone key: hadoop-${{ env.HADOOP_VERSION }} + - name: Restore Hadoop AWS dependencies + id: restore-hadoop-deps + # TODO reduce hard-code in HDDS-17509 + if: ${{ inputs.script == 'acceptance' && contains(inputs.split, 'test-s3a.sh') }} + uses: apache/infrastructure-actions/stash/restore@restore/v1 + with: + path: ~/.cache/ozone/maven-repo + key: hadoop-${{ env.HADOOP_VERSION }}-deps + - name: Restore Ranger id: restore-ranger # TODO reduce hard-code in HDDS-17509 diff --git a/.github/workflows/populate-cache.yml b/.github/workflows/populate-cache.yml index 040408994e24..46103836ab8a 100644 --- a/.github/workflows/populate-cache.yml +++ b/.github/workflows/populate-cache.yml @@ -24,6 +24,7 @@ on: paths: - 'pom.xml' - '**/pom.xml' + - 'dev-support/ci/populate-cache.sh' - '.github/actions/setup-java-with-cache/action.yml' - '.github/workflows/populate-cache.yml' - '.mvn/extensions.xml' @@ -62,16 +63,15 @@ jobs: java-version: ${{ env.TEST_JAVA_VERSION }} only-exact-hit: true - - name: Fetch plugin dependencies + - name: Fetch dependencies if: steps.restore-cache.outputs.cache-hit != 'true' - run: ./mvnw $MAVEN_ARGS --no-transfer-progress --show-version dependency:resolve-plugins + run: | + dev-support/ci/populate-cache.sh - name: Get versions id: versions run: | source hadoop-ozone/dev-support/checks/_lib.sh - NODEJS_VERSION=$(get_version nodejs) - echo "NODEJS_VERSION=$NODEJS_VERSION" >> $GITHUB_ENV HADOOP_VERSION=$(get_version hadoop) echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV RANGER_VERSION=$(get_version ranger) @@ -101,6 +101,30 @@ jobs: key: hadoop-${{ env.HADOOP_VERSION }} retention-days: 90 + - name: Restore Hadoop AWS dependencies + id: restore-hadoop-deps + uses: apache/infrastructure-actions/stash/restore@restore/v1 + with: + path: ~/.cache/ozone/maven-repo + key: hadoop-${{ env.HADOOP_VERSION }}-deps + + - name: Fetch Hadoop AWS dependencies + if: steps.restore-hadoop-deps.outputs.stash-hit != 'true' + run: | + # create custom local repo dir for Hadoop AWS dependencies + mkdir -p ~/.cache/ozone/maven-repo + bash hadoop-ozone/dist/src/main/compose/ozone/test-s3a.sh + env: + BUILD_ONLY: true + + - name: Stash Hadoop AWS dependencies + if: steps.restore-hadoop-deps.outputs.stash-hit != 'true' + uses: apache/infrastructure-actions/stash/save@save/v1 + with: + path: ~/.cache/ozone/maven-repo + key: hadoop-${{ env.HADOOP_VERSION }}-deps + retention-days: 90 + - name: Restore Ranger id: restore-ranger uses: apache/infrastructure-actions/stash/restore@restore/v1 @@ -126,22 +150,6 @@ jobs: key: ranger-${{ env.RANGER_VERSION }} retention-days: 90 - - name: Restore NodeJS tarballs - id: restore-nodejs - if: steps.restore-cache.outputs.cache-hit != 'true' - uses: actions/cache@v6 - with: - path: ~/.m2/repository/com/github/eirslett/node - key: nodejs-${{ env.NODEJS_VERSION }} - - - name: Download NodeJS - if: steps.restore-cache.outputs.cache-hit != 'true' && steps.restore-nodejs.outputs.cache-hit != 'true' - run: dev-support/ci/download-nodejs.sh - - - name: Fetch dependencies - if: steps.restore-cache.outputs.cache-hit != 'true' - run: ./mvnw $BUILD_ARGS $MAVEN_ARGS --no-transfer-progress --show-version -Pgo-offline clean verify - - name: Delete Ozone jars from repo if: steps.restore-cache.outputs.cache-hit != 'true' run: rm -fr ~/.m2/repository/org/apache/ozone diff --git a/dev-support/ci/download-nodejs.sh b/dev-support/ci/download-nodejs.sh deleted file mode 100755 index 53561f87ba7a..000000000000 --- a/dev-support/ci/download-nodejs.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -# 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. -# This script gets a list of the changed files from git, and matches -# that list against a set of regexes, each of which corresponds to a -# test group. For each set of matches, a flag is set to let github -# actions know to run that test group. - -# Downloads Node.js for multiple platforms (Linux, Mac) - -set -u -o pipefail - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -cd "${DIR}/../.." || exit 1 - -: ${REPO_DIR:="${HOME}/.m2/repository"} - -mkdir -p "${REPO_DIR}" - -declare -i rc=1 - -if [[ -z "${NODEJS_VERSION:-}" ]]; then - source hadoop-ozone/dev-support/checks/_lib.sh - NODEJS_VERSION=$(get_version nodejs) -fi - -if [[ -n "${NODEJS_VERSION}" ]]; then - rc=0 - for platform in darwin-x64 linux-x64; do - url="https://nodejs.org/dist/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}-${platform}.tar.gz" - output="${REPO_DIR}/com/github/eirslett/node/${NODEJS_VERSION}/node-${NODEJS_VERSION}-${platform}.tar.gz" - mkdir -pv "$(dirname "${output}")" - - irc=1 - for i in 1 2 3; do - echo "Downloading ${url}, attempt ${i}" - if curl --location --continue-at - -o "${output}" "${url}"; then - irc=0 - break - fi - sleep 2 - done - - if [[ ${rc} -eq 0 ]]; then - rc=${irc} - fi - done -fi - -exit ${rc} diff --git a/dev-support/ci/populate-cache.sh b/dev-support/ci/populate-cache.sh new file mode 100755 index 000000000000..5a4a85c39565 --- /dev/null +++ b/dev-support/ci/populate-cache.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# 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. + +# Fetches Ozone build and runtime dependencies. + +set -e -u -o pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd "$DIR/../.." || exit 1 + +# fetch plugins, even if not part of normal build +./mvnw --batch-mode --show-version dependency:resolve-plugins help:help "$@" + +# install, but skip shaded modules +./mvnw --batch-mode --show-version clean install \ + -DskipShade -Pgo-offline ${BUILD_ARGS:-} "$@" + +# no shading +hadoop-ozone/dev-support/checks/_build.sh compile cyclonedx:makeBom \ + -pl :ozone-filesystem-shaded,:ozone-filesystem-hadoop2 \ + -Dmaven-replacer-plugin.skip "$@" + +# exercise some checks on limited modules to get more dependencies +hadoop-ozone/dev-support/checks/errorprone.sh -pl :ozone-main "$@" || true +hadoop-ozone/dev-support/checks/pmd.sh -am -pl :ozone-dev-support "$@" || true +hadoop-ozone/dev-support/checks/repro.sh -pl :ozone-main "$@" || true diff --git a/hadoop-ozone/dev-support/checks/_lib.sh b/hadoop-ozone/dev-support/checks/_lib.sh index 00078b35f7c6..329af20184fb 100644 --- a/hadoop-ozone/dev-support/checks/_lib.sh +++ b/hadoop-ozone/dev-support/checks/_lib.sh @@ -103,12 +103,14 @@ get_version() { local tempfile=$(mktemp) local -i rc=0 - # output version/transfer etc. to stderr first - ./mvnw --batch-mode --non-recursive --show-version \ - help:evaluate -Dexpression="${dep}.version" -Doutput="${tempfile}" \ - -Dscan=false "$@" >&2 \ - && cat "${tempfile}" \ - || rc=$? + local opts="--batch-mode --non-recursive --show-version -Dscan=false help:evaluate" + + if ./mvnw --offline $opts -Dexpression="${dep}.version" -Doutput="${tempfile}" "$@" >&2 \ + || ./mvnw $opts -Dexpression="${dep}.version" -Doutput="${tempfile}" "$@" >&2; then + cat "${tempfile}" + else + rc=1 + fi rm -f "${tempfile}" return ${rc} diff --git a/hadoop-ozone/dist/src/main/compose/common/s3a-test.sh b/hadoop-ozone/dist/src/main/compose/common/s3a-test.sh index bf29e0f0cf1e..294323713c92 100644 --- a/hadoop-ozone/dist/src/main/compose/common/s3a-test.sh +++ b/hadoop-ozone/dist/src/main/compose/common/s3a-test.sh @@ -48,6 +48,18 @@ if ! download_hadoop_aws; then exit 1 fi +if [[ "${CI:-}" == "true" ]] && [[ -d "${DOWNLOAD_DIR}/maven-repo" ]]; then + # custom local repo for Hadoop AWS dependencies + MAVEN_ARGS="${MAVEN_ARGS:-} -Dmaven.repo.local=${DOWNLOAD_DIR}/maven-repo" +fi + +if [[ "${BUILD_ONLY:-}" == "true" ]]; then + cd "${HADOOP_AWS_DIR}" + mvn ${MAVEN_ARGS:-} --show-version -Dtest=ITestS3AContractContentSummary clean test + echo "[INFO] Skip S3A tests" + exit 0 +fi + ## @description Run S3A contract tests against Ozone. ## @param Ozone S3 bucket execute_s3a_tests() { diff --git a/hadoop-ozone/ozonefs-hadoop2/pom.xml b/hadoop-ozone/ozonefs-hadoop2/pom.xml index f454664c6d18..c62eada2b597 100644 --- a/hadoop-ozone/ozonefs-hadoop2/pom.xml +++ b/hadoop-ozone/ozonefs-hadoop2/pom.xml @@ -195,6 +195,7 @@ process-sources + ${maven-replacer-plugin.skip} ${project.basedir}/target/generated-sources **/*.java diff --git a/hadoop-ozone/pom.xml b/hadoop-ozone/pom.xml index 0109eee20d14..17d81189e6b6 100644 --- a/hadoop-ozone/pom.xml +++ b/hadoop-ozone/pom.xml @@ -125,13 +125,6 @@ ozonefs-shaded - - go-offline - - ozonefs-hadoop2 - ozonefs-shaded - - CI diff --git a/pom.xml b/pom.xml index 25ad14093982..6609c71ad7fa 100644 --- a/pom.xml +++ b/pom.xml @@ -146,6 +146,7 @@ 3.12.0 1.3 3.3.0 + false 1.5.3 3.5.0 3.6.2 @@ -3053,12 +3054,10 @@ go-offline - true true true true true - true true void