Skip to content

Commit cbb9bd7

Browse files
authored
Merge pull request #421 from mbaldessari/private-repo-cli
Add support for private repo deployments via CLI
2 parents 9ef16ba + c547ffe commit cbb9bd7

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,18 @@ ifneq ("$(wildcard $(UUID_FILE))","")
2828
UUID_HELM_OPTS := --set main.analyticsUUID=$(UUID)
2929
endif
3030

31-
HELM_OPTS=-f values-global.yaml --set main.git.repoURL="$(TARGET_REPO)" --set main.git.revision=$(TARGET_BRANCH) $(TARGET_SITE_OPT) $(UUID_HELM_OPTS) $(EXTRA_HELM_OPTS)
31+
# Set the secret name *and* its namespace when deploying from private repositories
32+
# The format of said secret is documented here: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories
33+
TOKEN_SECRET ?=
34+
TOKEN_NAMESPACE ?=
35+
36+
ifeq ($(TOKEN_SECRET),)
37+
HELM_OPTS=-f values-global.yaml --set main.git.repoURL="$(TARGET_REPO)" --set main.git.revision=$(TARGET_BRANCH) $(TARGET_SITE_OPT) $(UUID_HELM_OPTS) $(EXTRA_HELM_OPTS)
38+
else
39+
# When we are working with a private repository we do not escape the git URL as it might be using an ssh secret which does not use https://
40+
TARGET_CLEAN_REPO=$(shell git ls-remote --get-url --symref $(TARGET_ORIGIN))
41+
HELM_OPTS=-f values-global.yaml --set main.tokenSecret=$(TOKEN_SECRET) --set main.tokenSecretNamespace=$(TOKEN_NAMESPACE) --set main.git.repoURL="$(TARGET_CLEAN_REPO)" --set main.git.revision=$(TARGET_BRANCH) $(TARGET_SITE_OPT) $(UUID_HELM_OPTS) $(EXTRA_HELM_OPTS)
42+
endif
3243

3344

3445
##@ Pattern Common Tasks

0 commit comments

Comments
 (0)