Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/gitops-runtime/templates/app-proxy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
{{- $_ := set $appProxyContext.Values "redis" (get .Values "redis") }}
{{- $_ := set $appProxyContext.Values "redis-ha" (get .Values "redis-ha") }}

{{- $_ := set $appProxyContext.Values.podAnnotations "checksum/config-codefresh-cm" (include (print $.Template.BasePath "/codefresh-cm.yaml") . | sha256sum) }}
{{- $_ := set $appProxyContext.Values.podAnnotations "checksum/config-cap-app-proxy" (include (print $.Template.BasePath "/app-proxy/config.yaml") . | sha256sum) }}

{{/* Merge environment variables with the ones in _app-proxy-env.yaml */}}
{{- $mainContainerMergedValues := mergeOverwrite $appProxyContext.Values.env (include "codefresh-gitops-runtime.app-proxy.calculated-env-vars" . | fromYaml) }}
{{- $_ := set $appProxyContext.Values "env" $mainContainerMergedValues }}
Expand Down
5 changes: 0 additions & 5 deletions charts/gitops-runtime/templates/argo-gateway/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ metadata:
{{- include "argo-gateway.labels" . | nindent 4 }}
data:
{{- $mergedConfig | toYaml | nindent 2 }}
{{- if index .Values "argo-cd" "enabled" }}
foo: bar
{{- else }}
baz: qux
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ spec:
{{- include "argo-gateway.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with $context.Values.podAnnotations }}
annotations:
checksum/config-argo-gateway: {{ include (print $.Template.BasePath "/argo-gateway/configmap.yaml") . | sha256sum }}
checksum/config-codefresh-cm: {{ include (print $.Template.BasePath "/codefresh-cm.yaml") . | sha256sum }}
{{- with $context.Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ spec:
{{- include "cluster-event-reporter.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with $context.Values.podAnnotations }}
annotations:
checksum/config-event-reporter: {{ include (print $.Template.BasePath "/event-reporters/cluster-event-reporter/configmap.yaml") . | sha256sum }}
checksum/config-codefresh-cm: {{ include (print $.Template.BasePath "/codefresh-cm.yaml") . | sha256sum }}
{{- if index .Values "argo-cd" "enabled" }}
checksum/config-argocd: {{ include ("argo-cd.config.params") (index .Subcharts "argo-cd") | sha256sum }}
{{- end }}
{{- with $context.Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ spec:
{{- include "runtime-event-reporter.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with $context.Values.podAnnotations }}
annotations:
checksum/config-event-reporter: {{ include (print $.Template.BasePath "/event-reporters/runtime-event-reporter/configmap.yaml") . | sha256sum }}
checksum/config-codefresh-cm: {{ include (print $.Template.BasePath "/codefresh-cm.yaml") . | sha256sum }}
{{- if index .Values "argo-cd" "enabled" }}
checksum/config-argocd: {{ include ("argo-cd.config.params") (index .Subcharts "argo-cd") | sha256sum }}
{{- end }}
{{- with $context.Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
78 changes: 78 additions & 0 deletions charts/gitops-runtime/tests/checksum_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: checksum tests
templates:
- event-reporters/**/deployment.yaml
- event-reporters/**/configmap.yaml
- argo-gateway/deployment.yaml
- argo-gateway/configmap.yaml
- app-proxy/deployment.yaml
- app-proxy/config.yaml
- _components/cap-app-proxy/_deployment.yaml
- _components/cap-app-proxy/_config.yaml
- codefresh-cm.yaml
tests:
- it: default checksum annotations is present
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- equal:
path: spec.template.metadata.annotations["checksum/config-argo-gateway"]
value: ab112b8010e1534e8b45f746764af03ca4e7c9fa5cd0a01f04830e0a6c6e77e1
template: argo-gateway/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-codefresh-cm"]
value: 4fa7b6b4939725018068441ee7ea7ec594c30d6e58020fdaa89b07ca9515b650
template: argo-gateway/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-event-reporter"]
value: d016ba2b10b22e24da8854027d4e3fccfe02ee3db4441512ba38a0eb34e124f5
template: event-reporters/cluster-event-reporter/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-codefresh-cm"]
value: 4fa7b6b4939725018068441ee7ea7ec594c30d6e58020fdaa89b07ca9515b650
template: event-reporters/cluster-event-reporter/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-argocd"]
value: 4ae1efd920b2b1b83a9b74fabd84defe9869f7c66a444bcfd4ce7dbb5cb846c8
template: event-reporters/cluster-event-reporter/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-cap-app-proxy"]
value: 8963a9c81220fd8440ccc4e8675be794c83988751fd0d8591c60b2cd3923fbd4
template: app-proxy/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-codefresh-cm"]
value: 4fa7b6b4939725018068441ee7ea7ec594c30d6e58020fdaa89b07ca9515b650
template: app-proxy/deployment.yaml

- it: checksum annotations should change when configmap changes
template: argo-gateway/deployment.yaml
set:
argo-cd.enabled: false
global.integrations.argo-cd.server.svc: my-argocd-server
values:
- ./values/mandatory-values-ingress.yaml
asserts:
- equal:
path: spec.template.metadata.annotations["checksum/config-argo-gateway"]
value: 89ba18c028caf3aafa73763816296570ec6d82afafa8744419773a4be6d84aff
template: argo-gateway/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-codefresh-cm"]
value: 6fc94d431ae6064fddc76734ec7c66d8b60af02cb22d9b1298e8403a8adcda82
template: argo-gateway/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-event-reporter"]
value: e76508c530cbb199da90e2dfee0ecb4b6ce79ed86e2b5368c3d670b5ccc9fbe2
template: event-reporters/cluster-event-reporter/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-codefresh-cm"]
value: 6fc94d431ae6064fddc76734ec7c66d8b60af02cb22d9b1298e8403a8adcda82
template: event-reporters/cluster-event-reporter/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-cap-app-proxy"]
value: b302ea8929baccb98f9b0086987f76de6e3591e72f356915d951e6a6437611f6
template: app-proxy/deployment.yaml
- equal:
path: spec.template.metadata.annotations["checksum/config-codefresh-cm"]
value: 6fc94d431ae6064fddc76734ec7c66d8b60af02cb22d9b1298e8403a8adcda82
template: app-proxy/deployment.yaml