This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f3dff7c68c HDDS-17517. Cache Hadoop/Ranger tarballs for acceptance 
(#11829)
6f3dff7c68c is described below

commit 6f3dff7c68c68bd30e3549e40be7027e8d849b60
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Sat Oct 31 08:13:18 2026 +0100

    HDDS-17517. Cache Hadoop/Ranger tarballs for acceptance (#11829)
    
    Co-authored-by: Siyao Meng <[email protected]>
---
 .github/workflows/check.yml                        | 29 +++++++
 .github/workflows/populate-cache.yml               | 75 +++++++++++++++---
 hadoop-ozone/dev-support/checks/acceptance.sh      | 30 -------
 .../dist/src/main/compose/common/s3a-test.sh       | 33 ++++++--
 .../dist/src/main/compose/ozonesecure-ha/.env      |  2 +-
 .../compose/ozonesecure-ha/docker-compose.yaml     |  2 +-
 .../main/compose/ozonesecure-ha/ranger-testlib.sh  | 24 +++---
 .../dist/src/main/compose/ozonesecure/.env         |  2 +-
 .../main/compose/ozonesecure/docker-compose.yaml   |  2 +-
 hadoop-ozone/dist/src/main/compose/testlib.sh      | 91 +++++++++++++++++++---
 .../dist/src/main/compose/upgrade/compose/ha/.env  |  2 +-
 .../compose/upgrade/compose/ha/docker-compose.yaml |  2 +-
 hadoop-ozone/dist/src/main/compose/xcompat/.env    |  2 +-
 .../dist/src/main/compose/xcompat/new-cluster.yaml |  2 +-
 .../dist/src/main/compose/xcompat/old-cluster.yaml |  2 +-
 .../dist/src/test/shell/compose_testlib.bats       | 50 ------------
 hadoop-ozone/dist/src/test/shell/failing1/test.sh  | 17 ----
 hadoop-ozone/dist/src/test/shell/test1/test.sh     | 15 ----
 hadoop-ozone/dist/src/test/shell/test2/test.sh     | 17 ----
 .../dist/src/test/shell/test3/subtest1/test.sh     | 17 ----
 hadoop-ozone/dist/src/test/shell/test4/test.sh     | 17 ----
 21 files changed, 219 insertions(+), 214 deletions(-)

diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index f744f4ffeb9..62d45d0d4f6 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -241,6 +241,35 @@ jobs:
           distribution: 'temurin'
           java-version: ${{ inputs.java-version }}
 
+      - name: Get versions
+        id: versions
+        # TODO remove hard-code in HDDS-17509
+        if: ${{ inputs.script == 'acceptance' }}
+        run: |
+          HADOOP_VERSION=$(mvn help:evaluate -N -Dexpression=hadoop.version -q 
-DforceStdout -Dscan=false)
+          echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV
+          RANGER_VERSION=$(mvn help:evaluate -N -Dexpression=ranger.version -q 
-DforceStdout -Dscan=false)
+          echo "RANGER_VERSION=$RANGER_VERSION" >> $GITHUB_ENV
+
+      - name: Restore Hadoop
+        id: restore-hadoop
+        # 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:
+          clean: true
+          path: ~/.cache/ozone
+          key: hadoop-${{ env.HADOOP_VERSION }}
+
+      - name: Restore Ranger
+        id: restore-ranger
+        # TODO reduce hard-code in HDDS-17509
+        if: ${{ inputs.script == 'acceptance' && (contains(inputs.split, 
'test-ranger.sh') || contains(inputs.split, 'test-sts.sh')) }}
+        uses: apache/infrastructure-actions/stash/restore@restore/v1
+        with:
+          path: ~/.cache/ozone
+          key: ranger-${{ env.RANGER_VERSION }}
+
       - name: Execute pre-test steps
         if: ${{ inputs.pre-script }}
         run: |
diff --git a/.github/workflows/populate-cache.yml 
b/.github/workflows/populate-cache.yml
index 5e319495b39..2f958dce3b8 100644
--- a/.github/workflows/populate-cache.yml
+++ b/.github/workflows/populate-cache.yml
@@ -21,9 +21,8 @@ on:
   push:
     branches:
       - master
-      - ozone-1.4
-      - ozone-2.0
       - ozone-2.1
+      - ozone-2.2
     paths:
       - 'pom.xml'
       - '**/pom.xml'
@@ -33,12 +32,17 @@ on:
 
 permissions: { }
 
+concurrency:
+  group: cache-${{ github.sha }}
+  cancel-in-progress: false
+
 env:
   # variables are duplicated from ci.yml, please keep in sync
   BUILD_ARGS: "-Pdist -Psrc -Dmaven.javadoc.skip=true -Drocks_tools_native"
   TEST_JAVA_VERSION: 25 # JDK version used by CI build and tests; should match 
the JDK version in apache/ozone-runner image
   MAVEN_ARGS: --batch-mode --settings ${{ github.workspace 
}}/dev-support/ci/maven-settings.xml -Ddevelocity.user.config=${{ 
github.workspace }}/.mvn/develocity-asf.xml
   MAVEN_OPTS: -Daether.connector.http.connectionMaxTtl=25 
-Daether.connector.http.retryHandler.count=5 
-Daether.connector.http.retryHandler.intervalMax=30000
+  SKIP_APACHE_VERIFY_DOWNLOAD: false
 
 jobs:
   build:
@@ -59,16 +63,69 @@ jobs:
           key: maven-repo-${{ hashFiles('**/pom.xml') }}
 
       - name: Setup Java
-        if: steps.restore-cache.outputs.cache-hit != 'true'
         uses: actions/setup-java@v6
         with:
           distribution: 'temurin'
           java-version: ${{ env.TEST_JAVA_VERSION }}
 
-      - name: Get NodeJS version
-        id: nodejs-version
-        if: steps.restore-cache.outputs.cache-hit != 'true'
-        run: echo "nodejs-version=$(mvn help:evaluate 
-Dexpression=nodejs.version -q -DforceStdout -Dscan=false)" >> $GITHUB_OUTPUT
+      - name: Get versions
+        id: versions
+        run: |
+          NODEJS_VERSION=$(mvn help:evaluate -N -Dexpression=nodejs.version -q 
-DforceStdout -Dscan=false)
+          echo "NODEJS_VERSION=$NODEJS_VERSION" >> $GITHUB_ENV
+          HADOOP_VERSION=$(mvn help:evaluate -N -Dexpression=hadoop.version -q 
-DforceStdout -Dscan=false)
+          echo "HADOOP_VERSION=$HADOOP_VERSION" >> $GITHUB_ENV
+          RANGER_VERSION=$(mvn help:evaluate -N -Dexpression=ranger.version -q 
-DforceStdout -Dscan=false)
+          echo "RANGER_VERSION=$RANGER_VERSION" >> $GITHUB_ENV
+
+      - name: Restore Hadoop
+        id: restore-hadoop
+        uses: apache/infrastructure-actions/stash/restore@restore/v1
+        with:
+          clean: true
+          path: ~/.cache/ozone
+          key: hadoop-${{ env.HADOOP_VERSION }}
+
+      - name: Get Hadoop
+        if: steps.restore-hadoop.outputs.stash-hit != 'true'
+        run: |
+          rm -fr ~/.cache/ozone
+          source hadoop-ozone/dist/src/main/compose/testlib.sh
+          import_keys https://downloads.apache.org/hadoop/common/KEYS
+          download_hadoop
+
+      - name: Stash Hadoop
+        if: steps.restore-hadoop.outputs.stash-hit != 'true'
+        uses: apache/infrastructure-actions/stash/save@save/v1
+        with:
+          path: ~/.cache/ozone
+          key: hadoop-${{ env.HADOOP_VERSION }}
+          retention-days: 90
+
+      - name: Restore Ranger
+        id: restore-ranger
+        uses: apache/infrastructure-actions/stash/restore@restore/v1
+        with:
+          clean: true
+          path: ~/.cache/ozone
+          key: ranger-${{ env.RANGER_VERSION }}
+
+      - name: Get Ranger
+        if: steps.restore-ranger.outputs.stash-hit != 'true'
+        run: |
+          rm -fr ~/.cache/ozone
+          source hadoop-ozone/dist/src/main/compose/testlib.sh
+          import_keys https://downloads.apache.org/ranger/KEYS
+          download_ranger
+          download_ranger_ozone_plugin
+
+      - name: Stash Ranger
+        if: steps.restore-ranger.outputs.stash-hit != 'true'
+        uses: apache/infrastructure-actions/stash/save@save/v1
+        with:
+          path: ~/.cache/ozone
+          key: ranger-${{ env.RANGER_VERSION }}
+          retention-days: 90
 
       - name: Restore NodeJS tarballs
         id: restore-nodejs
@@ -76,13 +133,11 @@ jobs:
         uses: actions/cache@v6
         with:
           path: ~/.m2/repository/com/github/eirslett/node
-          key: nodejs-${{ steps.nodejs-version.outputs.nodejs-version }}
+          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
-        env:
-          NODEJS_VERSION: ${{ steps.nodejs-version.outputs.nodejs-version }}
 
       - name: Fetch dependencies
         if: steps.restore-cache.outputs.cache-hit != 'true'
diff --git a/hadoop-ozone/dev-support/checks/acceptance.sh 
b/hadoop-ozone/dev-support/checks/acceptance.sh
index df8d729bec3..ebef2428f0a 100755
--- a/hadoop-ozone/dev-support/checks/acceptance.sh
+++ b/hadoop-ozone/dev-support/checks/acceptance.sh
@@ -21,7 +21,6 @@ cd "$DIR/../../.." || exit 1
 
 OZONE_ROOT=$(pwd -P)
 
-: ${HADOOP_AWS_DIR:=""}
 : ${OZONE_ACCEPTANCE_SUITE:=""}
 : ${OZONE_TEST_SELECTOR:="${1:-}"}
 : ${OZONE_ACCEPTANCE_TEST_TYPE:="robot"}
@@ -58,35 +57,6 @@ mkdir -p "$REPORT_DIR"
 
 if [[ "${OZONE_ACCEPTANCE_SUITE}" == "s3a" ]] || [[ "${OZONE_TEST_SELECTOR}" 
=~ "test-s3a.sh" ]]; then
   OZONE_ACCEPTANCE_TEST_TYPE="maven"
-
-  if [[ -z "${HADOOP_AWS_DIR}" ]]; then
-    hadoop_version=$(mvn help:evaluate -Dexpression=hadoop.version -q 
-DforceStdout -Dscan=false)
-    export HADOOP_AWS_DIR=${OZONE_ROOT}/target/hadoop-src
-  fi
-
-  download_hadoop_aws() {
-    local dir="$1"
-
-    if [[ -z ${dir} ]]; then
-      echo "Required argument: target directory for Hadoop AWS sources" >&2
-      return 1
-    fi
-
-    if [[ ! -e "${dir}" ]] || [[ ! -d "${dir}"/src/test/resources ]]; then
-      mkdir -p "${dir}"
-      if [[ ! -f "${dir}.tar.gz" ]]; then
-        local 
url="https://www.apache.org/dyn/closer.lua?action=download&filename=hadoop/common/hadoop-${hadoop_version}/hadoop-${hadoop_version}-src.tar.gz";
-        echo "Downloading Hadoop from ${url}"
-        curl -LSs --fail -o "${dir}.tar.gz" "$url" || return 1
-      fi
-      tar -x -z -C "${dir}" --strip-components=3 -f "${dir}.tar.gz" 
--wildcards 'hadoop-*-src/hadoop-tools/hadoop-aws' || return 1
-    fi
-  }
-
-  if ! download_hadoop_aws "${HADOOP_AWS_DIR}"; then
-    echo "Failed to download Hadoop ${hadoop_version}" > "${REPORT_FILE}"
-    exit 1
-  fi
 fi
 
 export OZONE_ACCEPTANCE_SUITE OZONE_ACCEPTANCE_TEST_TYPE OZONE_TEST_SELECTOR
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 7c5cd6df9d7..bf29e0f0cf1 100644
--- a/hadoop-ozone/dist/src/main/compose/common/s3a-test.sh
+++ b/hadoop-ozone/dist/src/main/compose/common/s3a-test.sh
@@ -17,16 +17,37 @@
 
 # This script runs S3A contract tests against various bucket types on
 # a Docker Compose-based Ozone cluster.
-# Requires HADOOP_AWS_DIR to point the directory containing hadoop-aws sources.
-
-if [[ -z ${HADOOP_AWS_DIR} ]] || [[ ! -e ${HADOOP_AWS_DIR} ]]; then
-  echo "Skipping S3A tests due to missing HADOOP_AWS_DIR (directory with 
hadoop-aws sources)" >&2
-  exit
-fi
+#
+# If you have Hadoop sources locally, set HADOOP_AWS_DIR to the directory 
containing `hadoop-aws`.
+# Otherwise it will try to download Hadoop ${HADOOP_VERSION}, defaults to 
${hadoop.version}.
 
 # shellcheck source=/dev/null
 source "$COMPOSE_DIR/../testlib.sh"
 
