Skip to content

Commit bc4101b

Browse files
Update appset and add airgapped scripts (#27)
* add list image for mirror script * update appset and add airgapped scripts
1 parent 3ebf3e9 commit bc4101b

File tree

6 files changed

+73
-4
lines changed

6 files changed

+73
-4
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.2
5+
version: 0.2.1-alpha.3
66
home: https://github.com/codefresh-io/gitops-runtime-helm
77
keywords:
88
- codefresh
@@ -13,7 +13,7 @@ maintainers:
1313
dependencies:
1414
- name: argo-cd
1515
repository: https://codefresh-io.github.io/argo-helm
16-
version: 5.27.1-1-cap-CR-17237
16+
version: 5.28.1-1-cap-CR-17237
1717
- name: argo-events
1818
repository: https://codefresh-io.github.io/argo-helm
1919
version: 2.0.5-1-cf-init

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.2](https://img.shields.io/badge/Version-0.2.1--alpha.2-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.3](https://img.shields.io/badge/Version-0.2.1--alpha.3-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

@@ -18,7 +18,7 @@ A Helm chart for Codefresh gitops runtime
1818
|------------|------|---------|
1919
| https://bitnami-labs.github.io/sealed-secrets/ | sealed-secrets | 2.7.3 |
2020
| https://chartmuseum.codefresh.io/codefresh-tunnel-client | tunnel-client(codefresh-tunnel-client) | 0.1.12 |
21-
| https://codefresh-io.github.io/argo-helm | argo-cd | 5.27.1-1-cap-CR-17237 |
21+
| 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 |
2424
| https://codefresh-io.github.io/argo-helm | argo-workflows | 0.22.8-1-cf-init |

scripts/all-image-values.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MYDIR=$(dirname $0)
2+
3+
$MYDIR/output-calculated-values.sh /tmp/gitops-runtime-values.yaml > /dev/null
4+
python3 $MYDIR/helper-scripts/yaml-filter.py /tmp/gitops-runtime-values.yaml image.repository,image.registry,image.tag,argo-events.configs.nats.versions,argo-events.configs.jetstream.versions

scripts/helper-scripts/yaml-filter.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Program to convert yaml file to dictionary
2+
import yaml
3+
import sys
4+
5+
def set_nested_dict_value(nested_dict, path, value):
6+
"""Set a value in a nested dictionary using a dot-delimited path."""
7+
keys = path.split('.')
8+
for key in keys[:-1]:
9+
nested_dict = nested_dict.setdefault(key, {})
10+
nested_dict[keys[-1]] = value
11+
12+
def recurse_filter(currValue, filteredDict, filterKeyPathList, currentPath):
13+
bMatched = False
14+
for filterKeyPath in filterKeyPathList:
15+
if currentPath.endswith(filterKeyPath) and currValue:
16+
bMatched = True
17+
if bMatched == True:
18+
set_nested_dict_value(filteredDict,currentPath,currValue)
19+
elif type(currValue) is dict:
20+
for key in currValue.keys():
21+
if not currentPath:
22+
path = key
23+
else:
24+
path = currentPath + "." + key
25+
recurse_filter(currValue[key], filteredDict, filterKeyPathList, path)
26+
else:
27+
return
28+
29+
def main(yamlFilepath, filterKeys):
30+
# Open yaml
31+
with open(yamlFilepath, 'r') as stream:
32+
try:
33+
d=yaml.safe_load(stream)
34+
except yaml.YAMLError as e:
35+
print(e)
36+
37+
filteredDict = {}
38+
lstFilterKeys = filterKeys.split(",")
39+
recurse_filter(d, filteredDict, lstFilterKeys, "")
40+
print(yaml.dump(filteredDict))
41+
42+
if __name__ == "__main__":
43+
if len(sys.argv) != 3:
44+
raise SyntaxError("Wrong number of arguments. Usage: filter-values.py <path to yaml> <key paths to filter by, separated by commas - for example image.repository,foo.bar>")
45+
else:
46+
main(sys.argv[1], sys.argv[2])

scripts/list-images-for-mirrror.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
MYDIR=$(dirname $0)
2+
CHARTDIR="${MYDIR}/../charts/gitops-runtime"
3+
VALUESFILE="${CHARTDIR}/ci/ingressless-values.yaml"
4+
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

scripts/output-calculated-values.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
MYDIR=$(dirname $0)
3+
CHARTDIR="${MYDIR}/../charts/gitops-runtime"
4+
VALUESFILE="${CHARTDIR}/ci/ingressless-values.yaml"
5+
OUTPUTFILE=$1
6+
ALL_VALUES_TEMPLATE=$(cat <<-END
7+
{{ .Values | toYaml }}
8+
END
9+
)
10+
11+
echo $ALL_VALUES_TEMPLATE > $CHARTDIR/templates/all-values.yaml
12+
helm dependency update $CHARTDIR
13+
helm template --values $VALUESFILE --show-only templates/all-values.yaml $CHARTDIR > $OUTPUTFILE
14+
rm $CHARTDIR/templates/all-values.yaml

0 commit comments

Comments
 (0)