From 09bb1c39c1a5b193edae1a36a88b18c24e04e7fa Mon Sep 17 00:00:00 2001 From: Santosh Date: Wed, 20 May 2026 11:49:06 +0530 Subject: [PATCH] ci: retry s3cmd bucket creation in rgw-mutisite test The rgw-multisite job is failing frequently. Observed "connectionRefusedERror: connection Refused" on the s3cmd mb call. It might be happening because CephObjectSTore CR is ready but RGW gateway is not fully accepting TCP connections. This PR wraps s3cmd mb and s3cmd put calls in a retry loop that will attempt each command up to 3 times with a 5 second sleep between attemps. This might help fix the flaky CI test. Signed-off-by: Santosh (cherry picked from commit 2cc51e8eb0805ad2c245c4fb75e2e37af1321289) --- .github/workflows/canary-integration-test.yml | 3 +++ tests/scripts/github-action-helper.sh | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/canary-integration-test.yml b/.github/workflows/canary-integration-test.yml index f45c29fc5..1c909792d 100644 --- a/.github/workflows/canary-integration-test.yml +++ b/.github/workflows/canary-integration-test.yml @@ -1924,6 +1924,9 @@ jobs: run: | tests/scripts/github-action-helper.sh wait_for cephcluster my-cluster rook-ceph tests/scripts/github-action-helper.sh wait_for cephcluster my-cluster rook-ceph-secondary + # wait for the RGW deployments to be ready to serve traffic + kubectl -n rook-ceph wait --for=condition=available deployment/rook-ceph-rgw-multisite-store-a --timeout=300s + kubectl -n rook-ceph-secondary wait --for=condition=available deployment/rook-ceph-rgw-zone-b-multisite-store-a --timeout=300s - name: write an object to one cluster, read from the other shell: bash --noprofile --norc -eo pipefail -x {0} diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index cbea506ca..9aa6400b4 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -610,6 +610,18 @@ function s3cmd() { command timeout 200 s3cmd -v --config=s3cfg --access_key="${S3CMD_ACCESS_KEY}" --secret_key="${S3CMD_SECRET_KEY}" "$@" } +function retry() { + local retries=$1; shift + local attempt + for (( attempt=1; attempt<=retries; attempt++ )); do + if "$@"; then return 0; fi + echo "$* failed (attempt ${attempt}/${retries}), retrying in 5s..." + sleep 5 + done + echo "$* failed after ${retries} attempts" + exit 1 +} + function write_object_read_from_replica_cluster() { local write_cluster_ip=${1?ip address of cluster to write to is required} local read_cluster_ip=${2?ip address of cluster to read from is required} @@ -621,8 +633,8 @@ function write_object_read_from_replica_cluster() { # ensure that test file has unique data echo "$test_object_name" >>"$test_object_name" - s3cmd --host="${write_cluster_ip}" mb "s3://${test_bucket_name}" - s3cmd --host="${write_cluster_ip}" put "$test_object_name" "s3://${test_bucket_name}" + retry 3 s3cmd --host="${write_cluster_ip}" mb "s3://${test_bucket_name}" + retry 3 s3cmd --host="${write_cluster_ip}" put "$test_object_name" "s3://${test_bucket_name}" # Schedule a signal for 60s into the future as a timeout on retrying s3cmd. # This voodoo is to avoid running everything under a new shell started by