+: "${HADOOP_AWS_DIR:=${TEMP_DIR:-/tmp}/hadoop-aws-${HADOOP_VERSION}}"
+export HADOOP_AWS_DIR
+
+download_hadoop_aws() {
+  if [[ ! -e "${HADOOP_AWS_DIR}" ]] || [[ ! -d 
"${HADOOP_AWS_DIR}"/src/test/resources ]]; then
+    if [[ "${SKIP_APACHE_VERIFY_DOWNLOAD:-}" != "true" ]]; then
+      import_keys https://downloads.apache.org/hadoop/common/KEYS
+    fi
+
+    (
+      tarball="$(download_hadoop)" \
+        && mkdir -p "${HADOOP_AWS_DIR}" \
+        && tar -x -z -C "${HADOOP_AWS_DIR}" --strip-components=3 -f 
"${tarball}" \
+            --wildcards 'hadoop-*-src/hadoop-tools/hadoop-aws'
+    ) || return 1
+    # keep tarball for caching
+  fi
+}
+
+if ! download_hadoop_aws; then
+  echo "[ERROR] Failed to download Hadoop"
+  exit 1
+fi
+
 ## @description Run S3A contract tests against Ozone.
 ## @param       Ozone S3 bucket
 execute_s3a_tests() {
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/.env 
b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/.env
index 10da8c215be..d5bd112f696 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/.env
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/.env
@@ -16,7 +16,7 @@
 
 HDDS_VERSION=${hdds.version}
 HADOOP_IMAGE=${docker.hadoop.image}
-HADOOP_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
+HADOOP_IMAGE_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
 OZONE_RUNNER_VERSION=${docker.ozone-runner.version}
 OZONE_RUNNER_IMAGE=apache/ozone-runner
 OZONE_TESTKRB5_IMAGE=${docker.ozone-testkr5b.image}
diff --git 
a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/docker-compose.yaml 
b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/docker-compose.yaml
index f49cce439ca..fc84758ee7b 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/docker-compose.yaml
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/docker-compose.yaml
@@ -41,7 +41,7 @@ services:
       ozone_net:
         ipv4_address: 172.25.0.100
   kms:
-    image: ${HADOOP_IMAGE}:${HADOOP_VERSION}
+    image: ${HADOOP_IMAGE}:${HADOOP_IMAGE_VERSION}
     dns_search: .
     ports:
       - 9600:9600
diff --git 
a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/ranger-testlib.sh 
b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/ranger-testlib.sh
index 1046a412b24..554903c734f 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/ranger-testlib.sh
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure-ha/ranger-testlib.sh
@@ -41,32 +41,27 @@ setup_ranger_acceptance_env() {
     fi
   fi
 
-  if [[ -z "${RANGER_VERSION:-}" ]]; then
-    export RANGER_VERSION="${ranger.version}"
-  fi
-
-  : "${DOWNLOAD_DIR:=${TEMP_DIR:-/tmp}}"
+  # where tarballs will be extracted
+  : "${TEMP_DIR:=/tmp}"
 
   export COMPOSE_FILE=docker-compose.yaml:ranger.yaml:../common/ranger.yaml
   export OM_SERVICE_ID="omservice"
   export SCM=scm1.org
   export SECURITY_ENABLED=true
 
-  if [[ "${SKIP_APACHE_VERIFY_DOWNLOAD}" != "true" ]]; then
-    curl -LO https://downloads.apache.org/ranger/KEYS
-    gpg --import KEYS
+  if [[ "${SKIP_APACHE_VERIFY_DOWNLOAD:-}" != "true" ]]; then
+    import_keys https://downloads.apache.org/ranger/KEYS
   fi
 
-  download_and_verify_apache_release 
"ranger/${RANGER_VERSION}/apache-ranger-${RANGER_VERSION}.tar.gz"
-  tar -C "${DOWNLOAD_DIR}" -x -z -f 
"${DOWNLOAD_DIR}/apache-ranger-${RANGER_VERSION}.tar.gz"
-  export RANGER_SOURCE_DIR="${DOWNLOAD_DIR}/apache-ranger-${RANGER_VERSION}"
+  ( tarball=$(download_ranger) && tar -C "${TEMP_DIR}" -x -z -f "${tarball}" ) 
|| return 1
+  export RANGER_SOURCE_DIR="${TEMP_DIR}/apache-ranger-${RANGER_VERSION}"
   chmod -R a+rX "${RANGER_SOURCE_DIR}"
   export 
RANGER_INIT_POSTGRES_SH="${RANGER_SOURCE_DIR}/dev-support/ranger-docker/scripts/rdbms/init_postgres.sh"
 
   # Create a temp install.properties so we can override feature flags from 
.env.
   local ranger_admin_install_properties_src
   
ranger_admin_install_properties_src="${RANGER_SOURCE_DIR}/dev-support/ranger-docker/scripts/admin/ranger-admin-install-postgres.properties"
-  RANGER_ADMIN_INSTALL_PROPERTIES="$(mktemp 
"${DOWNLOAD_DIR%/}/ranger-admin-install-postgres.XXXXXX")"
+  RANGER_ADMIN_INSTALL_PROPERTIES="$(mktemp 
"${TEMP_DIR%/}/ranger-admin-install-postgres.XXXXXX")"
   cp -f "${ranger_admin_install_properties_src}" 
