Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFRA-37285: Handle errors when fetching constants #192

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions modules/opa/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## OPA (open-policy-agent) helpers
OPA_POLICY_BRANCH?=main
OPA_POLICY_DIR=/tmp/opa-policy-=$(OPA_POLICY_BRANCH)
OPA_POLICY_DIR=/tmp/opa-policy-$(OPA_POLICY_BRANCH)
OPA_POLICY_SUBDIR?=opa/kubernetes
MANIFEST_DIRS:=$(shell find rendered/ -type d -name manifests 2>/dev/null)
CONSTANTS_APPS_FILE := $(shell mktemp -p /tmp applications.XXXXX.yaml)
Expand Down Expand Up @@ -30,7 +30,7 @@ opa/fetch-constants:
ifndef CONSTANTS_URL
$(error CONSTANTS_URL is undefined)
endif
@curl -s $(CONSTANTS_URL)/applications.json | yq '{"applications": .}' > $(CONSTANTS_APPS_FILE)
@curl --retry 5 --retry-all-errors --fail -s -o $(CONSTANTS_APPS_FILE).curl $(CONSTANTS_URL)/applications.json && yq '{"applications": .}' $(CONSTANTS_APPS_FILE).curl > $(CONSTANTS_APPS_FILE)

## Validate manifests
opa/conftest: satoshi/check-deps opa/clone-policy opa/fetch-constants
Expand All @@ -44,6 +44,7 @@ opa/conftest: satoshi/check-deps opa/clone-policy opa/fetch-constants
fi ;\
done ;\
rm -f $(CONSTANTS_APPS_FILE) ;\
rm -f $(CONSTANTS_APPS_FILE).curl ;\
if [ "$${errs:-0}" -gt 0 ]; then \
exit 1; \
fi
Loading