From f50235724d14e3344c69b5e1c0af191f1ded9a9a Mon Sep 17 00:00:00 2001 From: Tomasz Pietrek Date: Fri, 24 Oct 2025 11:46:04 +0200 Subject: [PATCH] Automate CRD downloads in Dependabot workflow When Dependabot bumps natsio/jetstream-controller version, the workflow will now automatically download the corresponding CRDs from the NACK release and commit them along with the version bump. Changes: - Download CRDs from NACK releases when controller version is bumped - Ensure CRD directory exists with mkdir -p - Fail the job if CRD download fails (prevents version/CRD mismatch) - Update commit message to indicate CRDs are included This ensures CRDs always stay synchronized with the controller version and eliminates manual CRD update steps. Signed-off-by: Tomasz Pietrek --- .github/workflows/bump.yaml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump.yaml b/.github/workflows/bump.yaml index 99abb80e..cf888920 100644 --- a/.github/workflows/bump.yaml +++ b/.github/workflows/bump.yaml @@ -100,9 +100,34 @@ jobs: echo "newChartVersion : $newChartVersion" sed -i "s|^appVersion:\s.*|appVersion: $newVersionSemVer|;s|^version:\s.*|version: $newChartVersion|" "$directory/Chart.yaml" - + + # Download CRDs for NACK controller updates + if [ "$dependencyName" = "natsio/jetstream-controller" ]; then + echo "Downloading CRDs for NACK v$newVersionSemVer..." + crd_url="https://github.com/nats-io/nack/releases/download/v${newVersionSemVer}/crds.yml" + crd_path="$directory/crds/crds.yml" + + # Ensure directory exists + mkdir -p "$(dirname "$crd_path")" + + if curl -fsSL "$crd_url" -o "$crd_path"; then + echo "✓ CRDs downloaded successfully from $crd_url" + git add "$crd_path" + else + echo "✗ Error: Failed to download CRDs from $crd_url" + echo "Cannot proceed with version bump without CRD update" + exit 1 + fi + fi + + # Prepare commit message + commit_msg="[$(basename "$directory") helm] bump chart to version: $newChartVersion appVersion: $newVersionSemVer" + if [ "$dependencyName" = "natsio/jetstream-controller" ]; then + commit_msg="$commit_msg (with CRDs)" + fi + git add "$directory/Chart.yaml" - if git commit -m "[$(basename "$directory") helm] bump chart to version: $newChartVersion appVersion: $newVersionSemVer"; then + if git commit -m "$commit_msg"; then push=1 fi done