diff --git a/.forgejo/workflows/deploy-release.yml b/.forgejo/workflows/deploy-release.yml index c10a5c5..9616c4c 100644 --- a/.forgejo/workflows/deploy-release.yml +++ b/.forgejo/workflows/deploy-release.yml @@ -89,14 +89,21 @@ jobs: | head -3 # On a stable cut (tag push), auto-bump tnd-zddc-chart's appVersion to - # match the new ZDDC version, then push to the chart's main branch. - # The chart's pipeline-prod fires automatically on its own main push, - # rebuilds the prod Docker image with a new tag (image tag derives from - # Chart.AppVersion), and helm rolls the deployment. Net effect: a - # single ZDDC stable cut deploys to BMCD prod with zero manual steps - # on the chart repo. Dispatch-only invocations of this workflow - # (workflow_dispatch with channel=release) skip — the chart bump is - # only meaningful when the actual git tag exists at refs/tags/. + # match the new ZDDC version on BOTH chart branches: + # + # main → BMCD pipeline-prod fires → prod image rebuilt → prod rolled + # develop → BMCD pipeline-dev fires → dev image rebuilt → dev rolled + # + # Dev tracking stable is the project invariant for "no active beta" + # state — when stable advances, dev advances with it. The next beta + # cut (./build beta on ZDDC main) advances develop ahead of main via + # notify-chart-dev.yml; this stable cut catches develop back up. + # + # Net effect of one ZDDC stable cut: prod + dev + zddc.varasys.io all + # roll automatically with zero manual steps on either repo. Dispatch- + # only invocations of this workflow (workflow_dispatch with + # channel=release) skip — the chart bump is only meaningful when the + # actual git tag exists at refs/tags/. notify-chart-prod: needs: build-and-deploy if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/zddc-server-v') @@ -104,7 +111,7 @@ jobs: env: CHART_GITHUB_TOKEN: ${{ secrets.CHART_GITHUB_TOKEN }} steps: - - name: Auto-bump tnd-zddc-chart appVersion + push to chart main + - name: Auto-bump tnd-zddc-chart appVersion on main + develop run: | set -eu VERSION="${GITHUB_REF#refs/tags/zddc-server-v}" @@ -117,45 +124,48 @@ jobs: exit 1 fi - # Clone tnd-zddc-chart into a tmp workspace. Shallow is fine — - # we only ever produce one commit on top of main. + git config --global user.name "ZDDC Release Bot" + git config --global user.email "noreply@zddc.varasys.io" + + # Push the same appVersion bump to both branches so prod and + # dev images both rebuild against the new ZDDC stable. Loop + # is idempotent per-branch — if a branch's appVersion already + # matches the new version, it's a no-op for that branch. TMP=$(mktemp -d) cd "$TMP" - git clone --depth=20 --branch=main \ - "https://oauth2:${CHART_GITHUB_TOKEN}@github.com/burnsmcd/tnd-zddc-chart.git" - cd tnd-zddc-chart + for BRANCH in main develop; do + echo "" + echo "=== bumping $BRANCH ===" + rm -rf tnd-zddc-chart + git clone --depth=20 --branch="$BRANCH" \ + "https://oauth2:${CHART_GITHUB_TOKEN}@github.com/burnsmcd/tnd-zddc-chart.git" + cd tnd-zddc-chart - # Idempotent: skip if appVersion already matches the new ZDDC - # version (e.g. if the operator already manually bumped it, or - # this job is being re-run on the same tag). - CURRENT=$(grep '^appVersion:' chart/Chart.yaml | sed -E 's/^appVersion: *"?([^"]*)"?.*/\1/') - if [ "$CURRENT" = "$VERSION" ]; then - echo "Chart appVersion already at $VERSION; nothing to do" - exit 0 - fi + CURRENT=$(grep '^appVersion:' chart/Chart.yaml | sed -E 's/^appVersion: *"?([^"]*)"?.*/\1/') + if [ "$CURRENT" = "$VERSION" ]; then + echo " $BRANCH already at $VERSION; nothing to do" + cd .. + continue + fi - # Bump appVersion to track ZDDC stable. Also bump the chart's - # own version (patch) so each deploy carries a unique chart - # identity in JFrog — clean release history vs. silent rev - # within the same chart version. - sed -i "s/^appVersion: .*/appVersion: \"$VERSION\"/" chart/Chart.yaml - OLD_CHART_VER=$(grep '^version:' chart/Chart.yaml | awk '{print $2}') - MAJ=$(echo "$OLD_CHART_VER" | cut -d. -f1) - MIN=$(echo "$OLD_CHART_VER" | cut -d. -f2) - PAT=$(echo "$OLD_CHART_VER" | cut -d. -f3) - NEW_PAT=$((PAT + 1)) - NEW_CHART_VER="$MAJ.$MIN.$NEW_PAT" - sed -i "s/^version: .*/version: $NEW_CHART_VER/" chart/Chart.yaml + sed -i "s/^appVersion: .*/appVersion: \"$VERSION\"/" chart/Chart.yaml + OLD_CHART_VER=$(grep '^version:' chart/Chart.yaml | awk '{print $2}') + MAJ=$(echo "$OLD_CHART_VER" | cut -d. -f1) + MIN=$(echo "$OLD_CHART_VER" | cut -d. -f2) + PAT=$(echo "$OLD_CHART_VER" | cut -d. -f3) + NEW_PAT=$((PAT + 1)) + NEW_CHART_VER="$MAJ.$MIN.$NEW_PAT" + sed -i "s/^version: .*/version: $NEW_CHART_VER/" chart/Chart.yaml - echo " appVersion: $CURRENT → $VERSION" - echo " version: $OLD_CHART_VER → $NEW_CHART_VER" + echo " appVersion: $CURRENT → $VERSION" + echo " version: $OLD_CHART_VER → $NEW_CHART_VER" - git config user.name "ZDDC Release Bot" - git config user.email "noreply@zddc.varasys.io" - git add chart/Chart.yaml - git commit \ - -m "chore(chart): auto-bump appVersion to $VERSION (ZDDC stable cut)" \ - -m "Triggered by zddc-server-v$VERSION tag push on git.varasys.io/VARASYS/ZDDC. Bumps appVersion so the prod Docker image is tagged zddc:$VERSION, ensuring kubelet pulls a fresh image on the next helm upgrade. Chart version bumped to $NEW_CHART_VER (patch) so JFrog has a clean chart history per deploy." \ - -m "Auto-generated by .forgejo/workflows/deploy-release.yml's notify-chart-prod job. Do not edit manually — the next ZDDC stable cut will overwrite this commit's changes." - git push origin main - echo "pushed chart appVersion bump - BMCD pipeline-prod will fire" + git add chart/Chart.yaml + git commit \ + -m "chore(chart): auto-bump appVersion to $VERSION (ZDDC stable cut)" \ + -m "Triggered by zddc-server-v$VERSION tag push on git.varasys.io/VARASYS/ZDDC. Bumps appVersion so the $BRANCH-branch image is tagged zddc:$VERSION, ensuring kubelet pulls a fresh image on the next helm upgrade. Chart version bumped to $NEW_CHART_VER (patch) so JFrog has a clean chart history per deploy." \ + -m "Auto-generated by .forgejo/workflows/deploy-release.yml's notify-chart-prod job. Do not edit manually — the next ZDDC stable cut will overwrite this commit's changes." + git push origin "$BRANCH" + echo " pushed $BRANCH bump - BMCD pipeline-$([ \"$BRANCH\" = main ] && echo prod || echo dev) will fire" + cd .. + done