[github-actions] CD pipeline: Use OCI url in index.yaml (#27979)

* [github-actions] CD pipeline: Use OCI url in index.yaml

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Remove extra backslash

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Fix index path

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

---------

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>
This commit is contained in:
Miguel Ruiz
2024-07-16 15:54:32 +02:00
committed by GitHub
parent 1b0c2c6cbd
commit 2c255d1fa8

View File

@@ -142,7 +142,10 @@ jobs:
git reset --hard $(git commit-tree origin/index^{tree} -m "Update index.yaml")
# Rebuild index
helm repo index --url https://charts.bitnami.com/bitnami --merge bitnami/index.yaml ../download
helm repo index --url oci://registry-1.docker.io/bitnamicharts --merge bitnami/index.yaml ../download
# Replace .tgz in URL with OCI tag
sed -i "s|oci://registry-1.docker.io/bitnamicharts/$app-$chart_version.tgz|oci://registry-1.docker.io/bitnamicharts/$app:$chart_version|" ../download/index.yaml
# Compare size of files
if [[ $(stat -c%s bitnami/index.yaml) -gt $(stat -c%s ../download/index.yaml) ]]; then
echo "New index.yaml file is shorter than the current one"
@@ -230,7 +233,7 @@ jobs:
for dependency in "${chart}/charts/"*.tgz; do
if [[ -s "$dependency" ]]; then
# Analyse all 'Chart.yaml' files in dependencies
while read -r chart_yaml_file; do
while read -r chart_yaml_file; do
if [[ -n "${chart_yaml_file}" ]]; then
dependency_image_list="$(tar -xzO -f "$dependency" "$chart_yaml_file" | yq '.annotations.images' | yq '[ .[] | .image | sub("^[^/]+/", "") ] | tojson')"
image_list="$(jq -c --null-input --argjson arr1 "$image_list" --argjson arr2 "$dependency_image_list" '$arr1 + $arr2 | unique')"
@@ -249,7 +252,7 @@ jobs:
"version": $app_version,
"bundled_os_version": $bundled_os_version,
"properties": {
"chart_url": "https://charts.bitnami.com/bitnami/\($app)-\($chart_version).tgz",
"chart_url": "oci://registry-1.docker.io/bitnamicharts/\($app):\($chart_version)",
"containers": $image_list,
"github_repository": "bitnami/charts/tree/main/bitnami/\($app)",
}