From e5c8d55530e4969716684465bfc90906fc572ea9 Mon Sep 17 00:00:00 2001 From: MichaelFisher1997 Date: Sun, 3 May 2026 07:24:31 +0000 Subject: [PATCH] fix: retry observability oci chart fetches --- .gitea/workflows/deploy.yml | 23 ++++++++++++------- .../observability/ocirepository-loki.yaml | 1 + .../observability/ocirepository-promtail.yaml | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 5f70379..8d03e12 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -967,17 +967,24 @@ jobs: wait_for_ocirepository_ready_or_cached() { local repository="$1" local timeout="$2" + local attempts="${3:-6}" local artifact_storage + local attempt - if kubectl -n flux-system wait --for=condition=Ready "ocirepository/${repository}" --timeout="${timeout}"; then - return 0 - fi + for attempt in $(seq 1 "${attempts}"); do + reconcile_flux_resource "ocirepository/${repository}" 300 + if kubectl -n flux-system wait --for=condition=Ready "ocirepository/${repository}" --timeout="${timeout}"; then + return 0 + fi - artifact_storage="$(kubectl -n flux-system get "ocirepository/${repository}" -o jsonpath='{.status.conditions[?(@.type=="ArtifactInStorage")].status}' 2>/dev/null || true)" - if [ "${artifact_storage}" = "True" ]; then - echo "OCIRepository ${repository} is not currently Ready; continuing with cached artifact" >&2 - return 0 - fi + artifact_storage="$(kubectl -n flux-system get "ocirepository/${repository}" -o jsonpath='{.status.conditions[?(@.type=="ArtifactInStorage")].status}' 2>/dev/null || true)" + if [ "${artifact_storage}" = "True" ]; then + echo "OCIRepository ${repository} is not currently Ready; continuing with cached artifact" >&2 + return 0 + fi + + echo "OCIRepository ${repository} did not become Ready after ${timeout}; forcing retry (${attempt}/${attempts})" >&2 + done observability_diagnostics exit 1 diff --git a/infrastructure/addons/observability/ocirepository-loki.yaml b/infrastructure/addons/observability/ocirepository-loki.yaml index 6a9bd98..96e7b2e 100644 --- a/infrastructure/addons/observability/ocirepository-loki.yaml +++ b/infrastructure/addons/observability/ocirepository-loki.yaml @@ -5,6 +5,7 @@ metadata: namespace: flux-system spec: interval: 10m + timeout: 5m url: oci://ghcr.io/grafana/helm-charts/loki ref: tag: 6.46.0 diff --git a/infrastructure/addons/observability/ocirepository-promtail.yaml b/infrastructure/addons/observability/ocirepository-promtail.yaml index 064100c..1fb35f6 100644 --- a/infrastructure/addons/observability/ocirepository-promtail.yaml +++ b/infrastructure/addons/observability/ocirepository-promtail.yaml @@ -5,6 +5,7 @@ metadata: namespace: flux-system spec: interval: 10m + timeout: 5m url: oci://ghcr.io/grafana/helm-charts/promtail ref: tag: 6.16.6