Skip to content

Commit

Permalink
Fix the updatecli config generator (#1111)
Browse files Browse the repository at this point in the history
Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall authored Jan 14, 2025
1 parent 34ecfac commit 2253065
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-for-dependency-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:

- name: Regenerate files
if: steps.update-dependency.outputs.changed == 'true'
run: make -C "$(dirname "${{ matrix.config }}")" clean build
run: make clean build

- name: Create pull request
if: steps.update-dependency.outputs.changed == 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "beyla" is specified
kind: yaml
spec:
file: charts/feature-auto-instrumentation/Chart.yaml
file: charts/k8s-monitoring/charts/feature-auto-instrumentation/Chart.yaml
key: $.dependencies[0].name
value: beyla
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[0].version
name: charts/feature-auto-instrumentation
name: charts/k8s-monitoring/charts/feature-auto-instrumentation
versionincrement: none
sourceid: beyla
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "kepler" is specified
kind: yaml
spec:
file: charts/feature-cluster-metrics/Chart.yaml
file: charts/k8s-monitoring/charts/feature-cluster-metrics/Chart.yaml
key: $.dependencies[3].name
value: kepler
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[3].version
name: charts/feature-cluster-metrics
name: charts/k8s-monitoring/charts/feature-cluster-metrics
versionincrement: none
sourceid: kepler
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "kube-state-metrics" is specified
kind: yaml
spec:
file: charts/feature-cluster-metrics/Chart.yaml
file: charts/k8s-monitoring/charts/feature-cluster-metrics/Chart.yaml
key: $.dependencies[0].name
value: kube-state-metrics
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[0].version
name: charts/feature-cluster-metrics
name: charts/k8s-monitoring/charts/feature-cluster-metrics
versionincrement: none
sourceid: kube-state-metrics
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "opencost" is specified
kind: yaml
spec:
file: charts/feature-cluster-metrics/Chart.yaml
file: charts/k8s-monitoring/charts/feature-cluster-metrics/Chart.yaml
key: $.dependencies[4].name
value: opencost
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[4].version
name: charts/feature-cluster-metrics
name: charts/k8s-monitoring/charts/feature-cluster-metrics
versionincrement: none
sourceid: opencost
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "prometheus-node-exporter" is specified
kind: yaml
spec:
file: charts/feature-cluster-metrics/Chart.yaml
file: charts/k8s-monitoring/charts/feature-cluster-metrics/Chart.yaml
key: $.dependencies[1].name
value: prometheus-node-exporter
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[1].version
name: charts/feature-cluster-metrics
name: charts/k8s-monitoring/charts/feature-cluster-metrics
versionincrement: none
sourceid: prometheus-node-exporter
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "prometheus-windows-exporter" is specified
kind: yaml
spec:
file: charts/feature-cluster-metrics/Chart.yaml
file: charts/k8s-monitoring/charts/feature-cluster-metrics/Chart.yaml
key: $.dependencies[2].name
value: prometheus-windows-exporter
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[2].version
name: charts/feature-cluster-metrics
name: charts/k8s-monitoring/charts/feature-cluster-metrics
versionincrement: none
sourceid: prometheus-windows-exporter
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ conditions:
name: Ensure Helm chart dependency "prometheus-operator-crds" is specified
kind: yaml
spec:
file: charts/feature-prometheus-operator-objects/Chart.yaml
file: charts/k8s-monitoring/charts/feature-prometheus-operator-objects/Chart.yaml
key: $.dependencies[0].name
value: prometheus-operator-crds
disablesourceinput: true
Expand All @@ -26,6 +26,6 @@ targets:
spec:
file: Chart.yaml
key: $.dependencies[0].version
name: charts/feature-prometheus-operator-objects
name: charts/k8s-monitoring/charts/feature-prometheus-operator-objects
versionincrement: none
sourceid: prometheus-operator-crds
12 changes: 7 additions & 5 deletions scripts/charts-to-updatecli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ if [ ! -f "$CHART_YAML" ]; then
fi

rm -f .updatecli-*.yaml
chartDir=$(basename "$(dirname "$(readlink -f "$CHART_YAML")")")
rootDir=$(git rev-parse --show-toplevel)
parentChart=$(basename "$(dirname "$(readlink -f "$CHART_YAML")")")
parentChartPath=$(dirname "$(readlink -f "$CHART_YAML")" | sed "s|$rootDir/||")
dependencyCount=$(yq eval '.dependencies | length' "$CHART_YAML")
for ((i=0; i<dependencyCount; i++)); do
dependency=$(yq eval ".dependencies[$i]" "$CHART_YAML")
Expand All @@ -22,7 +24,7 @@ for ((i=0; i<dependencyCount; i++)); do
if [ ! -f ".updatecli-${chart}.yaml" ]; then
echo "---" > ".updatecli-${chart}.yaml"
yq eval --null-input "{
\"name\": \"Update dependency \\\"$chart\\\" for Helm chart \\\"$chartDir\\\"\",
\"name\": \"Update dependency \\\"$chart\\\" for Helm chart \\\"$parentChart\\\"\",
\"sources\": {
\"$chart\": {
\"name\": \"Get latest \\\"$chart\\\" Helm chart version\",
Expand All @@ -42,7 +44,7 @@ for ((i=0; i<dependencyCount; i++)); do
\"name\": \"Ensure Helm chart dependency \\\"$chart\\\" is specified\",
\"kind\": \"yaml\",
\"spec\": {
\"file\": \"charts/$chartDir/Chart.yaml\",
\"file\": \"$parentChartPath/Chart.yaml\",
\"key\": \"$.dependencies[$i].name\",
\"value\": \"$chart\"
},
Expand All @@ -54,12 +56,12 @@ for ((i=0; i<dependencyCount; i++)); do
fi
yq eval ".targets += {
\"$name\": {
\"name\": \"Bump Helm chart dependency \\\"$name\\\" for Helm chart \\\"$chartDir\\\"\",
\"name\": \"Bump Helm chart dependency \\\"$name\\\" for Helm chart \\\"$parentChart\\\"\",
\"kind\": \"helmchart\",
\"spec\": {
\"file\": \"Chart.yaml\",
\"key\": \"$.dependencies[$i].version\",
\"name\": \"charts/$chartDir\",
\"name\": \"$parentChartPath\",
\"versionincrement\": \"none\"
},
\"sourceid\": \"$chart\"
Expand Down

0 comments on commit 2253065

Please sign in to comment.