Skip to content

Commit 393cc67

Browse files
authored
Merge pull request #610 from mbaldessari/bettercheck
Improve validate-origin
2 parents 87776c6 + e9f00b1 commit 393cc67

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,22 @@ token-kubeconfig: ## Create a local ~/.kube/config with password (not usually ne
129129

130130
# We only check the remote ssh git branch's existance if we're not running inside a container
131131
# as getting ssh auth working inside a container seems a bit brittle
132+
# If the main repoUpstreamURL field is set, then we need to check against
133+
# that and not target_repo
132134
.PHONY: validate-origin
133135
validate-origin: ## verify the git origin is available
134136
@echo "Checking repository:"
135-
@echo -n " $(TARGET_REPO) - branch '$(TARGET_BRANCH)': "
136-
@git ls-remote --exit-code --heads $(TARGET_REPO) $(TARGET_BRANCH) >/dev/null &&\
137-
echo "OK" || (echo "NOT FOUND"; exit 1)
137+
$(eval UPSTREAMURL := $(shell yq -r '.main.git.repoUpstreamURL // (.main.git.repoUpstreamURL = "")' values-global.yaml))
138+
@if [ -z "$(UPSTREAMURL)" ]; then\
139+
echo -n " $(TARGET_REPO) - branch '$(TARGET_BRANCH)': ";\
140+
git ls-remote --exit-code --heads $(TARGET_REPO) $(TARGET_BRANCH) >/dev/null &&\
141+
echo "OK" || (echo "NOT FOUND"; exit 1);\
142+
else\
143+
echo "Upstream URL set to: $(UPSTREAMURL)";\
144+
echo -n " $(UPSTREAMURL) - branch '$(TARGET_BRANCH)': ";\
145+
git ls-remote --exit-code --heads $(UPSTREAMURL) $(TARGET_BRANCH) >/dev/null &&\
146+
echo "OK" || (echo "NOT FOUND"; exit 1);\
147+
fi
138148

139149
.PHONY: validate-cluster
140150
validate-cluster: ## Do some cluster validations before installing

0 commit comments

Comments
 (0)