Skip to content

Commit e5dc44f

Browse files
nabadgernickmintel
andauthored
INFRA-42320: Update conftest/opa to pass in backstage-components data (#201)
Co-authored-by: Nick <nbadger@mintel.com>
1 parent 3189597 commit e5dc44f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/opa/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ OPA_POLICY_DIR=/tmp/opa-policy-$(OPA_POLICY_BRANCH)
44
OPA_POLICY_SUBDIR?=opa/kubernetes
55
MANIFEST_DIRS:=$(shell find rendered/ -type d -name manifests 2>/dev/null)
66
CONSTANTS_APPS_FILE := $(shell mktemp -p /tmp applications.XXXXX.yaml)
7+
CONSTANTS_BACKSTAGE_FILE := $(shell mktemp -p /tmp backstage.XXXXX.json)
78

89
.PHONY: opa/check-env opa/clone-policy opa/conftest
910

@@ -31,13 +32,14 @@ ifndef CONSTANTS_URL
3132
$(error CONSTANTS_URL is undefined)
3233
endif
3334
@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)
35+
@curl --retry 5 --retry-all-errors --fail -s -o $(CONSTANTS_BACKSTAGE_FILE).curl $(CONSTANTS_URL)/backstage.json && jq '{"backstage_components": .components.default | keys}' $(CONSTANTS_BACKSTAGE_FILE).curl > $(CONSTANTS_BACKSTAGE_FILE)
3436

3537
## Validate manifests
3638
opa/conftest: satoshi/check-deps opa/clone-policy opa/fetch-constants
3739
@errs=0;
3840
@for dir in $(MANIFEST_DIRS) ; do \
3941
if ! conftest test --output stdout $$dir/*.yaml \
40-
-d ${CONSTANTS_APPS_FILE} \
42+
-d ${CONSTANTS_APPS_FILE} -d ${CONSTANTS_BACKSTAGE_FILE} \
4143
-p $(OPA_POLICY_DIR)/opa/kubernetes/policy/utils.rego \
4244
-p $(OPA_POLICY_DIR)/$(OPA_POLICY_SUBDIR); then \
4345
errs=$$(( $$errs + 1 )); \

0 commit comments

Comments
 (0)