ci: notify-chart-prod also bumps chart develop on stable cut

Per the bake-in invariant: when no active beta exists, dev tracks
stable. Previously notify-chart-prod only bumped chart's main, so
a stable cut updated BMCD prod but left dev one cut behind until
the next beta or manual dispatch.

Now the job loops through {main, develop} and pushes the same
appVersion bump to both. Each branch push triggers its own BMCD
pipeline (pipeline-prod for main, pipeline-dev for develop), so
prod + dev both rebuild against the new ZDDC stable in parallel.
notify-chart-dev.yml continues to handle the beta-cut path
(advances develop ahead of main between stable cuts).
This commit is contained in:
ZDDC 2026-05-03 19:02:53 -05:00
parent 915ab8a87a
commit 042884ac5d

View file

@ -89,14 +89,21 @@ jobs:
| head -3 | head -3
# On a stable cut (tag push), auto-bump tnd-zddc-chart's appVersion to # 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. # match the new ZDDC version on BOTH chart branches:
# 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 # main → BMCD pipeline-prod fires → prod image rebuilt → prod rolled
# Chart.AppVersion), and helm rolls the deployment. Net effect: a # develop → BMCD pipeline-dev fires → dev image rebuilt → dev rolled
# single ZDDC stable cut deploys to BMCD prod with zero manual steps #
# on the chart repo. Dispatch-only invocations of this workflow # Dev tracking stable is the project invariant for "no active beta"
# (workflow_dispatch with channel=release) skip — the chart bump is # state — when stable advances, dev advances with it. The next beta
# only meaningful when the actual git tag exists at refs/tags/. # 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: notify-chart-prod:
needs: build-and-deploy needs: build-and-deploy
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/zddc-server-v') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/zddc-server-v')
@ -104,7 +111,7 @@ jobs:
env: env:
CHART_GITHUB_TOKEN: ${{ secrets.CHART_GITHUB_TOKEN }} CHART_GITHUB_TOKEN: ${{ secrets.CHART_GITHUB_TOKEN }}
steps: steps:
- name: Auto-bump tnd-zddc-chart appVersion + push to chart main - name: Auto-bump tnd-zddc-chart appVersion on main + develop
run: | run: |
set -eu set -eu
VERSION="${GITHUB_REF#refs/tags/zddc-server-v}" VERSION="${GITHUB_REF#refs/tags/zddc-server-v}"
@ -117,45 +124,48 @@ jobs:
exit 1 exit 1
fi fi
# Clone tnd-zddc-chart into a tmp workspace. Shallow is fine — git config --global user.name "ZDDC Release Bot"
# we only ever produce one commit on top of main. 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) TMP=$(mktemp -d)
cd "$TMP" cd "$TMP"
git clone --depth=20 --branch=main \ for BRANCH in main develop; do
"https://oauth2:${CHART_GITHUB_TOKEN}@github.com/burnsmcd/tnd-zddc-chart.git" echo ""
cd tnd-zddc-chart 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 CURRENT=$(grep '^appVersion:' chart/Chart.yaml | sed -E 's/^appVersion: *"?([^"]*)"?.*/\1/')
# version (e.g. if the operator already manually bumped it, or if [ "$CURRENT" = "$VERSION" ]; then
# this job is being re-run on the same tag). echo " $BRANCH already at $VERSION; nothing to do"
CURRENT=$(grep '^appVersion:' chart/Chart.yaml | sed -E 's/^appVersion: *"?([^"]*)"?.*/\1/') cd ..
if [ "$CURRENT" = "$VERSION" ]; then continue
echo "Chart appVersion already at $VERSION; nothing to do" fi
exit 0
fi
# Bump appVersion to track ZDDC stable. Also bump the chart's sed -i "s/^appVersion: .*/appVersion: \"$VERSION\"/" chart/Chart.yaml
# own version (patch) so each deploy carries a unique chart OLD_CHART_VER=$(grep '^version:' chart/Chart.yaml | awk '{print $2}')
# identity in JFrog — clean release history vs. silent rev MAJ=$(echo "$OLD_CHART_VER" | cut -d. -f1)
# within the same chart version. MIN=$(echo "$OLD_CHART_VER" | cut -d. -f2)
sed -i "s/^appVersion: .*/appVersion: \"$VERSION\"/" chart/Chart.yaml PAT=$(echo "$OLD_CHART_VER" | cut -d. -f3)
OLD_CHART_VER=$(grep '^version:' chart/Chart.yaml | awk '{print $2}') NEW_PAT=$((PAT + 1))
MAJ=$(echo "$OLD_CHART_VER" | cut -d. -f1) NEW_CHART_VER="$MAJ.$MIN.$NEW_PAT"
MIN=$(echo "$OLD_CHART_VER" | cut -d. -f2) sed -i "s/^version: .*/version: $NEW_CHART_VER/" chart/Chart.yaml
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 " appVersion: $CURRENT → $VERSION"
echo " version: $OLD_CHART_VER → $NEW_CHART_VER" echo " version: $OLD_CHART_VER → $NEW_CHART_VER"
git config user.name "ZDDC Release Bot" git add chart/Chart.yaml
git config user.email "noreply@zddc.varasys.io" git commit \
git add chart/Chart.yaml -m "chore(chart): auto-bump appVersion to $VERSION (ZDDC stable cut)" \
git commit \ -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 "chore(chart): auto-bump appVersion to $VERSION (ZDDC stable cut)" \ -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."
-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." \ git push origin "$BRANCH"
-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." echo " pushed $BRANCH bump - BMCD pipeline-$([ \"$BRANCH\" = main ] && echo prod || echo dev) will fire"
git push origin main cd ..
echo "pushed chart appVersion bump - BMCD pipeline-prod will fire" done