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

Automatic common/ update #111

Merged
merged 8 commits into from
Dec 21, 2023
13 changes: 12 additions & 1 deletion common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,18 @@ ifneq ("$(wildcard $(UUID_FILE))","")
UUID_HELM_OPTS := --set main.analyticsUUID=$(UUID)
endif

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)
# Set the secret name *and* its namespace when deploying from private repositories
# The format of said secret is documented here: https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#repositories
TOKEN_SECRET ?=
TOKEN_NAMESPACE ?=

ifeq ($(TOKEN_SECRET),)
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)
else
# 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://
TARGET_CLEAN_REPO=$(shell git ls-remote --get-url --symref $(TARGET_ORIGIN))
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)
endif


##@ Pattern Common Tasks
Expand Down
8 changes: 4 additions & 4 deletions common/operator-install/templates/pattern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ spec:
gitSpec:
targetRepo: {{ .Values.main.git.repoURL }}
targetRevision: {{ .Values.main.git.revision }}
{{- if and .Values.main.tokenSecret .Values.main.tokenSecretNamespace }}
tokenSecret: {{ .Values.main.tokenSecret }}
tokenSecretNamespace: {{ .Values.main.tokenSecretNamespace }}
{{- end }} {{/* if and .Values.main.tokenSecret .Values.main.tokenSecretNamespace */}}
gitOpsSpec:
operatorChannel: {{ default "gitops-1.8" .Values.main.gitops.channel }}
operatorSource: {{ default "redhat-operators" .Values.main.gitops.operatorSource }}
Expand All @@ -16,10 +20,6 @@ spec:
{{- if .Values.main.analyticsUUID }}
analyticsUUID: {{ .Values.main.analyticsUUID }}
{{- end }} {{/* if .Values.main.analyticsUUID */}}
{{- if and .Values.main.tokenSecret .Values.main.tokenSecretNamespace }}
tokenSecret: {{ .Values.main.tokenSecret }}
tokenSecretNamespace: {{ .Values.main.tokenSecretNamespace }}
{{- end }} {{/* if and .Values.main.tokenSecret .Values.main.tokenSecretNamespace */}}
{{- if .Values.main.extraParameters }}
extraParameters:
{{- range .Values.main.extraParameters }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: example
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: example
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: example
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
2 changes: 1 addition & 1 deletion common/tests/operator-install-naked.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: default
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
2 changes: 1 addition & 1 deletion common/tests/operator-install-normal.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: example
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: hub
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: hub
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: hub
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
2 changes: 1 addition & 1 deletion tests/common-operator-install-naked.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: default
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
2 changes: 1 addition & 1 deletion tests/common-operator-install-normal.expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
clusterGroupName: hub
gitSpec:
targetRepo: https://github.com/pattern-clone/mypattern
targetRevision: main
targetRevision: main
gitOpsSpec:
operatorChannel: gitops-1.8
operatorSource: redhat-operators
Expand Down
Loading