Skip to content

Commit d7137e7

Browse files
committed
simplified templating, check for ARGOCD_CHECK_VERSION at run time
1 parent 2409cb0 commit d7137e7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

charts/gitops-runtime/templates/hooks/pre-install/validate-values.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,17 @@ spec:
3737
fieldPath: metadata.namespace
3838
- name: CHART_VERSION
3939
value: {{ .Chart.Version }}
40-
{{- if not (get .Values "argo-cd").enabled }}
40+
- name: ARGOCD_CHECK_VERSION
41+
value: {{ not (get .Values "argo-cd").enabled | quote }}
4142
- name: ARGOCD_LABELS
4243
value: "{{ range $k, $v := .Values.installer.argoCdVersionCheck.argoServerLabels }}{{ $k }}={{ $v }},{{ end }}"
4344
- name: ARGOCD_VERSION_PATH
4445
value: "/api/version"
4546
- name: REQUIRED_VERSION_CONSTRAINT
4647
value: ">=2.12 <3"
47-
{{- end }}
4848
command: ["sh", "-c"]
4949
args:
5050
- | # shell
51-
{{- if not (get .Values "argo-cd").enabled }}
5251
# Function to find Argo CD service and export its name and port
5352
get_argocd_service_info() {
5453
local service_info
@@ -162,11 +161,12 @@ spec:
162161
fi
163162
}
164163
165-
validate_argocd_version
164+
if [ "$ARGOCD_CHECK_VERSION" = "true" ]; then
165+
validate_argocd_version
166+
fi
166167
167168
# --- Helm Values Validation (cf cli) ---
168169
echo "Argo CD version check passed. Validating helm values using cf cli..."
169-
{{- end }}
170170
cf helm validate --values /job_tmp/values.yaml --namespace ${NAMESPACE} --version ${CHART_VERSION} --hook --log-level debug
171171
volumeMounts:
172172
- name: customized-values

0 commit comments

Comments
 (0)