From a1a602aa4423ec12ddba5e97b966543707fc2536 Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Mon, 14 Sep 2026 13:13:37 +0000 Subject: [PATCH 1/3] APMSP-3973 Retry Docker SSI Agent install Co-authored-by: nccatoni <222672590+nccatoni@users.noreply.github.com> --- utils/build/ssi/base/download_with_retry.sh | 23 +++++++++++++++++++ utils/build/ssi/base/install_script_ssi.sh | 8 ++++++- .../ssi/base/install_script_ssi_installer.sh | 7 +++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/utils/build/ssi/base/download_with_retry.sh b/utils/build/ssi/base/download_with_retry.sh index c06e6249595..6c506dace0d 100644 --- a/utils/build/ssi/base/download_with_retry.sh +++ b/utils/build/ssi/base/download_with_retry.sh @@ -18,3 +18,26 @@ download_with_retry() { echo "[ERROR] ${output} is missing or empty after ${max_attempts} attempts" >&2 return 1 } + +run_with_retry() { + local description="$1" + shift + + local max_attempts=3 + local retry_delay=5 + local attempt + for (( attempt = 1; attempt <= max_attempts; attempt++ )); do + echo "[TRACE] running ${description} (attempt ${attempt}/${max_attempts})" + if "$@"; then + return 0 + fi + + if (( attempt < max_attempts )); then + echo "[WARN] ${description} failed; retrying in ${retry_delay} seconds" >&2 + sleep "$retry_delay" + fi + done + + echo "[ERROR] ${description} failed after ${max_attempts} attempts" >&2 + return 1 +} diff --git a/utils/build/ssi/base/install_script_ssi.sh b/utils/build/ssi/base/install_script_ssi.sh index 1bac8e44551..85177432141 100755 --- a/utils/build/ssi/base/install_script_ssi.sh +++ b/utils/build/ssi/base/install_script_ssi.sh @@ -54,7 +54,13 @@ if [ ! -s "install_script_agent7.sh" ]; then exit 1 fi -DD_REPO_URL=${DD_injection_repo_url} DD_INSTALL_ONLY=true DD_APM_INSTRUMENTATION_ENABLED=host bash ./install_script_agent7.sh +run_with_retry \ + "Datadog Agent installer" \ + env \ + "DD_REPO_URL=${DD_injection_repo_url}" \ + DD_INSTALL_ONLY=true \ + DD_APM_INSTRUMENTATION_ENABLED=host \ + bash ./install_script_agent7.sh || exit 1 if [ -f /etc/debian_version ] || [ "$DISTRIBUTION" == "Debian" ] || [ "$DISTRIBUTION" == "Ubuntu" ]; then OS="Debian" diff --git a/utils/build/ssi/base/install_script_ssi_installer.sh b/utils/build/ssi/base/install_script_ssi_installer.sh index 336bda6ede2..cdd2081302b 100755 --- a/utils/build/ssi/base/install_script_ssi_installer.sh +++ b/utils/build/ssi/base/install_script_ssi_installer.sh @@ -5,4 +5,9 @@ source ./download_with_retry.sh download_with_retry https://dd-agent.s3.amazonaws.com/scripts/install_script_agent7.sh || exit 1 -DD_INSTALL_ONLY=true DD_INSTALLER=true bash ./install_script_agent7.sh +run_with_retry \ + "Datadog Agent installer" \ + env \ + DD_INSTALL_ONLY=true \ + DD_INSTALLER=true \ + bash ./install_script_agent7.sh || exit 1 From 98d4eff332df0342a57aa192628abcf5fb18c65c Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Mon, 14 Sep 2026 13:25:39 +0000 Subject: [PATCH 2/3] APMSP-3973 Factorize retry helpers Co-authored-by: nccatoni <222672590+nccatoni@users.noreply.github.com> --- utils/build/ssi/base/download_with_retry.sh | 45 ++++++++++--------- utils/build/ssi/base/install_script_ssi.sh | 2 + .../ssi/base/install_script_ssi_installer.sh | 2 + 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/utils/build/ssi/base/download_with_retry.sh b/utils/build/ssi/base/download_with_retry.sh index 6c506dace0d..a9a9e7dc680 100644 --- a/utils/build/ssi/base/download_with_retry.sh +++ b/utils/build/ssi/base/download_with_retry.sh @@ -1,30 +1,11 @@ #!/bin/bash -download_with_retry() { - local url="$1" - local output - output="$(basename "$url")" - - local max_attempts=5 - local attempt - for (( attempt = 1; attempt <= max_attempts; attempt++ )); do - echo "[TRACE] downloading ${output} (attempt ${attempt}/${max_attempts})" - if curl --fail --retry 3 -sSL -o "$output" "$url" && [ -s "$output" ]; then - return 0 - fi - rm -f "$output" - done - - echo "[ERROR] ${output} is missing or empty after ${max_attempts} attempts" >&2 - return 1 -} - run_with_retry() { local description="$1" - shift + local max_attempts="$2" + local retry_delay="$3" + shift 3 - local max_attempts=3 - local retry_delay=5 local attempt for (( attempt = 1; attempt <= max_attempts; attempt++ )); do echo "[TRACE] running ${description} (attempt ${attempt}/${max_attempts})" @@ -41,3 +22,23 @@ run_with_retry() { echo "[ERROR] ${description} failed after ${max_attempts} attempts" >&2 return 1 } + +_download_once() { + local url="$1" + local output="$2" + + if curl --fail --retry 3 -sSL -o "$output" "$url" && [ -s "$output" ]; then + return 0 + fi + + rm -f "$output" + return 1 +} + +download_with_retry() { + local url="$1" + local output + output="$(basename "$url")" + + run_with_retry "download ${output}" 5 0 _download_once "$url" "$output" +} diff --git a/utils/build/ssi/base/install_script_ssi.sh b/utils/build/ssi/base/install_script_ssi.sh index 85177432141..5f1ba9f4864 100755 --- a/utils/build/ssi/base/install_script_ssi.sh +++ b/utils/build/ssi/base/install_script_ssi.sh @@ -56,6 +56,8 @@ fi run_with_retry \ "Datadog Agent installer" \ + 3 \ + 5 \ env \ "DD_REPO_URL=${DD_injection_repo_url}" \ DD_INSTALL_ONLY=true \ diff --git a/utils/build/ssi/base/install_script_ssi_installer.sh b/utils/build/ssi/base/install_script_ssi_installer.sh index cdd2081302b..3d823f72150 100755 --- a/utils/build/ssi/base/install_script_ssi_installer.sh +++ b/utils/build/ssi/base/install_script_ssi_installer.sh @@ -7,6 +7,8 @@ download_with_retry https://dd-agent.s3.amazonaws.com/scripts/install_script_age run_with_retry \ "Datadog Agent installer" \ + 3 \ + 5 \ env \ DD_INSTALL_ONLY=true \ DD_INSTALLER=true \ From d012eebbfbe7f2eb5529b93e058f285aee45a821 Mon Sep 17 00:00:00 2001 From: datadog-bits <263423550+datadog-bits@users.noreply.github.com> Date: Mon, 14 Sep 2026 13:30:36 +0000 Subject: [PATCH 3/3] APMSP-3973 Make installer failure explicit Co-authored-by: nccatoni <222672590+nccatoni@users.noreply.github.com> --- utils/build/ssi/base/install_script_ssi.sh | 7 +++++-- utils/build/ssi/base/install_script_ssi_installer.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/build/ssi/base/install_script_ssi.sh b/utils/build/ssi/base/install_script_ssi.sh index 5f1ba9f4864..71f239d0526 100755 --- a/utils/build/ssi/base/install_script_ssi.sh +++ b/utils/build/ssi/base/install_script_ssi.sh @@ -54,7 +54,7 @@ if [ ! -s "install_script_agent7.sh" ]; then exit 1 fi -run_with_retry \ +if ! run_with_retry \ "Datadog Agent installer" \ 3 \ 5 \ @@ -62,7 +62,10 @@ run_with_retry \ "DD_REPO_URL=${DD_injection_repo_url}" \ DD_INSTALL_ONLY=true \ DD_APM_INSTRUMENTATION_ENABLED=host \ - bash ./install_script_agent7.sh || exit 1 + bash ./install_script_agent7.sh; then + echo "[ERROR] aborting SSI install after Datadog Agent installer failure" >&2 + exit 1 +fi if [ -f /etc/debian_version ] || [ "$DISTRIBUTION" == "Debian" ] || [ "$DISTRIBUTION" == "Ubuntu" ]; then OS="Debian" diff --git a/utils/build/ssi/base/install_script_ssi_installer.sh b/utils/build/ssi/base/install_script_ssi_installer.sh index 3d823f72150..9a2abe30633 100755 --- a/utils/build/ssi/base/install_script_ssi_installer.sh +++ b/utils/build/ssi/base/install_script_ssi_installer.sh @@ -5,11 +5,14 @@ source ./download_with_retry.sh download_with_retry https://dd-agent.s3.amazonaws.com/scripts/install_script_agent7.sh || exit 1 -run_with_retry \ +if ! run_with_retry \ "Datadog Agent installer" \ 3 \ 5 \ env \ DD_INSTALL_ONLY=true \ DD_INSTALLER=true \ - bash ./install_script_agent7.sh || exit 1 + bash ./install_script_agent7.sh; then + echo "[ERROR] aborting SSI install after Datadog Agent installer failure" >&2 + exit 1 +fi