Skip to content

Update appset and add airgapped scripts #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions charts/gitops-runtime/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 0.1.27-helm-alpha
description: A Helm chart for Codefresh gitops runtime
name: gitops-runtime
version: 0.2.1-alpha.2
version: 0.2.1-alpha.3
home: https://github.com/codefresh-io/gitops-runtime-helm
keywords:
- codefresh
Expand All @@ -13,7 +13,7 @@ maintainers:
dependencies:
- name: argo-cd
repository: https://codefresh-io.github.io/argo-helm
version: 5.27.1-1-cap-CR-17237
version: 5.28.1-1-cap-CR-17237
- name: argo-events
repository: https://codefresh-io.github.io/argo-helm
version: 2.0.5-1-cf-init
Expand Down
4 changes: 2 additions & 2 deletions charts/gitops-runtime/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gitops-runtime

![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)
![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)

A Helm chart for Codefresh gitops runtime

Expand All @@ -18,7 +18,7 @@ A Helm chart for Codefresh gitops runtime
|------------|------|---------|
| https://bitnami-labs.github.io/sealed-secrets/ | sealed-secrets | 2.7.3 |
| https://chartmuseum.codefresh.io/codefresh-tunnel-client | tunnel-client(codefresh-tunnel-client) | 0.1.12 |
| https://codefresh-io.github.io/argo-helm | argo-cd | 5.27.1-1-cap-CR-17237 |
| https://codefresh-io.github.io/argo-helm | argo-cd | 5.28.1-1-cap-CR-17237 |
| https://codefresh-io.github.io/argo-helm | argo-events | 2.0.5-1-cf-init |
| https://codefresh-io.github.io/argo-helm | argo-rollouts | 2.22.1-1-cap-sw |
| https://codefresh-io.github.io/argo-helm | argo-workflows | 0.22.8-1-cf-init |
Expand Down
4 changes: 4 additions & 0 deletions scripts/all-image-values.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MYDIR=$(dirname $0)

$MYDIR/output-calculated-values.sh /tmp/gitops-runtime-values.yaml > /dev/null
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
46 changes: 46 additions & 0 deletions scripts/helper-scripts/yaml-filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Program to convert yaml file to dictionary
import yaml
import sys

def set_nested_dict_value(nested_dict, path, value):
"""Set a value in a nested dictionary using a dot-delimited path."""
keys = path.split('.')
for key in keys[:-1]:
nested_dict = nested_dict.setdefault(key, {})
nested_dict[keys[-1]] = value

def recurse_filter(currValue, filteredDict, filterKeyPathList, currentPath):
bMatched = False
for filterKeyPath in filterKeyPathList:
if currentPath.endswith(filterKeyPath) and currValue:
bMatched = True
if bMatched == True:
set_nested_dict_value(filteredDict,currentPath,currValue)
elif type(currValue) is dict:
for key in currValue.keys():
if not currentPath:
path = key
else:
path = currentPath + "." + key
recurse_filter(currValue[key], filteredDict, filterKeyPathList, path)
else:
return

def main(yamlFilepath, filterKeys):
# Open yaml
with open(yamlFilepath, 'r') as stream:
try:
d=yaml.safe_load(stream)
except yaml.YAMLError as e:
print(e)

filteredDict = {}
lstFilterKeys = filterKeys.split(",")
recurse_filter(d, filteredDict, lstFilterKeys, "")
print(yaml.dump(filteredDict))

if __name__ == "__main__":
if len(sys.argv) != 3:
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>")
else:
main(sys.argv[1], sys.argv[2])
5 changes: 5 additions & 0 deletions scripts/list-images-for-mirrror.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MYDIR=$(dirname $0)
CHARTDIR="${MYDIR}/../charts/gitops-runtime"
VALUESFILE="${CHARTDIR}/ci/ingressless-values.yaml"
helm dependency update $CHARTDIR > /dev/null
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
14 changes: 14 additions & 0 deletions scripts/output-calculated-values.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
MYDIR=$(dirname $0)
CHARTDIR="${MYDIR}/../charts/gitops-runtime"
VALUESFILE="${CHARTDIR}/ci/ingressless-values.yaml"
OUTPUTFILE=$1
ALL_VALUES_TEMPLATE=$(cat <<-END
{{ .Values | toYaml }}
END
)

echo $ALL_VALUES_TEMPLATE > $CHARTDIR/templates/all-values.yaml
helm dependency update $CHARTDIR
helm template --values $VALUESFILE --show-only templates/all-values.yaml $CHARTDIR > $OUTPUTFILE
rm $CHARTDIR/templates/all-values.yaml