diff --git a/.github/workflows/release-3-build-and-publish-artifacts.yml b/.github/workflows/release-3-build-and-publish-artifacts.yml index 9ec2f85c03..67e59ef716 100644 --- a/.github/workflows/release-3-build-and-publish-artifacts.yml +++ b/.github/workflows/release-3-build-and-publish-artifacts.yml @@ -181,7 +181,9 @@ jobs: source "${LIBS_DIR}/_exec.sh" dist_dev_dir=${RELEASEY_DIR}/polaris-dist-dev - exec_process svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${APACHE_DIST_URL}${APACHE_DIST_PATH}" "${dist_dev_dir}" + + # Retry logic for SVN checkout (Apache SVN can have transient connectivity issues) + exec_process_with_retries 5 60 "${dist_dev_dir}" svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${APACHE_DIST_URL}${APACHE_DIST_PATH}" "${dist_dev_dir}" version_dir="${dist_dev_dir}/${version_without_rc}" exec_process mkdir -p "${version_dir}" @@ -393,7 +395,9 @@ jobs: source "${LIBS_DIR}/_exec.sh" dist_dev_dir=${RELEASEY_DIR}/polaris-dist-dev - exec_process svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${APACHE_DIST_URL}${APACHE_DIST_PATH}" "${dist_dev_dir}" + + # Retry logic for SVN checkout (Apache SVN can have transient connectivity issues) + exec_process_with_retries 5 60 "${dist_dev_dir}" svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${APACHE_DIST_URL}${APACHE_DIST_PATH}" "${dist_dev_dir}" exec_process mkdir -p "${dist_dev_dir}/helm-chart/${version_without_rc}" exec_process cp helm/polaris-${version_without_rc}.tgz* "${dist_dev_dir}/helm-chart/${version_without_rc}/" diff --git a/.github/workflows/release-4-publish-release.yml b/.github/workflows/release-4-publish-release.yml index 6048af1049..b47d1e9f34 100644 --- a/.github/workflows/release-4-publish-release.yml +++ b/.github/workflows/release-4-publish-release.yml @@ -226,7 +226,8 @@ jobs: release_helm_dir="${RELEASEY_DIR}/polaris-dist-release-helm-chart" release_helm_url="${APACHE_DIST_URL}/release/incubator/polaris/helm-chart" - exec_process svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${release_helm_url}" "${release_helm_dir}" + # Retry logic for SVN checkout (Apache SVN can have transient connectivity issues) + exec_process_with_retries 5 60 "${release_helm_dir}" svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "${release_helm_url}" "${release_helm_dir}" exec_process cd "${release_helm_dir}" exec_process helm repo index . diff --git a/releasey/libs/_exec.sh b/releasey/libs/_exec.sh index ae83c3fad8..3fd0e48b6b 100644 --- a/releasey/libs/_exec.sh +++ b/releasey/libs/_exec.sh @@ -32,6 +32,42 @@ function exec_process { fi } +# Executes a command with retry logic +# Args: +# $1: max_attempts - Maximum number of retry attempts +# $2: sleep_duration - Seconds to wait between retries +# $3: cleanup_path - Path to clean up before retrying (can be empty) +# $@: Command and arguments to execute +function exec_process_with_retries { + if [[ $# -lt 4 ]]; then + echo "ERROR: exec_process_with_retries requires: max_attempts sleep_duration cleanup_path command [args...]" + exit 1 + fi + + local max_attempts="${1}" + local sleep_duration="${2}" + local cleanup_path="${3}" + shift 3 + + local attempt=1 + while true; do + if exec_process "$@"; then + break + fi + if [[ $attempt -ge $max_attempts ]]; then + echo "ERROR: Command failed after ${max_attempts} attempts: ${*}" + exit 1 + fi + echo "WARNING: Command failed (attempt ${attempt}/${max_attempts}), retrying in ${sleep_duration} seconds..." + # Clean up any partial state before retrying + if [[ -n "${cleanup_path}" && -e "${cleanup_path}" ]]; then + rm -rf "${cleanup_path}" + fi + sleep "${sleep_duration}" + ((attempt++)) + done +} + function calculate_sha512 { local source_file="$1" local target_file="${source_file}.sha512"