"${RANGER_ADMIN_INSTALL_PROPERTIES}"
   chmod a+r "${RANGER_ADMIN_INSTALL_PROPERTIES}"
 
@@ -89,9 +84,8 @@ setup_ranger_acceptance_env() {
   if [[ -d "${RANGER_SOURCE_DIR}/dev-support/ranger-docker" ]]; then
     find "${RANGER_SOURCE_DIR}/dev-support/ranger-docker" -type f -name '*.sh' 
-exec chmod a+x {} +
   fi
-  download_and_verify_apache_release 
"ranger/${RANGER_VERSION}/plugins/ozone/ranger-${RANGER_VERSION}-ozone-plugin.tar.gz"
-  tar -C "${DOWNLOAD_DIR}" -x -z -f 
"${DOWNLOAD_DIR}/ranger-${RANGER_VERSION}-ozone-plugin.tar.gz"
-  export 
RANGER_OZONE_PLUGIN_DIR="${DOWNLOAD_DIR}/ranger-${RANGER_VERSION}-ozone-plugin"
+  ( tarball=$(download_ranger_ozone_plugin) && tar -C "${TEMP_DIR}" -x -z -f 
"${tarball}" ) || return 1
+  export 
RANGER_OZONE_PLUGIN_DIR="${TEMP_DIR}/ranger-${RANGER_VERSION}-ozone-plugin"
   chmod -R a+rX "${RANGER_OZONE_PLUGIN_DIR}"
   chmod a+x "${RANGER_OZONE_PLUGIN_DIR}"/*.sh
 
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure/.env 
b/hadoop-ozone/dist/src/main/compose/ozonesecure/.env
index c260913a2f5..df15a24016b 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure/.env
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure/.env
@@ -16,7 +16,7 @@
 
 HDDS_VERSION=${hdds.version}
 HADOOP_IMAGE=${docker.hadoop.image}
-HADOOP_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
+HADOOP_IMAGE_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
 OZONE_RUNNER_VERSION=${docker.ozone-runner.version}
 OZONE_RUNNER_IMAGE=apache/ozone-runner
 OZONE_TESTKRB5_IMAGE=${docker.ozone-testkr5b.image}
diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml 
b/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml
index 0cb445a39cb..d84361334af 100644
--- a/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml
+++ b/hadoop-ozone/dist/src/main/compose/ozonesecure/docker-compose.yaml
@@ -39,7 +39,7 @@ services:
       - ../_keytabs:/etc/security/keytabs
     command: ["/opt/hadoop/compose/common/init-kdc.sh"]
   kms:
-    image: ${HADOOP_IMAGE}:${HADOOP_VERSION}
+    image: ${HADOOP_IMAGE}:${HADOOP_IMAGE_VERSION}
     hostname: kms
     dns_search: .
     ports:
diff --git a/hadoop-ozone/dist/src/main/compose/testlib.sh 
b/hadoop-ozone/dist/src/main/compose/testlib.sh
index 74acbd793cd..69a000fff58 100755
--- a/hadoop-ozone/dist/src/main/compose/testlib.sh
+++ b/hadoop-ozone/dist/src/main/compose/testlib.sh
@@ -27,6 +27,7 @@ RESULT_DIR=${RESULT_DIR:-"$COMPOSE_DIR/result"}
 source ${_testlib_dir}/compose_v2_compatibility.sh
 source "${_testlib_dir}/../smoketest/testlib.sh"
 
+: ${DOWNLOAD_DIR:="${HOME}/.cache/ozone"}
 : ${OZONE_COMPOSE_RUNNING:=false}
 : "${OZONE_VOLUME_OWNER:=}"
 : ${SECURITY_ENABLED:=false}
@@ -46,6 +47,14 @@ if _is_build; then
   # version is used in bucket name, which does not allow uppercase
   # variable is replaced by Maven at build time
   OZONE_CURRENT_VERSION="$(echo "${ozone.version}" | sed -e 's/-SNAPSHOT//' | 
tr '[:upper:]' '[:lower:]')"
+
+  if [[ -z ${HADOOP_VERSION:-} ]]; then
+    export HADOOP_VERSION="${hadoop.version}"
+  fi
+
+  if [[ -z "${RANGER_VERSION:-}" ]]; then
+    export RANGER_VERSION="${ranger.version}"
+  fi
 else
   OZONE_CURRENT_VERSION=src
 fi
@@ -696,23 +705,83 @@ download_if_not_exists() {
 
   if [[ -e "${f}" ]]; then
     echo "${f} already downloaded"
-  else
-    echo "Downloading ${f} from ${url}"
-    curl --fail --location --output "${f}" --show-error --silent "${url}" || 
rm -fv "${f}"
+  elif ! download_with_retry "${url}" "${f}"; then
+    rm -fv "${f}"
+    return 1
   fi
 }
 
-download_and_verify_apache_release() {
+import_keys() {
+  local url="$1"
+
+  keys=$(mktemp)
+  download_with_retry "$url" "$keys"
+  gpg --import "$keys"
+  rm -f "$keys"
+}
+
+verify_apache_release() {
+  # paths of the file to verify
   local remote_path="$1"
+  local local_path="$2"
+
+  if [[ "${SKIP_APACHE_VERIFY_DOWNLOAD}" == "true" ]]; then
+    return
+  fi
 
-  local f="$(basename "${remote_path}")"
-  local 
base_url="${APACHE_MIRROR_URL:-https://www.apache.org/dyn/closer.lua?action=download&filename=}";
   local 
checksum_base_url="${APACHE_OFFICIAL_URL:-https://downloads.apache.org/}";
-  local download_dir="${DOWNLOAD_DIR:-/tmp}"
 
-  download_if_not_exists "${base_url}${remote_path}" "${download_dir}/${f}"
-  if [[ "${SKIP_APACHE_VERIFY_DOWNLOAD}" != "true" ]]; then
-    download_if_not_exists "${checksum_base_url}${remote_path}.asc"  
"${download_dir}/${f}.asc"
-    gpg --verify "${download_dir}/${f}.asc" "${download_dir}/${f}" || exit 1
+  if download_if_not_exists "${checksum_base_url}${remote_path}.asc" 
"${local_path}.asc" \
+    && gpg --verify "${local_path}.asc" "${local_path}"; then
+    return 0
   fi
+
+  rm -fv "${local_path}.asc" "${local_path}"
+  return 1
+}
+
+download_and_verify_apache_release() {
+  local remote_path="$1"
+
+  local local_path="${DOWNLOAD_DIR}/$(basename "${remote_path}")"
+  local 
base_url="${APACHE_MIRROR_URL:-https://www.apache.org/dyn/closer.lua?action=download&filename=}";
+
+  download_if_not_exists "${base_url}${remote_path}" "${local_path}" >&2 \
+    && verify_apache_release "${remote_path}" "${local_path}" >&2 \
+    && echo "${local_path}"
+}
+
+# retry at two levels:
+# 1. curl --retry 3
+# 2. re-run curl 3x
+download_with_retry() {
+  local url=$1
+  local output=$2
+
+  local rc=1
+
+  mkdir -p "$(dirname "${output}")"
+
+  for i in {1..3}; do
+    echo "Downloading ${output} from ${url}, attempt ${i}"
+    if curl --connect-timeout 10 --continue-at - --fail --location -o 
"${output}" --retry 3 --show-error --silent "${url}"; then
+      rc=0
+      break
+    fi
+    sleep 2
+  done
+
+  return ${rc}
+}
+
+download_hadoop() {
+  download_and_verify_apache_release 
"hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}-src.tar.gz"
+}
+
+download_ranger() {
+  download_and_verify_apache_release 
"ranger/${RANGER_VERSION}/apache-ranger-${RANGER_VERSION}.tar.gz"
+}
+
+download_ranger_ozone_plugin() {
+  download_and_verify_apache_release 
"ranger/${RANGER_VERSION}/plugins/ozone/ranger-${RANGER_VERSION}-ozone-plugin.tar.gz"
 }
diff --git a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/.env 
b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/.env
index d7c817854ba..793575ba464 100644
--- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/.env
+++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/.env
@@ -15,7 +15,7 @@
 # limitations under the License.
 
 HADOOP_IMAGE=${docker.hadoop.image}
-HADOOP_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
+HADOOP_IMAGE_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
 HDDS_VERSION=${hdds.version}
 OZONE_RUNNER_VERSION=${docker.ozone-runner.version}
 OZONE_RUNNER_IMAGE=apache/ozone-runner
diff --git 
a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml 
b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml
index 1d2bd99da33..edff75ebb54 100644
--- a/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml
+++ b/hadoop-ozone/dist/src/main/compose/upgrade/compose/ha/docker-compose.yaml
@@ -102,7 +102,7 @@ services:
       - docker-config
     environment:
       HADOOP_CONF_DIR: /opt/hadoop/etc/hadoop
-    image: ${HADOOP_IMAGE}:${HADOOP_VERSION}
+    image: ${HADOOP_IMAGE}:${HADOOP_IMAGE_VERSION}
     networks:
       net:
         ipv4_address: 10.9.0.3
diff --git a/hadoop-ozone/dist/src/main/compose/xcompat/.env 
b/hadoop-ozone/dist/src/main/compose/xcompat/.env
index 1616f0e06fe..a5692cb810e 100644
--- a/hadoop-ozone/dist/src/main/compose/xcompat/.env
+++ b/hadoop-ozone/dist/src/main/compose/xcompat/.env
@@ -20,7 +20,7 @@ OZONE_RUNNER_IMAGE=apache/ozone-runner
 OZONE_RUNNER_CLIENT_VERSION=${docker.ozone-runner.client.version}
 OZONE_RUNNER_CLIENT_IMAGE=${OZONE_RUNNER_IMAGE}
 HADOOP_IMAGE=${docker.hadoop.image}
-HADOOP_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
+HADOOP_IMAGE_VERSION=${hadoop.version}${docker.hadoop.image.flavor}
 OZONE_TESTKRB5_IMAGE=${docker.ozone-testkr5b.image}
 OZONE_IMAGE=${docker.ozone.image}
 OZONE_IMAGE_FLAVOR="${docker.ozone.image.flavor}"
diff --git a/hadoop-ozone/dist/src/main/compose/xcompat/new-cluster.yaml 
b/hadoop-ozone/dist/src/main/compose/xcompat/new-cluster.yaml
index 85d6f158f0a..20c71f7eb46 100644
--- a/hadoop-ozone/dist/src/main/compose/xcompat/new-cluster.yaml
+++ b/hadoop-ozone/dist/src/main/compose/xcompat/new-cluster.yaml
@@ -39,7 +39,7 @@ services:
       - ../_keytabs:/etc/security/keytabs
     command: ["/opt/hadoop/compose/common/init-kdc.sh"]
   kms:
-    image: ${HADOOP_IMAGE}:${HADOOP_VERSION}
+    image: ${HADOOP_IMAGE}:${HADOOP_IMAGE_VERSION}
     hostname: kms
     dns_search: .
     ports:
diff --git a/hadoop-ozone/dist/src/main/compose/xcompat/old-cluster.yaml 
b/hadoop-ozone/dist/src/main/compose/xcompat/old-cluster.yaml
index c23b3133c8b..fa828df9b6d 100644
--- a/hadoop-ozone/dist/src/main/compose/xcompat/old-cluster.yaml
+++ b/hadoop-ozone/dist/src/main/compose/xcompat/old-cluster.yaml
@@ -39,7 +39,7 @@ services:
       - ../_keytabs:/etc/security/keytabs
     command: ["/opt/ozone/compose/common/init-kdc.sh"]
   kms:
-    image: ${HADOOP_IMAGE}:${HADOOP_VERSION}
+    image: ${HADOOP_IMAGE}:${HADOOP_IMAGE_VERSION}
     hostname: kms
     dns_search: .
     ports:
diff --git a/hadoop-ozone/dist/src/test/shell/compose_testlib.bats 
b/hadoop-ozone/dist/src/test/shell/compose_testlib.bats
deleted file mode 100644
index 285eac49d73..00000000000
--- a/hadoop-ozone/dist/src/test/shell/compose_testlib.bats
+++ /dev/null
@@ -1,50 +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.
-
-
-load ../../main/compose/testlib.sh
-@test "Find test recursive, only on one level" {
-  cd $BATS_TEST_DIRNAME
-  result=$(all_tests_in_immediate_child_dirs | xargs)
-  [[ "$result" == "failing1/test.sh test1/test.sh test2/test.sh test4/test.sh" 
]]
-}
-
-@test "Find tests without explicit filter" {
-  cd $BATS_TEST_DIRNAME
-  run find_tests
-  [[ "$output" == "test1/test.sh test2/test.sh test4/test.sh" ]]
-}
-
-@test "Find test by suite" {
-  OZONE_ACCEPTANCE_SUITE=one
-  cd $BATS_TEST_DIRNAME
-  run find_tests
-  [[ "$output" == "test4/test.sh" ]]
-}
-
-@test "Find failing test suite explicitly" {
-  OZONE_ACCEPTANCE_SUITE=failing
-  cd $BATS_TEST_DIRNAME
-  run find_tests
-  [[ "$output" == "failing1/test.sh" ]]
-}
-
-@test "Find test default suite" {
-  OZONE_ACCEPTANCE_SUITE=misc
-  cd $BATS_TEST_DIRNAME
-  run find_tests
-  [[ "$output" == "test1/test.sh test2/test.sh" ]]
-}
diff --git a/hadoop-ozone/dist/src/test/shell/failing1/test.sh 
b/hadoop-ozone/dist/src/test/shell/failing1/test.sh
deleted file mode 100644
index 76bff5583ee..00000000000
--- a/hadoop-ozone/dist/src/test/shell/failing1/test.sh
+++ /dev/null
@@ -1,17 +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.
-
-#suite:failing
diff --git a/hadoop-ozone/dist/src/test/shell/test1/test.sh 
b/hadoop-ozone/dist/src/test/shell/test1/test.sh
deleted file mode 100644
index b13ca90d239..00000000000
--- a/hadoop-ozone/dist/src/test/shell/test1/test.sh
+++ /dev/null
@@ -1,15 +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.
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/test/shell/test2/test.sh 
b/hadoop-ozone/dist/src/test/shell/test2/test.sh
deleted file mode 100644
index 8dbf5b29721..00000000000
--- a/hadoop-ozone/dist/src/test/shell/test2/test.sh
+++ /dev/null
@@ -1,17 +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.
-
-#suite:misc
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh 
b/hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh
deleted file mode 100644
index 8dbf5b29721..00000000000
--- a/hadoop-ozone/dist/src/test/shell/test3/subtest1/test.sh
+++ /dev/null
@@ -1,17 +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.
-
-#suite:misc
\ No newline at end of file
diff --git a/hadoop-ozone/dist/src/test/shell/test4/test.sh 
b/hadoop-ozone/dist/src/test/shell/test4/test.sh
deleted file mode 100644
index accc445711e..00000000000
--- a/hadoop-ozone/dist/src/test/shell/test4/test.sh
+++ /dev/null
@@ -1,17 +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.
-
-#suite:one
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to