From 454956ba40ee2bbfa832f9c6b0331b7b2ac2ea9c Mon Sep 17 00:00:00 2001 From: Vincent SELLIER <vincent.sellier@softwareheritage.org> Date: Mon, 26 Aug 2024 17:25:12 +0200 Subject: [PATCH] swh/counters: Avoid refresh_history cronjob infinite retries - Use the retry command line - Split the rpc checks from the refresh endpoint call - Fix a couple of minor side issues Related to swh/infra/sysadm-environment#5387 --- .../counters/refresh-counters-cache-cronjob.yaml | 3 ++- swh/templates/counters/script-utils.yaml | 15 +++++++-------- values-swh-application-versions.yaml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/swh/templates/counters/refresh-counters-cache-cronjob.yaml b/swh/templates/counters/refresh-counters-cache-cronjob.yaml index 2b4053331..1cd62eede 100644 --- a/swh/templates/counters/refresh-counters-cache-cronjob.yaml +++ b/swh/templates/counters/refresh-counters-cache-cronjob.yaml @@ -4,6 +4,7 @@ apiVersion: batch/v1 kind: CronJob metadata: + namespace: {{ $.Values.namespace }} name: counters-refresh-counters-cache-cronjob spec: # By default, every 4h @@ -92,7 +93,7 @@ spec: items: - key: "refresh-counters-cache.sh" path: "refresh-counters-cache.sh" - restartPolicy: OnFailure + restartPolicy: Never {{- end -}} {{- end -}} diff --git a/swh/templates/counters/script-utils.yaml b/swh/templates/counters/script-utils.yaml index f84c81440..7a91e01b8 100644 --- a/swh/templates/counters/script-utils.yaml +++ b/swh/templates/counters/script-utils.yaml @@ -34,14 +34,13 @@ data: } EOF - # This waits for the rpc to be up - while true; do - sleep 1 - set +e - curl -f -v -XPOST -H 'Content-Type: application/json' $host/refresh_history -d @"${tmp_file}" - [[ $? -ne 0 ]] || break - set -e - done + echo Wait 60s for the ${host} rpc service + retry -t 6 -d 10 -- curl -f -s ${host} + echo "${host} is up" + + echo "Refreshing the counters history" + curl -f -v -XPOST -H 'Content-Type: application/json' $host/refresh_history -d @"${tmp_file}" + echo "Done" fetch-static-history.sh: | #!/bin/bash diff --git a/values-swh-application-versions.yaml b/values-swh-application-versions.yaml index d27459632..a4b04b802 100644 --- a/values-swh-application-versions.yaml +++ b/values-swh-application-versions.yaml @@ -5,7 +5,7 @@ software_stories_image_version: '20230912.1' swh_alter_image: container-registry.softwareheritage.org/swh/infra/swh-apps/alter swh_alter_image_version: '20240820.1' swh_counters_image: container-registry.softwareheritage.org/swh/infra/swh-apps/counters -swh_counters_image_version: '20240814.1' +swh_counters_image_version: '20240826.1' swh_deposit_checkers_image: container-registry.softwareheritage.org/swh/infra/swh-apps/deposit_checkers swh_deposit_checkers_image_version: '20240813.1' swh_deposit_image: container-registry.softwareheritage.org/swh/infra/swh-apps/deposit -- GitLab