Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 0a6da8a

Browse files
authored
Merge pull request #41 from claudiol/gitref-counter-clustergroup
gitref counter clustergroup
2 parents 2479362 + e4d7039 commit 0a6da8a

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

charts/clustergroup/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A Helm chart to create per-clustergroup ArgoCD applications and any
33
keywords:
44
- pattern
55
name: pattern-clustergroup
6-
version: 0.0.2
6+
version: 0.0.3
77
maintainers:
88
99
name: michele

charts/clustergroup/templates/plumbing/applications.yaml

+19-14
Original file line numberDiff line numberDiff line change
@@ -141,32 +141,39 @@ spec:
141141
project: {{ .project }}
142142

143143
{{- if .sources }}
144+
{{- $refcount := 0 }}
145+
{{ $isChart := false }}
144146
sources:
145-
{{- range .sources }}
147+
{{- range .sources }}
146148
- repoURL: {{ coalesce .repoURL $.Values.global.repoURL }}
147149
targetRevision: {{ coalesce .targetRevision $.Values.global.targetRevision }}
148150
{{- if .chart }}
149151
chart: {{ .chart }}
152+
{{ $isChart = true }}
150153
{{- else if .path }}
151154
path: {{ .path }}
155+
{{ $isChart = false }}
152156
{{- else }}
153-
ref: gitref
157+
{{ $isChart = false }}
154158
{{- end }}
155-
{{- if and (not .kustomize) (.chart) }}
159+
{{- if not (.chart) }}
160+
ref: gitref{{$refcount}}
161+
{{- end }}
162+
{{- if and (not .kustomize) }}
156163
helm:
157164
ignoreMissingValueFiles: true
158165
valueFiles:
159-
- "$gitref/values-global.yaml"
160-
- "$gitref/values-{{ $.Values.clusterGroup.name }}.yaml"
166+
- "$gitref{{ $refcount }}/values-global.yaml"
167+
- "$gitref{{ $refcount }}/values-{{ $.Values.clusterGroup.name }}.yaml"
161168
{{- if $.Values.global.clusterPlatform }}
162-
- "$gitref/values-{{ $.Values.global.clusterPlatform }}.yaml"
169+
- "$gitref{{ $refcount }}/values-{{ $.Values.global.clusterPlatform }}.yaml"
163170
{{- if $.Values.global.clusterVersion }}
164-
- "$gitref/values-{{ $.Values.global.clusterPlatform }}-{{ $.Values.global.clusterVersion }}.yaml"
171+
- "$gitref{{ $refcount }}/values-{{ $.Values.global.clusterPlatform }}-{{ $.Values.global.clusterVersion }}.yaml"
165172
{{- end }}
166-
- "$gitref/values-{{ $.Values.global.clusterPlatform }}-{{ $.Values.clusterGroup.name }}.yaml"
173+
- "$gitref{{ $refcount }}/values-{{ $.Values.global.clusterPlatform }}-{{ $.Values.clusterGroup.name }}.yaml"
167174
{{- end }}
168175
{{- if $.Values.global.clusterVersion }}
169-
- "$gitref/values-{{ $.Values.global.clusterVersion }}-{{ $.Values.clusterGroup.name }}.yaml"
176+
- "$gitref{{ $refcount }}/values-{{ $.Values.global.clusterVersion }}-{{ $.Values.clusterGroup.name }}.yaml"
170177
{{- end }}
171178
{{- range $valueFile := .extraValueFiles }}
172179
- {{ $valueFile | quote }}
@@ -234,13 +241,11 @@ spec:
234241
{{- end }}{{- /* END RANGE */}}
235242
{{- end }} {{- /* END FILEPARAMETERS */}}
236243
{{- end }} {{- /* IF NOT PLUGIN-ELSE */}}
237-
238-
239-
240-
244+
{{- if not ( $isChart ) }}
245+
{{ $refcount = add1 $refcount }}
246+
{{- end }}
241247
{{- end }}
242248
{{- else }}
243-
244249
source:
245250
repoURL: {{ coalesce .repoURL $.Values.global.repoURL }}
246251
targetRevision: {{ coalesce .targetRevision $.Values.global.targetRevision }}

0 commit comments

Comments
 (0)