From 428d5218d846ff1fa394b660acef96ba49e3efee Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Wed, 6 Dec 2023 13:28:53 +0200 Subject: [PATCH] fix(ci): handle better fetch deps (#15792) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .github/scripts/fetch_helm_deps.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/scripts/fetch_helm_deps.sh b/.github/scripts/fetch_helm_deps.sh index eefb82b6e3a..20d065838e1 100755 --- a/.github/scripts/fetch_helm_deps.sh +++ b/.github/scripts/fetch_helm_deps.sh @@ -94,13 +94,22 @@ for idx in $(eval echo "{0..$length}"); do # Extract url from repo_url. It's under .entries.DEP_NAME.urls. We filter the specific version first (.version) dep_url=$(v="$version" n="$name" go-yq '.entries.[env(n)].[] | select (.version == env(v)) | .urls.[0]' "$index_cache/$repo_dir/index.yaml") - # tmp hotpatch for cert-manager - if [[ ! "$dep_url" == "https"* ]]; then - if [[ "$name" =~ "cert-manager" ]]; then - dep_url="https://charts.jetstack.io/${dep_url}" - fi + if [[ ! "$dep_url" == "https"* ]]; then + # If the chart uses relative path, drop the "/index.yaml" + # from the repo_url and append the relative path + repo=$(echo "$repo_url" | sed 's/\/index\.yaml//') + dep_url="${repo}/${dep_url}" fi + if [[ -z "$dep_url" ]]; then + echo "❌ Dependency URL is empty." + echo "Make sure the version is correct and the dependency exists in the index." + echo "Aborting..." + exit 1 + fi + + echo "🔗 Dependency URL: $dep_url" + echo "" echo "⏬ Downloading dependency $name-$version from $dep_url..." mkdir -p "$cache_path/$repo_dir"