Skip to content

Commit 5ed9db9

Browse files
update argo-workflows and add tags to image values script (#31)
1 parent 0626e83 commit 5ed9db9

File tree

5 files changed

+87
-10
lines changed

5 files changed

+87
-10
lines changed

charts/gitops-runtime/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
appVersion: 0.1.27-helm-alpha
33
description: A Helm chart for Codefresh gitops runtime
44
name: gitops-runtime
5-
version: 0.2.1-alpha.5
5+
version: 0.2.1-alpha.6
66
home: https://github.com/codefresh-io/gitops-runtime-helm
77
keywords:
88
- codefresh
@@ -19,7 +19,7 @@ dependencies:
1919
version: 2.0.5-1-cf-init
2020
- name: argo-workflows
2121
repository: https://codefresh-io.github.io/argo-helm
22-
version: 0.22.8-1-cf-init
22+
version: 0.22.9-1-CR-17426
2323
condition: argo-workflows.enabled
2424
- name: argo-rollouts
2525
repository: https://codefresh-io.github.io/argo-helm

charts/gitops-runtime/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# gitops-runtime
22

3-
![Version: 0.2.1-alpha.5](https://img.shields.io/badge/Version-0.2.1--alpha.5-informational?style=flat-square) ![AppVersion: 0.1.27-helm-alpha](https://img.shields.io/badge/AppVersion-0.1.27--helm--alpha-informational?style=flat-square)
3+
![Version: 0.2.1-alpha.6](https://img.shields.io/badge/Version-0.2.1--alpha.6-informational?style=flat-square) ![AppVersion: 0.1.27-helm-alpha](https://img.shields.io/badge/AppVersion-0.1.27--helm--alpha-informational?style=flat-square)
44

55
A Helm chart for Codefresh gitops runtime
66

@@ -21,7 +21,7 @@ A Helm chart for Codefresh gitops runtime
2121
| https://codefresh-io.github.io/argo-helm | argo-cd | 5.28.1-1-cap-CR-17237 |
2222
| https://codefresh-io.github.io/argo-helm | argo-events | 2.0.5-1-cf-init |
2323
| https://codefresh-io.github.io/argo-helm | argo-rollouts | 2.22.1-1-cap-sw |
24-
| https://codefresh-io.github.io/argo-helm | argo-workflows | 0.22.8-1-cf-init |
24+
| https://codefresh-io.github.io/argo-helm | argo-workflows | 0.22.9-1-CR-17426 |
2525

2626
## Values
2727

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
global:
2+
codefresh:
3+
accountId: 628a80b693a15c0f9c13ab75 # Codefresh Account id for ilia-codefresh for now, needs to be some test account
4+
gitIntegration:
5+
provider:
6+
name: 'GITHUB'
7+
apiUrl: 'https://api.github.com'
8+
userToken:
9+
secretKeyRef:
10+
name: mysecret
11+
key: myvalue
12+
optional: true
13+
14+
runtime:
15+
name: default
16+
cluster: test-cluster
17+
18+
ingress:
19+
enabled: false
20+
21+
repoCredentialsTemplate:
22+
url: 'https://github.com'
23+
username: 'username'
24+
password: 'dummy'
25+
26+
argo-rollouts:
27+
dashboard:
28+
enabled: true
29+
30+
argo-cd:
31+
redis-ha:
32+
enabled: true
33+
server:
34+
extensions:
35+
enabled: true
36+
redis:
37+
exporter:
38+
enabled: true

scripts/list-images-for-mirrror.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
MYDIR=$(dirname $0)
22
CHARTDIR="${MYDIR}/../charts/gitops-runtime"
3-
VALUESFILE="${CHARTDIR}/ci/ingressless-values.yaml"
3+
VALUESFILE="${CHARTDIR}/ci/values-all-images.yaml"
44
helm dependency update $CHARTDIR > /dev/null
5-
helm template --values $VALUESFILE $CHARTDIR | grep -E -i ".*Image: " | awk -F ':' '{if ($2) printf "%s:%s\n", $2, $3}' | tr -d "\"|[:blank:]" | sort -u |uniq -i
5+
helm template --values $VALUESFILE $CHARTDIR | grep -E -i ".*Image: " | awk -F ':' '{if ($2) printf "%s:%s\n", $2, $3}' | tr -d "\"|[:blank:]" | sort -u |uniq -i
6+
# Current limitation - the image for argoexec is missing, since it's sent as a parameter in the command in the template, and it's hard to match it with a regex.

scripts/output-calculated-values.sh

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,52 @@
11
#!/bin/bash
22
MYDIR=$(dirname $0)
33
CHARTDIR="${MYDIR}/../charts/gitops-runtime"
4-
VALUESFILE="${CHARTDIR}/ci/ingressless-values.yaml"
4+
VALUESFILE="${CHARTDIR}/ci/values-all-images.yaml"
55
OUTPUTFILE=$1
6-
ALL_VALUES_TEMPLATE=$(cat <<-END
6+
# This template prints all values and also sets tags for all images with non-empty repository value, where the tag is empty and should be derived from the appVersion of the subchart.
7+
ALL_VALUES_TEMPLATE=$(cat <<END
8+
{{- define "recurse-set-image-tags"}}
9+
{{- \$map := .Values }}
10+
{{- \$root := .root }}
11+
{{- \$rootKey := .rootKey}}
12+
{{- range \$key, \$val := \$map -}}
13+
{{- if eq \$key "image" }}
14+
{{/* If tag is not provided, check for subchart appVersion*/}}
15+
{{ if kindOf \$val | eq "map" }}
16+
{{- if hasKey \$val "tag" }}
17+
{{/* If tag has no value*/}}
18+
{{- if and (not \$val.tag) \$val.repository}}
19+
{{- \$suspectedSubChart := \$rootKey }}
20+
{{- if hasKey \$root.Subcharts \$suspectedSubChart }}
21+
{{ \$subchart := get \$root.Subcharts \$suspectedSubChart }}
22+
{{- \$_ := set \$val "tag" \$subchart.Chart.AppVersion }}
23+
{{- else if eq \$rootKey "installer" }}
24+
{{- \$_ := set \$val "tag" \$root.Chart.Version }}
25+
{{- end }}
26+
{{- end }}
27+
{{- end }}
28+
{{- end }}
29+
{{- else if kindOf \$val | eq "map" }}
30+
{{- include "recurse-set-image-tags" (dict "rootKey" \$rootKey "root" \$root "Values" \$val) }}
31+
{{- end }}
32+
{{- end }}
33+
{{- end }}
34+
35+
{{- if .Values.getImages }}
36+
{{- \$mergedImagesDict := dict }}
37+
{{- /* Iterate over all top level components (argocd, rollouts workflows, etc)*/}}
38+
{{- range \$key, \$val := .Values -}}
39+
{{- if kindOf \$val | eq "map" }}
40+
{{- /* Recursively get all paths containing image value */}}
41+
{{- \$imagesValsDict := include "recurse-set-image-tags" (dict "rootKey" \$key "root" $ "Values" \$val) | fromYaml }}
42+
{{- end }}
43+
{{- end }}
744
{{ .Values | toYaml }}
45+
{{- end }}
846
END
947
)
1048

11-
echo $ALL_VALUES_TEMPLATE > $CHARTDIR/templates/all-values.yaml
49+
echo -e "$ALL_VALUES_TEMPLATE" > $CHARTDIR/templates/all-values.yaml
1250
helm dependency update $CHARTDIR
13-
helm template --values $VALUESFILE --show-only templates/all-values.yaml $CHARTDIR > $OUTPUTFILE
51+
helm template --values $VALUESFILE --set getImages=true --show-only templates/all-values.yaml $CHARTDIR > $OUTPUTFILE
1452
rm $CHARTDIR/templates/all-values.yaml

0 commit comments

Comments
 (0)