Skip to content

Commit

Permalink
Merge pull request #111 from claudiol/common-automatic-update
Browse files Browse the repository at this point in the history
Automatic common/ update
  • Loading branch information
claudiol authored Dec 21, 2023
2 parents 69a4216 + 6e45c45 commit fd3b1ab
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 15 deletions.
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

0 comments on commit fd3b1ab

Please sign in to comment.