From 3aa9ed274af45c86649589bbe5e40c3d935bb0b6 Mon Sep 17 00:00:00 2001 From: Jev Forsberg <46619047+baldm0mma@users.noreply.github.com> Date: Thu, 26 Sep 2024 19:46:34 -0600 Subject: [PATCH] [v11.0.x] CI: Update retry_command function (#93868) * CI: Update retry_command function (#93863) * baldm0mma/update args * baldm0mma/update_args/ conflict (cherry picked from commit b17b98aeb97afe8c40c7863900666205bd60a329) * make drone --- .drone.yml | 18 +++++++++--------- scripts/drone/steps/lib.star | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9b3f9d21aef..dce95b0ec88 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3139,14 +3139,14 @@ steps: - echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | tee -a /etc/apt/sources.list.d/grafana.list - 'echo "Step 5: Installing Grafana..."' - - for i in $(seq 1 10); do + - for i in $(seq 1 60); do - ' if apt-get update >/dev/null 2>&1 && DEBIAN_FRONTEND=noninteractive apt-get install -yq grafana=${TAG} >/dev/null 2>&1; then' - ' echo "Command succeeded on attempt $i"' - ' break' - ' else' - ' echo "Attempt $i failed"' - - ' if [ $i -eq 10 ]; then' + - ' if [ $i -eq 60 ]; then' - ' echo ''All attempts failed''' - ' exit 1' - ' fi' @@ -3189,13 +3189,13 @@ steps: - dnf list available grafana-${TAG} - if [ $? -eq 0 ]; then - ' echo "Grafana package found in repository. Installing from repo..."' - - for i in $(seq 1 5); do + - for i in $(seq 1 60); do - ' if dnf install -y --nogpgcheck grafana-${TAG} >/dev/null 2>&1; then' - ' echo "Command succeeded on attempt $i"' - ' break' - ' else' - ' echo "Attempt $i failed"' - - ' if [ $i -eq 5 ]; then' + - ' if [ $i -eq 60 ]; then' - ' echo ''All attempts failed''' - ' exit 1' - ' fi' @@ -3316,14 +3316,14 @@ steps: - echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | tee -a /etc/apt/sources.list.d/grafana.list - 'echo "Step 5: Installing Grafana..."' - - for i in $(seq 1 10); do + - for i in $(seq 1 60); do - ' if apt-get update >/dev/null 2>&1 && DEBIAN_FRONTEND=noninteractive apt-get install -yq grafana=${TAG} >/dev/null 2>&1; then' - ' echo "Command succeeded on attempt $i"' - ' break' - ' else' - ' echo "Attempt $i failed"' - - ' if [ $i -eq 10 ]; then' + - ' if [ $i -eq 60 ]; then' - ' echo ''All attempts failed''' - ' exit 1' - ' fi' @@ -3367,13 +3367,13 @@ steps: - dnf list available grafana-${TAG} - if [ $? -eq 0 ]; then - ' echo "Grafana package found in repository. Installing from repo..."' - - for i in $(seq 1 5); do + - for i in $(seq 1 60); do - ' if dnf install -y --nogpgcheck grafana-${TAG} >/dev/null 2>&1; then' - ' echo "Command succeeded on attempt $i"' - ' break' - ' else' - ' echo "Attempt $i failed"' - - ' if [ $i -eq 5 ]; then' + - ' if [ $i -eq 60 ]; then' - ' echo ''All attempts failed''' - ' exit 1' - ' fi' @@ -5381,6 +5381,6 @@ kind: secret name: gcr_credentials --- kind: signature -hmac: 680e9d206fb0ff5105e5d502792c5c52ece094dfc878e46846698460656e0136 +hmac: 3011105defeedef16426438d9d6d004dbcdc433f953b13d5534b5648b0590ded ... diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 213865b8c28..c74c321e028 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -1261,7 +1261,7 @@ def verify_linux_DEB_packages_step(depends_on = []): 'echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | tee -a /etc/apt/sources.list.d/grafana.list', 'echo "Step 5: Installing Grafana..."', # The packages take a bit of time to propogate within the repo. This retry will check their availability within 10 minutes. - ] + retry_command(install_command, attempts = 10) + [ + ] + retry_command(install_command) + [ 'echo "Step 6: Verifying Grafana installation..."', 'if dpkg -s grafana | grep -q "Version: ${TAG}"; then', ' echo "Successfully verified Grafana version ${TAG}"', @@ -1287,7 +1287,7 @@ def verify_linux_RPM_packages_step(depends_on = []): "sslcacert=/etc/pki/tls/certs/ca-bundle.crt\n" ) - repo_install_command = "dnf install -y --nogpgcheck grafana-${TAG} >/dev/null 2>&1" + install_command = "dnf install -y --nogpgcheck grafana-${TAG} >/dev/null 2>&1" return { "name": "verify-linux-RPM-packages", @@ -1306,7 +1306,7 @@ def verify_linux_RPM_packages_step(depends_on = []): "dnf list available grafana-${TAG}", "if [ $? -eq 0 ]; then", ' echo "Grafana package found in repository. Installing from repo..."', - ] + retry_command(repo_install_command, attempts = 5) + [ + ] + retry_command(install_command) + [ ' echo "Verifying GPG key..."', " rpm --import https://rpm.grafana.com/gpg.key", " rpm -qa gpg-pubkey* | xargs rpm -qi | grep -i grafana",