Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

Release TrueForge at the TrueFoundry chart version (#933)

Raman Tehlane89294f65c1d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d2298007a..1a3471b47 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,7 +25,6 @@ jobs:
packages: ${{ steps.packages.outputs.list }}
chart: ${{ steps.filter.outputs.chart }}
store: ${{ steps.filter.outputs.store }}
- release: ${{ steps.filter.outputs.release }}
steps:
- name: Check out repository code
@@ -97,11 +96,6 @@ jobs:
- 'Dockerfile'
- 'package.json'
- '.github/workflows/ci.yml'
- release:
- - 'scripts/resolve-chart-version.sh'
- - 'tests/scripts/**'
- - 'package.json'
- - '.github/workflows/ci.yml'
- name: Build package matrix
id: packages
@@ -276,30 +270,6 @@ jobs:
- name: Lint chart
run: pnpm chart:lint
- # Release-only scripts: not part of the shipped packages, so they stay off the
- # always-on path and run when the release wiring or its tests change.
- release-scripts:
- name: Release Scripts
- needs: detect-changes
- if: needs.detect-changes.outputs.release == 'true'
- runs-on: ubuntu-latest
- timeout-minutes: 10
-
- steps:
- - name: Check out repository code
- uses: actions/checkout@v7
-
- - name: Setup pnpm
- uses: pnpm/action-setup@v6
-
- - name: Setup Node.js
- uses: actions/setup-node@v7
- with:
- node-version: '24'
-
- - name: Chart version resolver
- run: pnpm test:chart-version
-
# Store contract suites when store paths change. Parallel with typecheck-and-build.
store-tests:
name: Store Tests
@@ -356,7 +326,6 @@ jobs:
- typecheck-and-build
- package-checks
- chart-checks
- - release-scripts
- store-tests
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -368,15 +337,13 @@ jobs:
TYPECHECK_AND_BUILD: ${{ needs.typecheck-and-build.result }}
PACKAGE_CHECKS: ${{ needs.package-checks.result }}
CHART_CHECKS: ${{ needs.chart-checks.result }}
- RELEASE_SCRIPTS: ${{ needs.release-scripts.result }}
STORE_TESTS: ${{ needs.store-tests.result }}
run: |
ok() { [ "$1" = success ] || [ "$1" = skipped ]; }
- echo "detect-changes=$DETECT_CHANGES migration-order=$MIGRATION_ORDER typecheck-and-build=$TYPECHECK_AND_BUILD package-checks=$PACKAGE_CHECKS chart-checks=$CHART_CHECKS release-scripts=$RELEASE_SCRIPTS store-tests=$STORE_TESTS"
+ echo "detect-changes=$DETECT_CHANGES migration-order=$MIGRATION_ORDER typecheck-and-build=$TYPECHECK_AND_BUILD package-checks=$PACKAGE_CHECKS chart-checks=$CHART_CHECKS store-tests=$STORE_TESTS"
[ "$DETECT_CHANGES" = success ] || exit 1
[ "$MIGRATION_ORDER" = success ] || exit 1
[ "$TYPECHECK_AND_BUILD" = success ] || exit 1
ok "$PACKAGE_CHECKS" || exit 1
ok "$CHART_CHECKS" || exit 1
- ok "$RELEASE_SCRIPTS" || exit 1
ok "$STORE_TESTS" || exit 1
diff --git a/.github/workflows/release-chart.yml b/.github/workflows/release-chart.yml
index c7cda13fc..7f0cc4fcd 100644
--- a/.github/workflows/release-chart.yml
+++ b/.github/workflows/release-chart.yml
@@ -2,18 +2,25 @@ name: Publish Helm chart
# Publishes the Helm chart for an image that already exists in the registry.
# Does not build images: release.yml builds {appVersion}-{shortSha} and then
-# calls this workflow with (branch, app_version, image_tag).
+# calls this workflow with (branch, chart_version, app_version, image_tag).
# branch is the release-vX.Y.Z branch release.yml is running on.
#
-# Steps: resolve the next chart version from Chart.yaml on origin/<branch>, write
-# appVersion / image.tag / version, lint, package, push OCI, commit those files
-# to that branch, then tag charts/trueforge@<chartVersion> on that commit.
+# chart_version is the parent chart version, verbatim. Nothing in this repo
+# computes it: one field, one owner. appVersion follows the npm package and
+# image.tag follows the image release.yml built.
+#
+# Order matters. Metadata commit and tag come before `helm push`, so a failed
+# push leaves a recoverable branch state rather than an orphan chart in OCI.
+# Every step is idempotent: metadata already at the target version skips the
+# commit, the tag on the same commit is a no-op, the tag on a different commit
+# is a hard failure (same chart version, different content), and a chart version
+# already in the registry skips the push.
#
# Manual runs: `gh workflow run release-chart.yml --ref <workflow-file-ref>`.
# --ref is the workflow file GitHub runs (branch or tag, not a SHA).
# `branch` is the git branch that receives Chart.yaml / values.yaml.
-# Empty app_version / image_tag keep Chart.yaml appVersion and values.yaml image.tag
-# on origin/<branch>.
+# Empty app_version / image_tag keep Chart.yaml appVersion and values.yaml
+# image.tag on origin/<branch>. chart_version is always required.
on:
workflow_call:
inputs:
@@ -21,14 +28,25 @@ on:
description: Git branch that receives the Chart.yaml / values.yaml commit
required: true
type: string
- app_version:
- description: Application version written to Chart.yaml appVersion
+ chart_version:
+ description: 'Chart version to publish, verbatim: X.Y.Z or X.Y.Z-rc.N'
required: true
type: string
+ app_version:
+ description: Application version written to Chart.yaml appVersion (empty = keep the value on that branch)
+ required: false
+ type: string
image_tag:
- description: Image tag already pushed to the registry, written to values.yaml image.tag
- required: true
+ description: Image tag already pushed to the registry, written to values.yaml image.tag (empty = keep the value on that branch)
+ required: false
type: string
+ # DRY-RUN (temporary): resolve, lint and commit metadata, but push no tags
+ # and nothing to OCI. Grep DRY-RUN to remove.
+ dry_run:
+ description: 'Dry run: skip the git tags and the OCI push'
+ required: false
+ default: false
+ type: boolean
workflow_dispatch:
inputs:
branch:
@@ -36,6 +54,10 @@ on:
required: true
type: string
default: main
+ chart_version:
+ description: 'Chart version to publish, verbatim: X.Y.Z or X.Y.Z-rc.N'
+ required: true
+ type: string
app_version:
description: App version (empty = Chart.yaml appVersion on that branch)
required: false
@@ -44,6 +66,11 @@ on:
description: Existing image tag (empty = values.yaml image.tag on that branch)
required: false
type: string
+ dry_run: # DRY-RUN (temporary)
+ description: 'Dry run: skip the git tags and the OCI push'
+ required: false
+ default: false
+ type: boolean
permissions: {}
@@ -90,6 +117,7 @@ jobs:
id: resolve
env:
INPUT_BRANCH: ${{ inputs.branch }}
+ INPUT_CHART_VERSION: ${{ inputs.chart_version }}
INPUT_APP_VERSION: ${{ inputs.app_version }}
INPUT_IMAGE_TAG: ${{ inputs.image_tag }}
run: |
@@ -104,6 +132,11 @@ jobs:
git checkout -B "chart-release-${GITHUB_RUN_ID}-$(openssl rand -hex 4)" "origin/${BRANCH}"
SEMVER='^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$'
+ CHART_VERSION="$INPUT_CHART_VERSION"
+ if [[ -z "$CHART_VERSION" ]] || ! printf '%s' "$CHART_VERSION" | grep -Eq "$SEMVER"; then
+ echo "chart_version '$CHART_VERSION' is not a semver-like version" >&2
+ exit 1
+ fi
APP_VERSION="$INPUT_APP_VERSION"
if [[ -z "$APP_VERSION" ]]; then
APP_VERSION=$(yq -r '.appVersion' "$CHART_DIR/Chart.yaml")
@@ -122,24 +155,21 @@ jobs:
exit 1
fi
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
+ echo "chart_version=$CHART_VERSION" >> "$GITHUB_OUTPUT"
echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
- echo "Resolved branch=$BRANCH app_version=$APP_VERSION image_tag=$IMAGE_TAG"
+ echo "Resolved branch=$BRANCH chart_version=$CHART_VERSION app_version=$APP_VERSION image_tag=$IMAGE_TAG"
- name: Update chart metadata
- id: chart
env:
+ VERSION: ${{ steps.resolve.outputs.chart_version }}
APP_VERSION: ${{ steps.resolve.outputs.app_version }}
IMAGE_TAG: ${{ steps.resolve.outputs.image_tag }}
run: |
set -euo pipefail
- CURRENT=$(yq -r '.version' "$CHART_DIR/Chart.yaml")
- VERSION=$(bash scripts/resolve-chart-version.sh "$CURRENT" "$APP_VERSION")
- export VERSION IMAGE_TAG APP_VERSION
yq -i '.version = strenv(VERSION)' "$CHART_DIR/Chart.yaml"
yq -i '.appVersion = strenv(APP_VERSION)' "$CHART_DIR/Chart.yaml"
yq -i '.image.tag = strenv(IMAGE_TAG)' "$CHART_DIR/values.yaml"
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Chart version=$VERSION appVersion=$APP_VERSION image.tag=$IMAGE_TAG"
- name: Build chart dependencies
@@ -156,62 +186,128 @@ jobs:
printf '%s' "$HELM_REGISTRY_PASSWORD" \
| helm registry login -u "$HELM_REGISTRY_USERNAME" --password-stdin "$HELM_REGISTRY_URL"
- - name: Package and push chart
+ # Answered before anything is written, so the push and the metadata commit
+ # can be skipped independently. Ambiguous failures fall through to
+ # published=false: attempting the push and letting helm fail is safer than
+ # skipping a release because the registry was unreachable.
+ - name: Check whether this chart version is already published
+ id: registry
env:
- VERSION: ${{ steps.chart.outputs.version }}
- IMAGE_TAG: ${{ steps.resolve.outputs.image_tag }}
- BRANCH: ${{ steps.resolve.outputs.branch }}
+ VERSION: ${{ steps.resolve.outputs.chart_version }}
run: |
set -euo pipefail
CHART_NAME=$(yq -r '.name' "$CHART_DIR/Chart.yaml")
- mkdir -p dist
- helm package "$CHART_DIR" --destination dist
- PACKAGE="dist/${CHART_NAME}-${VERSION}.tgz"
- echo "Pushing $PACKAGE to oci://$HELM_CHART_REPOSITORY"
- helm push "$PACKAGE" "oci://$HELM_CHART_REPOSITORY"
- {
- echo "### Helm chart"
- echo "Pushed \`oci://${HELM_CHART_REPOSITORY}/${CHART_NAME}:${VERSION}\`"
- echo "Image tag \`${IMAGE_TAG}\`"
- echo "Branch \`${BRANCH}\`"
- } >> "$GITHUB_STEP_SUMMARY"
+ set +e
+ SHOW_OUT=$(helm show chart "oci://${HELM_CHART_REPOSITORY}/${CHART_NAME}" --version "$VERSION" 2>&1)
+ SHOW_STATUS=$?
+ set -e
+ if [[ "$SHOW_STATUS" -eq 0 ]]; then
+ echo "published=true" >> "$GITHUB_OUTPUT"
+ echo "${CHART_NAME}:${VERSION} is already in oci://${HELM_CHART_REPOSITORY}; the push will be skipped"
+ exit 0
+ fi
+ echo "published=false" >> "$GITHUB_OUTPUT"
+ if ! printf '%s' "$SHOW_OUT" | grep -qiE 'not found|manifest unknown|MANIFEST_UNKNOWN|NAME_UNKNOWN|404'; then
+ printf '%s\n' "$SHOW_OUT"
+ echo "::warning::could not confirm ${CHART_NAME}:${VERSION} is absent from the registry; attempting the push"
+ fi
- name: Commit chart metadata and tag
env:
- VERSION: ${{ steps.chart.outputs.version }}
+ VERSION: ${{ steps.resolve.outputs.chart_version }}
APP_VERSION: ${{ steps.resolve.outputs.app_version }}
IMAGE_TAG: ${{ steps.resolve.outputs.image_tag }}
BRANCH: ${{ steps.resolve.outputs.branch }}
+ DRY_RUN: ${{ inputs.dry_run }} # DRY-RUN (temporary)
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ CHART_TAG="charts/trueforge@${VERSION}"
+ VTAG="v${VERSION}"
+
apply_metadata() {
- export VERSION IMAGE_TAG APP_VERSION
yq -i '.version = strenv(VERSION)' "$CHART_DIR/Chart.yaml"
yq -i '.appVersion = strenv(APP_VERSION)' "$CHART_DIR/Chart.yaml"
yq -i '.image.tag = strenv(IMAGE_TAG)' "$CHART_DIR/values.yaml"
}
- # Tag only after the metadata commit is on the branch, so the tag
- # points at the commit that holds the published Chart.yaml / values.yaml.
- tag_chart() {
- TAG="charts/trueforge@${VERSION}"
- if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
- echo "Tag $TAG already exists" >&2
+ # Two tags, one commit. The tag is the record that this chart version's
+ # metadata is on the branch. Same commit is a re-run and a no-op. A
+ # different commit means the same chart version would ship different
+ # content: the version has to move instead.
+ #
+ # charts/trueforge@<V> this chart's own record. ANNOTATED, because
+ # helm-charts' resolve_ref_sha already does the
+ # /git/tags/{sha} dereference hop for it.
+ # v<V> the release-line marker every other
+ # sibling repo publishes. Under verbatim
+ # versioning <V> is the parent chart
+ # version, so release-app's hotfixBranchPlan
+ # (git/matching-refs/tags/v<major>.<minor>.)
+ # and helm-charts' compute_release both resolve
+ # this repo with no TrueForge-specific code.
+ # LIGHTWEIGHT on purpose: release-app's
+ # getRefSha returns object.sha with NO
+ # annotated-tag dereference and hands it
+ # straight to createBranchFromSha, so an
+ # annotated v-tag would hand create-ref a
+ # tag-object sha. helm-charts creates every
+ # service v-tag the same way (publish_releases
+ # POSTs git/refs with a commit sha). Do not
+ # add -a here.
+ #
+ # This repo still carries dead v0.1.x tags from an abandoned scheme
+ # (highest final v0.1.9, 2026-08-09; plus a stray v0.1.10-rc.1 from
+ # 2026-08-13). They cannot collide: consumers query
+ # git/matching-refs/tags/v<major>.<minor>. and the umbrella is on 0.17x
+ # and up. Never dispatch a chart_version on the 0.1 line - it would
+ # revive that line underneath a live consumer.
+ push_tag() {
+ local name=$1 kind=$2 head existing
+ head=$(git rev-parse HEAD)
+ if git ls-remote --exit-code --tags origin "refs/tags/${name}" >/dev/null 2>&1; then
+ git fetch --force --no-tags origin "refs/tags/${name}:refs/tags/${name}"
+ existing=$(git rev-list -n 1 "refs/tags/${name}")
+ if [[ "$existing" == "$head" ]]; then
+ echo "Tag $name already points at $head"
+ return 0
+ fi
+ echo "Tag $name already exists at $existing but this run would publish $head" >&2
+ echo "Same chart version, different content. Bump chart_version instead." >&2
exit 1
fi
- git tag -a "$TAG" -m "Helm chart ${VERSION} (image ${IMAGE_TAG})"
- git push origin "$TAG"
- echo "Pushed $TAG at $(git rev-parse HEAD)"
+ if [[ "$kind" == "annotated" ]]; then
+ git tag -a "$name" -m "Helm chart ${VERSION} (image ${IMAGE_TAG})"
+ else
+ git tag "$name"
+ fi
+ if [[ "${DRY_RUN:-false}" == "true" ]]; then
+ # DRY-RUN (temporary)
+ echo "::notice::dry run - would push $kind tag $name at $head"
+ git tag -d "$name" >/dev/null
+ return 0
+ fi
+ git push origin "refs/tags/${name}"
+ echo "Pushed $name at $head"
+ }
+
+ # Each tag is checked and pushed independently, so a run that died
+ # between the two pushes self-heals on re-run: the first is a no-op,
+ # the second is created.
+ tag_chart() {
+ push_tag "$CHART_TAG" annotated
+ push_tag "$VTAG" lightweight
}
for attempt in 1 2 3; do
git add "$CHART_DIR/Chart.yaml" "$CHART_DIR/values.yaml"
if git diff --staged --quiet; then
- echo "Chart metadata already matches $VERSION; refusing to no-op" >&2
- exit 1
+ # Re-run: origin/<branch> already carries this version's metadata.
+ echo "Chart metadata on $BRANCH already matches $VERSION; nothing to commit"
+ tag_chart
+ exit 0
fi
git commit -m "release(chart): ${VERSION}"
if git push origin "HEAD:${BRANCH}"; then
@@ -226,15 +322,44 @@ jobs:
echo "Could not fast-forward chart metadata onto $BRANCH" >&2
exit 1
- - name: Record published chart version
+ - name: Dry run - report what would have been published
+ if: ${{ inputs.dry_run == true }} # DRY-RUN (temporary)
env:
- VERSION: ${{ steps.chart.outputs.version }}
- run: printf '%s\n' "$VERSION" > "$RUNNER_TEMP/chart-version.txt"
+ VERSION: ${{ steps.resolve.outputs.chart_version }}
+ IMAGE_TAG: ${{ steps.resolve.outputs.image_tag }}
+ PUBLISHED: ${{ steps.registry.outputs.published }}
+ run: |
+ {
+ echo "### Dry run - nothing was published"
+ echo ""
+ echo "| Would have | Value |"
+ echo "| --- | --- |"
+ echo "| pushed chart | \`$VERSION\` |"
+ echo "| tagged | \`charts/trueforge@$VERSION\` (annotated), \`v$VERSION\` (lightweight) |"
+ echo "| image tag in values | \`${IMAGE_TAG:-unchanged on the branch}\` |"
+ echo "| already in OCI | \`$PUBLISHED\` |"
+ } >> "$GITHUB_STEP_SUMMARY"
- - name: Upload chart version
- uses: actions/upload-artifact@v4
- with:
- name: trueforge-chart-version
- path: ${{ runner.temp }}/chart-version.txt
- retention-days: 5
- if-no-files-found: error
+ - name: Package and push chart
+ # DRY-RUN (temporary): `&& inputs.dry_run != true`. The package+push is
+ # the one step with no idempotent re-entry, so it is skipped whole
+ # rather than short-circuited inside the script.
+ if: steps.registry.outputs.published != 'true' && inputs.dry_run != true
+ env:
+ VERSION: ${{ steps.resolve.outputs.chart_version }}
+ IMAGE_TAG: ${{ steps.resolve.outputs.image_tag }}
+ BRANCH: ${{ steps.resolve.outputs.branch }}
+ run: |
+ set -euo pipefail
+ CHART_NAME=$(yq -r '.name' "$CHART_DIR/Chart.yaml")
+ mkdir -p dist
+ helm package "$CHART_DIR" --destination dist
+ PACKAGE="dist/${CHART_NAME}-${VERSION}.tgz"
+ echo "Pushing $PACKAGE to oci://$HELM_CHART_REPOSITORY"
+ helm push "$PACKAGE" "oci://$HELM_CHART_REPOSITORY"
+ {
+ echo "### Helm chart"
+ echo "Pushed \`oci://${HELM_CHART_REPOSITORY}/${CHART_NAME}:${VERSION}\`"
+ echo "Image tag \`${IMAGE_TAG}\`"
+ echo "Branch \`${BRANCH}\`"
+ } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0082df1ab..c36c97142 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,48 +1,55 @@
-# npm publish for the four public packages, plus PyPI for python/trueforge_sdk.
+# npm publish for the four public packages, PyPI for python/trueforge_sdk, two
+# server images, and the Helm chart. One dispatch, one run, one conclusion:
+# success means published.
#
# npm and PyPI trusted publishers are bound to this filename (`release.yml`).
# Do not rename it without updating every package on npmjs.com and PyPI.
#
-# Releases run on release-vX.Y.Z, not main. main only collects changesets.
-#
+# Releases run on release-vX.Y.Z, never on main. main only collects changesets.
# helm-charts dispatches this workflow with tfy_chart_version (X.Y.Z or
-# X.Y.Z-rc.N) on ref release-vX.Y.Z. That run prepares pre mode and any
-# 0.0.0 packages, runs changeset version, and auto-merges the Version
-# Packages PR. changesets/action/version hard-resets to the triggering SHA
-# before its script, which would drop that prep, so the dispatch job runs
-# `pnpm run version` itself and opens the same PR.
+# X.Y.Z-rc.N) on ref release-vX.Y.Z. There is no push trigger: the orchestrator
+# is the only entry point, so a run's conclusion is the release outcome.
+#
+# version-release prepares pre mode and any 0.0.0 packages, runs
+# `changeset version`, and commits the result straight to the release branch.
+# Every later job checks out that commit: actions/checkout defaults to the SHA
+# at dispatch time, which predates the version bump.
#
-# The merge push to release-v* uses changesets/action/select-mode:
-# - pending `.changeset/*.md` → version job opens/updates the Version Packages PR.
-# When @truefoundry/trueforge-sdk moves, scripts/version.mjs mirrors that
-# version into python/trueforge_sdk and rebakes Fern.
-# - none pending + unpublished versions → pack (build/test) + Windows npx smoke
-# in parallel with the from-source image (image waits only on npm view of
-# @truefoundry/trueforge@version; skip image+chart if that version is already
-# on npm). The release builds two images with the same tag: a public image
-# on node:24-slim, and a hardened image on the TrueFoundry private node
-# bases. Local and contributor builds stay on node:24-slim.
-# After both images are pushed, this workflow calls release-chart.yml
-# with this branch, app_version, and image_tag. Helm does not wait on pack.
-# After Helm publish, release-chart.yml tags charts/trueforge@<chartVersion>
-# on the metadata commit and uploads the trueforge-chart-version artifact.
+# changesets/action/select-mode then reports whether anything is left to
+# publish. `publish` means pack (build/test) + Windows npx smoke gate npm and
+# PyPI. `none` is normal and not an error: a line with no changesets since the
+# last release still has to publish a chart at the requested version.
#
-# Auth is GitHub OIDC (no NPM_TOKEN / PYPI_TOKEN). An `_authToken` in user `.npmrc`
-# disables pnpm's OIDC exchange, so the npm publish job must not set NPM_TOKEN /
-# NODE_AUTH_TOKEN. id-token is granted on the publish jobs and on the image job
-# (OIDC into the private registry to pull the hardened bases, and Cosign signing).
+# The image and chart path is independent of npm. It is gated on the
+# charts/trueforge@<tfy_chart_version> tag: absent means this version has not
+# been cut yet, so build both images (public on node:24-slim, hardened on the
+# private hardened node bases) and publish the chart. Present means a
+# re-run - reuse the images the tagged commit already references and let
+# release-chart.yml finish whatever is missing.
+#
+# Auth is GitHub OIDC (no NPM_TOKEN / PYPI_TOKEN). An `_authToken` in user
+# `.npmrc` disables pnpm's OIDC exchange, so the npm publish job must not set
+# NPM_TOKEN / NODE_AUTH_TOKEN. id-token is granted on the publish jobs and on
+# the image jobs (OIDC into the private registry for the hardened bases, and
+# Cosign signing).
name: Version or publish packages
on:
- push:
- branches:
- - 'release-v*'
workflow_dispatch:
inputs:
tfy_chart_version:
description: 'TrueFoundry chart version: X.Y.Z or X.Y.Z-rc.N'
required: true
type: string
+ # DRY-RUN (temporary): exercise the whole pipeline without publishing
+ # anything outside this repo. Commits to the release branch still happen
+ # - downstream jobs check that commit out - so dispatch it on a scratch
+ # release-v* branch you are willing to delete. Grep DRY-RUN to remove.
+ dry_run:
+ description: 'Dry run: skip npm, PyPI, images, git tags, the OCI push and the back-merge'
+ required: false
+ default: false
+ type: boolean
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -52,18 +59,19 @@ concurrency:
permissions: {}
jobs:
- # Dispatch-only. Push runs take the select-mode path below.
version-release:
name: Version packages for TrueFoundry release
- if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
- mode: ${{ steps.finish.outputs.mode }}
+ # Every downstream job checks this out; actions/checkout's default ref is
+ # the pre-version SHA from the dispatch.
+ sha: ${{ steps.commit.outputs.sha }}
+ final_minor: ${{ steps.commit.outputs.final_minor }}
+ mode: ${{ steps.select-mode.outputs.mode }}
publish-plan-artifact-id: ${{ steps.select-mode.outputs.publish-plan-artifact-id }}
permissions:
contents: write
- pull-requests: write
steps:
- id: app-token
uses: actions/create-github-app-token@v3
@@ -74,6 +82,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v7
with:
+ # Full history so `changeset version` can write CHANGELOG from commits.
fetch-depth: 0
persist-credentials: false
token: ${{ steps.app-token.outputs.token }}
@@ -97,8 +106,8 @@ jobs:
node scripts/prepare-release.mjs
pnpm run version
- - name: Open and auto-merge Version Packages PR
- id: finish
+ - name: Commit versions to the release branch
+ id: commit
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
RELEASE_BRANCH: ${{ github.ref_name }}
@@ -106,115 +115,43 @@ jobs:
HUSKY: '0'
run: |
set -euo pipefail
+
+ # Only a final minor drains main. A hotfix (X.Y.Z, Z>0) must not:
+ # its changeset still sits on main from the source PR and belongs in
+ # the next minor's changelog too.
+ if [[ "$TFY_CHART_VERSION" =~ ^[0-9]+\.[0-9]+\.0$ ]]; then
+ echo "final_minor=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "final_minor=false" >> "$GITHUB_OUTPUT"
+ fi
+
if [ -z "$(git status --porcelain)" ]; then
- echo "mode=publish" >> "$GITHUB_OUTPUT"
- echo "Nothing to version; publishing this branch"
+ SHA="$(git rev-parse HEAD)"
+ echo "sha=$SHA" >> "$GITHUB_OUTPUT"
+ echo "Nothing to version; releasing ${RELEASE_BRANCH} at $SHA"
exit 0
fi
+
gh auth setup-git
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- VERSION_BRANCH="changeset-release/${RELEASE_BRANCH}"
- git checkout -B "$VERSION_BRANCH"
git add -A
- git commit -m "Version Packages"
- git push --force origin "HEAD:${VERSION_BRANCH}"
- EXISTING="$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$VERSION_BRANCH" --base "$RELEASE_BRANCH" --state open --json number --jq '.[0].number // empty')"
- if [ -z "$EXISTING" ]; then
- gh pr create \
- --repo "$GITHUB_REPOSITORY" \
- --base "$RELEASE_BRANCH" \
- --head "$VERSION_BRANCH" \
- --title "Version Packages" \
- --body "Versions packages for TrueFoundry chart release ${TFY_CHART_VERSION} on ${RELEASE_BRANCH}. Auto-merge publishes npm, PyPI, the image, and the Helm chart from the merge push."
- EXISTING="$(gh pr view "$VERSION_BRANCH" --repo "$GITHUB_REPOSITORY" --json number --jq .number)"
- fi
- gh pr merge "$EXISTING" --repo "$GITHUB_REPOSITORY" --merge --auto
- echo "mode=version" >> "$GITHUB_OUTPUT"
-
- # Same-run publish: pack/publish need a publish plan, and the push-path
- # select-mode job never runs on a dispatch.
+ git commit -m "Version Packages for ${TFY_CHART_VERSION}"
+ git push origin "HEAD:${RELEASE_BRANCH}"
+ SHA="$(git rev-parse HEAD)"
+ echo "sha=$SHA" >> "$GITHUB_OUTPUT"
+ echo "Committed versions for ${TFY_CHART_VERSION} as $SHA"
+
+ # After the commit, so it reads the versioned tree. `none` is a valid
+ # outcome and is not treated as a failure.
- name: Select Changesets mode
id: select-mode
- if: steps.finish.outputs.mode == 'publish'
uses: changesets/action/select-mode@v2
- select-mode:
- name: Select mode
- if: github.event_name == 'push'
- runs-on: ubuntu-latest
- timeout-minutes: 10
- outputs:
- mode: ${{ steps.select-mode.outputs.mode }}
- publish-plan-artifact-id: ${{ steps.select-mode.outputs.publish-plan-artifact-id }}
- permissions:
- contents: read
- steps:
- - name: Check out repo
- uses: actions/checkout@v7
- with:
- persist-credentials: false
-
- - uses: pnpm/action-setup@v6
-
- - name: Set up Node.js
- uses: actions/setup-node@v7
- with:
- node-version: 24
- cache: pnpm
-
- - run: pnpm install --frozen-lockfile
-
- - name: Select Changesets mode
- id: select-mode
- uses: changesets/action/select-mode@v2
-
- version:
- name: Version packages
- if: needs.select-mode.outputs.mode == 'version'
- needs: select-mode
- runs-on: ubuntu-latest
- # Fern rebake when the sdk version moves.
- timeout-minutes: 30
- permissions:
- contents: write
- pull-requests: write
- steps:
- - name: Check out repo
- uses: actions/checkout@v7
- with:
- # Full history so `changeset version` can write CHANGELOG from commits.
- fetch-depth: 0
- persist-credentials: false
-
- - uses: pnpm/action-setup@v6
-
- - name: Set up Node.js
- uses: actions/setup-node@v7
- with:
- node-version: 24
- cache: pnpm
-
- - run: pnpm install --frozen-lockfile
-
- # Must be @v2: @changesets/cli@3 stores applied RC changesets under
- # `.changeset/pre/`; @v1 still expects folder-style `pre/changes.md` and
- # fails with ENOENT right after the Version Packages merge.
- - name: Version packages
- id: version
- uses: changesets/action/version@v2
- env:
- FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
- with:
- script: pnpm run version
- push-with-git-cli: true
-
- # Exactly one of select-mode / version-release runs; the other is skipped and
- # reports an empty mode. `!cancelled()` is what stops that skip from cascading.
pack:
name: Pack packages
- if: ${{ !cancelled() && (needs.select-mode.outputs.mode == 'publish' || needs.version-release.outputs.mode == 'publish') }}
- needs: [select-mode, version-release]
+ if: needs.version-release.outputs.mode == 'publish'
+ needs: [version-release]
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
@@ -225,6 +162,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v7
with:
+ ref: ${{ needs.version-release.outputs.sha }}
persist-credentials: false
- uses: pnpm/action-setup@v6
@@ -250,12 +188,12 @@ jobs:
id: pack
uses: changesets/action/pack@v2
with:
- publish-plan-artifact-id: ${{ needs.select-mode.outputs.publish-plan-artifact-id || needs.version-release.outputs.publish-plan-artifact-id }}
+ publish-plan-artifact-id: ${{ needs.version-release.outputs.publish-plan-artifact-id }}
windows-npx-smoke:
name: Windows npx smoke
- if: ${{ !cancelled() && (needs.select-mode.outputs.mode == 'publish' || needs.version-release.outputs.mode == 'publish') }}
- needs: [select-mode, version-release]
+ if: needs.version-release.outputs.mode == 'publish'
+ needs: [version-release]
runs-on: windows-latest
timeout-minutes: 30
permissions:
@@ -264,6 +202,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v7
with:
+ ref: ${{ needs.version-release.outputs.sha }}
persist-credentials: false
- uses: pnpm/action-setup@v6
@@ -272,7 +211,11 @@ jobs:
uses: actions/setup-node@v7
with:
node-version: 24
- cache: pnpm
+ # No package-manager cache: this job checks out a commit this run just
+ # created (version-release.outputs.sha), and writing an Actions cache
+ # from an expression-derived ref is the cache-poisoning shape CodeQL
+ # flags. The other two jobs on this ref already opt out.
+ package-manager-cache: false
- run: pnpm install --frozen-lockfile
@@ -281,7 +224,8 @@ jobs:
publish:
name: Publish packages
- needs: [pack, windows-npx-smoke]
+ needs: [version-release, pack, windows-npx-smoke]
+ if: ${{ inputs.dry_run != true }} # DRY-RUN (temporary)
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
@@ -291,6 +235,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v7
with:
+ ref: ${{ needs.version-release.outputs.sha }}
persist-credentials: false
- uses: pnpm/action-setup@v6
@@ -321,7 +266,8 @@ jobs:
# Sibling of npm publish (same gates). Skips when pyproject version is already on PyPI.
publish-python:
name: Publish Python SDK
- needs: [pack, windows-npx-smoke]
+ needs: [version-release, pack, windows-npx-smoke]
+ if: ${{ inputs.dry_run != true }} # DRY-RUN (temporary)
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
@@ -331,6 +277,7 @@ jobs:
- name: Check out repo
uses: actions/checkout@v7
with:
+ ref: ${{ needs.version-release.outputs.sha }}
persist-credentials: false
- name: Set up Python
@@ -378,10 +325,13 @@ jobs:
with:
packages-dir: python/trueforge_sdk/dist
+ # Independent of npm. The chart version is the dispatch input, so "already
+ # released?" is answered by the charts/trueforge@<version> tag, which
+ # release-chart.yml writes before it pushes to OCI. A line with no changesets
+ # since the last release publishes no packages and still needs a chart.
resolve-image:
name: Resolve image identity
- if: ${{ !cancelled() && (needs.select-mode.outputs.mode == 'publish' || needs.version-release.outputs.mode == 'publish') }}
- needs: [select-mode, version-release]
+ needs: [version-release]
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
@@ -389,13 +339,14 @@ jobs:
image_tag: ${{ steps.resolve.outputs.image_tag }}
# "build" or "skip", not true/false. GitHub drops a job output whose
# value is the string false, which would skip the image builds.
- skip: ${{ steps.resolve.outputs.skip }}
+ image: ${{ steps.resolve.outputs.image }}
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@v7
with:
+ ref: ${{ needs.version-release.outputs.sha }}
persist-credentials: false
- name: Set up Node.js
@@ -405,6 +356,9 @@ jobs:
- name: Resolve image identity
id: resolve
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ CHART_VERSION: ${{ inputs.tfy_chart_version }}
run: |
set -euo pipefail
SEMVER='^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$'
@@ -414,24 +368,69 @@ jobs:
exit 1
fi
IMAGE_TAG="${APP_VERSION}-$(git rev-parse --short=7 HEAD)"
- echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
- echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
-
- set +e
- VIEW_OUT=$(npm view "@truefoundry/trueforge@${APP_VERSION}" version 2>&1)
- VIEW_STATUS=$?
- set -e
- if [[ "$VIEW_STATUS" -eq 0 && -n "$VIEW_OUT" ]]; then
- echo "skip=skip" >> "$GITHUB_OUTPUT"
- echo "@truefoundry/trueforge@$APP_VERSION is already on npm; skipping image and chart"
- elif printf '%s' "$VIEW_OUT" | grep -qiE 'E404|404 Not Found|npm error 404'; then
- echo "skip=build" >> "$GITHUB_OUTPUT"
- echo "@truefoundry/trueforge@$APP_VERSION is not on npm; building image $IMAGE_TAG"
- else
- printf '%s\n' "$VIEW_OUT" >&2
- echo "npm view failed for @truefoundry/trueforge@$APP_VERSION" >&2
- exit 1
+
+ # matching-refs, not git/ref: a miss returns 200 + [], so "absent" is
+ # distinguishable from an API error. It is a prefix match, hence the
+ # exact-.ref filter. git ls-remote is unavailable here because the
+ # checkout runs with persist-credentials: false.
+ TAG="charts/trueforge@${CHART_VERSION}"
+ FOUND=$(gh api "repos/${GITHUB_REPOSITORY}/git/matching-refs/tags/${TAG}" \
+ --jq "[.[] | select(.ref == \"refs/tags/${TAG}\")] | length")
+ if [[ "$FOUND" == "0" ]]; then
+ echo "image=build" >> "$GITHUB_OUTPUT"
+ echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
+ echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
+ echo "$TAG does not exist; building image $IMAGE_TAG"
+ exit 0
+ fi
+
+ # Re-run of an already-cut version. The tagged commit names the image
+ # that belongs to this chart version; rebuilding under a new SHA would
+ # make the same chart version disagree with itself. Empty outputs tell
+ # release-chart.yml to keep the values already on the branch.
+ echo "image=skip" >> "$GITHUB_OUTPUT"
+ echo "app_version=" >> "$GITHUB_OUTPUT"
+ echo "image_tag=" >> "$GITHUB_OUTPUT"
+ echo "$TAG already exists; reusing the image the tagged commit references"
+
+ # The two image jobs call a shared reusable workflow that checks out with
+ # no `ref`, so it gets `github.sha` - the pre-version dispatch commit,
+ # not the commit `version-release` just made. The tag and the chart's
+ # appVersion would then describe a tree the image was not built from.
+ #
+ # Refuse rather than ship a mislabelled image. This fires only when an
+ # image would actually be built AND the version commit moved:
+ # - nothing to version (clean tree) -> sha == github.sha, image correct
+ # - re-run of a cut version -> image == skip, nothing is built
+ # - dry run -> both build jobs are skipped
+ # Lifting this needs a `ref` input on
+ # truefoundry/github-workflows-public/.github/workflows/build.yml,
+ # passed as needs.version-release.outputs.sha from both image jobs.
+ - name: Refuse to build an image from the pre-version commit
+ if: ${{ steps.resolve.outputs.image == 'build' && inputs.dry_run != true }}
+ env:
+ VERSION_SHA: ${{ needs.version-release.outputs.sha }}
+ DISPATCH_SHA: ${{ github.sha }}
+ run: |
+ set -euo pipefail
+ if [[ "$VERSION_SHA" == "$DISPATCH_SHA" ]]; then
+ echo "Version commit is the dispatch commit; the image build sees the right tree."
+ exit 0
fi
+ {
+ echo "### Image build refused"
+ echo ""
+ echo "\`version-release\` committed \`$VERSION_SHA\`, but the shared"
+ echo "build workflow would check out \`$DISPATCH_SHA\` - the tree before"
+ echo "the version bump. The image would carry the wrong version while its"
+ echo "tag and the chart appVersion claim otherwise."
+ echo ""
+ echo "Add a \`ref\` input to \`github-workflows-public\`'s \`build.yml\` and"
+ echo "pass \`needs.version-release.outputs.sha\`, or re-run with \`dry_run\`"
+ echo "to exercise everything except the image and chart publish."
+ } >> "$GITHUB_STEP_SUMMARY"
+ echo "::error::refusing to build an image from $DISPATCH_SHA when the release commit is $VERSION_SHA"
+ exit 1
# Two images, same tag, different Artifactory repos. The public one keeps the
# Dockerfile's public bases so it stays redistributable; the hardened one is
@@ -439,7 +438,8 @@ jobs:
# only goes to the private repo that TrueFoundry SaaS pulls from.
build-image-public:
name: Build and push public server image
- if: needs.resolve-image.outputs.skip == 'build'
+ # DRY-RUN (temporary): `&& inputs.dry_run != true`
+ if: needs.resolve-image.outputs.image == 'build' && inputs.dry_run != true
needs: [resolve-image]
uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
permissions:
@@ -461,7 +461,8 @@ jobs:
build-image-private:
name: Build and push hardened server image
- if: needs.resolve-image.outputs.skip == 'build'
+ # DRY-RUN (temporary): `&& inputs.dry_run != true`
+ if: needs.resolve-image.outputs.image == 'build' && inputs.dry_run != true
needs: [resolve-image]
uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
permissions:
@@ -493,54 +494,165 @@ jobs:
release-chart:
name: Publish Helm chart
- if: needs.resolve-image.outputs.skip == 'build'
needs: [resolve-image, build-image-public, build-image-private]
+ # The image jobs are legitimately skipped on a re-run of an already-tagged
+ # version, and a plain `needs` would skip the chart along with them. The
+ # chart job is idempotent, so it runs in both cases and finishes whatever
+ # the previous attempt left undone.
+ if: ${{ !cancelled()
+ && needs.resolve-image.result == 'success'
+ && (needs.build-image-public.result == 'success' || needs.build-image-public.result == 'skipped')
+ && (needs.build-image-private.result == 'success' || needs.build-image-private.result == 'skipped') }}
uses: ./.github/workflows/release-chart.yml
permissions:
contents: write
with:
branch: ${{ github.ref_name }}
+ chart_version: ${{ inputs.tfy_chart_version }}
+ # Empty on a re-run: keep whatever the tagged metadata commit already has.
app_version: ${{ needs.resolve-image.outputs.app_version }}
image_tag: ${{ needs.resolve-image.outputs.image_tag }}
+ dry_run: ${{ inputs.dry_run }} # DRY-RUN (temporary)
secrets: inherit
- # release-chart.yml uploads trueforge-chart-version when it publishes.
- # When the package is already on npm, image and chart are skipped and the
- # chart version already on this commit is the one helm-charts should pin.
- record-chart-version:
- name: Record existing chart version
- if: needs.resolve-image.outputs.skip == 'skip'
- needs: [resolve-image]
+ # A final minor is the only release that drains main. main has been
+ # append-only for changesets since the release moved onto release-v* branches,
+ # so without this every new line re-consumes the backlog and repeats its
+ # changelog entries, and the CHANGELOG sections written here never reach main.
+ #
+ # Only .changeset/*.md deletions and packages/*/CHANGELOG.md move. Every
+ # version field is left alone: main stays at 0.0.0 by design, and excluding
+ # them is what keeps this conflict-free.
+ #
+ # continue-on-error: this job runs after release-chart has already pushed to
+ # OCI, inside the run helm-charts gates its helm phase on. A changelog drain
+ # must never fail a release whose chart is live and correct. A failure is
+ # reported as a ::error:: annotation and recovered by re-dispatching.
+ back-merge-main:
+ name: Back-merge changelogs to main
+ needs: [version-release, release-chart]
+ # release-chart must have actually SUCCEEDED. It is never legitimately
+ # skipped: it runs on a first cut, on a re-run of an already-cut version
+ # (idempotent - it finishes whatever the last attempt left), when there was
+ # nothing to version, and in a dry run. The only way it skips is a failure
+ # upstream, so accepting `skipped` here would drain consumed changesets off
+ # main for a release that never published a chart. A retry still works: the
+ # re-run's release-chart succeeds, and this job runs then.
+ if: ${{ !cancelled()
+ && needs.version-release.result == 'success'
+ && needs.version-release.outputs.final_minor == 'true'
+ && needs.release-chart.result == 'success'
+ && inputs.dry_run != true }} # DRY-RUN (temporary)
runs-on: ubuntu-latest
- timeout-minutes: 10
+ timeout-minutes: 60
+ continue-on-error: true
permissions:
- contents: read
+ contents: write
+ pull-requests: write
steps:
+ - id: app-token
+ uses: actions/create-github-app-token@v3
+ with:
+ client-id: ${{ secrets.TRUEFORGE_GENERATE_SDK_APP_ID }}
+ private-key: ${{ secrets.TRUEFORGE_GENERATE_SDK_APP_PRIVATE_KEY }}
+
- name: Check out repo
uses: actions/checkout@v7
with:
+ fetch-depth: 0
persist-credentials: false
+ token: ${{ steps.app-token.outputs.token }}
- - name: Write chart version
+ - name: Build the back-merge commit
+ id: build
+ env:
+ RELEASE_SHA: ${{ needs.version-release.outputs.sha }}
+ TFY_CHART_VERSION: ${{ inputs.tfy_chart_version }}
run: |
set -euo pipefail
- VERSION="$(node -e '
- const fs = require("fs");
- const text = fs.readFileSync("charts/trueforge/Chart.yaml", "utf8");
- const match = text.match(/^version:\s*"?([^"\n]+)"?\s*$/m);
- if (match === null) {
- process.stderr.write("charts/trueforge/Chart.yaml is missing version\n");
- process.exit(1);
- }
- process.stdout.write(match[1].trim());
- ')"
- printf '%s\n' "$VERSION" > "$RUNNER_TEMP/chart-version.txt"
- echo "chart version $VERSION"
+ git fetch --no-tags origin main
+ git fetch --no-tags origin "$RELEASE_SHA"
+
+ # Consumed = present at the branch cut, absent on the release branch
+ # now. After `changeset pre exit` that covers both the files deleted
+ # outright and the ones that passed through .changeset/pre/.
+ # ls-tree is non-recursive on purpose: .changeset/pre/ contents are
+ # release-branch-only state and must not be listed.
+ base="$(git merge-base origin/main "$RELEASE_SHA")"
+ list() {
+ git ls-tree --name-only "$1" .changeset/ | grep '\.md$' | grep -v '/README\.md$' | sort
+ }
+ consumed="$(comm -23 <(list "$base") <(list "$RELEASE_SHA") || true)"
+
+ git checkout -B "back-merge/v${TFY_CHART_VERSION}" origin/main
+ if [ -n "$consumed" ]; then
+ printf '%s\n' "$consumed" | xargs -r git rm -q --ignore-unmatch --
+ printf 'dropping consumed changesets:\n%s\n' "$consumed"
+ fi
- - name: Upload chart version
- uses: actions/upload-artifact@v4
- with:
- name: trueforge-chart-version
- path: ${{ runner.temp }}/chart-version.txt
- retention-days: 5
- if-no-files-found: error
+ changelogs="$(git ls-tree --name-only -r "$RELEASE_SHA" packages/ | grep '/CHANGELOG\.md$' || true)"
+ if [ -n "$changelogs" ]; then
+ printf '%s\n' "$changelogs" | xargs -r git checkout "$RELEASE_SHA" --
+ fi
+
+ if git diff --staged --quiet; then
+ echo "changed=false" >> "$GITHUB_OUTPUT"
+ echo "main already carries this line's changesets and changelogs"
+ exit 0
+ fi
+ echo "changed=true" >> "$GITHUB_OUTPUT"
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git commit -m "Back-merge changelogs for ${TFY_CHART_VERSION}"
+
+ - name: Open and merge the back-merge PR
+ if: steps.build.outputs.changed == 'true'
+ env:
+ GH_TOKEN: ${{ steps.app-token.outputs.token }}
+ BACK_MERGE_BRANCH: back-merge/v${{ inputs.tfy_chart_version }}
+ TFY_CHART_VERSION: ${{ inputs.tfy_chart_version }}
+ run: |
+ set -euo pipefail
+ gh auth setup-git
+ git push --force origin "HEAD:refs/heads/${BACK_MERGE_BRANCH}"
+
+ find_pr() {
+ gh pr list --repo "$GITHUB_REPOSITORY" --head "$BACK_MERGE_BRANCH" \
+ --base main --state open --json number --jq '.[0].number // empty'
+ }
+ PR="$(find_pr)"
+ if [ -z "$PR" ]; then
+ gh pr create \
+ --repo "$GITHUB_REPOSITORY" \
+ --base main \
+ --head "$BACK_MERGE_BRANCH" \
+ --title "Back-merge changelogs for ${TFY_CHART_VERSION}" \
+ --body "Drains the changesets consumed by release-v${TFY_CHART_VERSION} and carries that line's packages/*/CHANGELOG.md back to main. No version field moves: main stays at 0.0.0."
+ PR="$(find_pr)"
+ fi
+ if [ -z "$PR" ]; then
+ echo "::error::could not open or find the back-merge PR"
+ exit 1
+ fi
+
+ # "Nothing to back-merge" was already handled above, so anything that
+ # stops this PR landing is reported loudly: silently skipping the
+ # drain leaves main re-consuming the backlog on the next line.
+ gh pr merge "$PR" --repo "$GITHUB_REPOSITORY" --squash --delete-branch --admin \
+ || echo "merge command failed; verifying PR state (it may already be merged)"
+ STATE="$(gh pr view "$PR" --repo "$GITHUB_REPOSITORY" --json state --jq .state)"
+ if [ "$STATE" != "MERGED" ]; then
+ echo "::error::back-merge PR #${PR} did not merge (state=${STATE})"
+ exit 1
+ fi
+ echo "Back-merged into main via #${PR}"
+
+ # The steps above annotate their own known failures, but a step dying
+ # under `set -euo pipefail` does not. The release is already published at
+ # this point, so surface the drain failure without failing the run.
+ - name: Report back-merge failure
+ if: failure()
+ env:
+ TFY_CHART_VERSION: ${{ inputs.tfy_chart_version }}
+ run: |
+ echo "::error::back-merge to main failed for ${TFY_CHART_VERSION}; main still carries this line's consumed changesets. Re-dispatch this release to retry the drain."
diff --git a/RELEASING.md b/RELEASING.md
index c5758f65f..d6c48e8d3 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -3,14 +3,14 @@
This repo ships npm packages, a production container image, a Helm chart, and a
sandbox image.
-| What | Trigger | Workflow |
-| ---------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------- |
-| npm packages | Push to `release-vX.Y.Z` (Changesets). `main` collects changesets only | [`release.yml`](.github/workflows/release.yml) |
-| PyPI `trueforge-sdk` | Same `mode=publish` run as npm (parallel OIDC job) | [`release.yml`](.github/workflows/release.yml) |
-| Prod image | Same `mode=publish` run as npm (after pack + smoke) | [`release.yml`](.github/workflows/release.yml) |
-| Helm chart | Called from `release.yml` after the image, or manual dispatch | [`release-chart.yml`](.github/workflows/release-chart.yml) |
-| Sandbox image + pin PR | Push to `main` when `scripts/sandbox/**` changes, or dispatch | [`push-sandbox-image.yml`](.github/workflows/push-sandbox-image.yml) |
-| PR checks | Pull request / merge group | [`ci.yml`](.github/workflows/ci.yml) |
+| What | Trigger | Workflow |
+| ---------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
+| npm packages | `workflow_dispatch` from the parent chart release, on `release-vX.Y.Z`. `main` collects changesets only | [`release.yml`](.github/workflows/release.yml) |
+| PyPI `trueforge-sdk` | Same run as npm (parallel OIDC job) | [`release.yml`](.github/workflows/release.yml) |
+| Prod image | Same run as npm; independent of pack + smoke | [`release.yml`](.github/workflows/release.yml) |
+| Helm chart | Called from `release.yml` after the images, or manual dispatch | [`release-chart.yml`](.github/workflows/release-chart.yml) |
+| Sandbox image + pin PR | Push to `main` when `scripts/sandbox/**` changes, or dispatch | [`push-sandbox-image.yml`](.github/workflows/push-sandbox-image.yml) |
+| PR checks | Pull request / merge group | [`ci.yml`](.github/workflows/ci.yml) |
## Versioning
@@ -21,7 +21,7 @@ sandbox image.
| Chart `appVersion` | `packages/trueforge/package.json` version at the build commit |
| Prod image | Root [`Dockerfile`](Dockerfile): from-source workspace build |
| Prod image tag | `{packageVersion}-{shortSha}` |
-| Chart `version` | Same major.minor as `@truefoundry/trueforge`; patch/RC may still advance |
+| Chart `version` | The dispatching chart version, verbatim (`tfy_chart_version`). Nothing in this repo computes it |
| Sandbox image | [`sandbox.Dockerfile`](packages/trueforge-core/scripts/sandbox/sandbox.Dockerfile); tag = full commit SHA |
Install a published chart:
@@ -46,36 +46,46 @@ helm install trueforge oci://tfy.jfrog.io/tfy-helm/trueforge --version <chart-se
## Flow
-No extra GitHub tag on the Version Packages path. [`release.yml`](.github/workflows/release.yml)
-is packages plus the from-source image. It runs on `release-vX.Y.Z`. `main` collects
-changesets and does not publish.
+[`release.yml`](.github/workflows/release.yml) is packages plus the from-source
+images and the chart. It runs on `release-vX.Y.Z`. `main` collects changesets and
+does not publish.
1. Add a changeset in the same PR as the code change (`pnpm changeset`, or
`pnpm change --bump patch --summary "…" <pkg>`). SDK regen already adds
`@truefoundry/trueforge-sdk` via `pnpm changeset:sdk-regen`.
2. Merge to `main`.
-3. A TrueFoundry chart release of `V` (`X.Y.Z` or `X.Y.Z-rc.N`) creates
+3. A parent chart release of `V` (`X.Y.Z` or `X.Y.Z-rc.N`) creates
`release-vX.Y.Z` in this repo (`X.Y.Z` is `V` with any `-rc.N` removed) and
- dispatches this workflow with `tfy_chart_version=V`. The first cut is from
- `main`. An existing branch is kept, and `main` is merged into it.
-4. That dispatch runs `scripts/prepare-release.mjs`, then `pnpm run version`.
- Pre mode follows `V` (`rc` enters, a stable version exits). Published
- packages still at `0.0.0` become `X.Y.0` or `X.Y.0-rc.0`. `packages/frontend`
- stays `0.0.0`. The Version Packages PR targets `release-vX.Y.Z` and is
- auto-merged. When `@truefoundry/trueforge-sdk` moves, `scripts/version.mjs`
- mirrors that version into `python/trueforge_sdk` and regenerates both SDKs.
-5. The merge push, with no pending changesets, runs **pack** (build/test) and
- **Windows npx smoke** in parallel with **Resolve image identity** (`npm view`
- of `@truefoundry/trueforge@version`). If that version is already on npm, image
- and Helm skip. If not, **Build and push server image** runs without waiting
- on pack. After the image is pushed, this workflow calls
- [`release-chart.yml`](.github/workflows/release-chart.yml) with
- `branch=release-vX.Y.Z`, `app_version`, and `image_tag`. Helm does not wait
- on pack or npm. Chart commits land on the release branch.
-
-If the dispatch has nothing to version, that same run publishes. A later push to
-`release-v*` with pending changesets opens a Version Packages PR and does not
-auto-merge it.
+ dispatches this workflow with `tfy_chart_version=V`. The first cut of a minor
+ line is from `main`; a hotfix line is cut from `refs/tags/v<base>` so
+ unreleased work on `main` cannot enter a patch. An existing branch is kept as
+ is and **never** has `main` merged into it: only the **first** RC of a minor
+ line fails when `main` has commits the branch is missing, because from `rc.2`
+ onward the branch legitimately carries version and changeset commits `main`
+ lacks and the comparison would always read `diverged`. A hotfix line is
+ supposed to lag `main`.
+4. That dispatch runs `scripts/prepare-release.mjs`, then `pnpm run version`, and
+ commits the result **directly** to `release-vX.Y.Z`. Pre mode follows `V`
+ (`rc` enters, a stable version exits). Published packages still at `0.0.0`
+ become `X.Y.0` or `X.Y.0-rc.0`. `packages/frontend` stays `0.0.0`. When
+ `@truefoundry/trueforge-sdk` moves, `scripts/version.mjs` mirrors that version
+ into `python/trueforge_sdk` and regenerates both SDKs. There is no Version
+ Packages PR: one dispatch, one run, one conclusion.
+5. The same run then does everything else, checking out the commit from step 4:
+ - **pack** (build/test) and **Windows npx smoke** gate **npm** and **PyPI**.
+ They run only when `changesets/action/select-mode` reports `publish`; a line
+ with no changesets since the last release reports `none`, which is normal.
+ - **Resolve image identity** reads `packages/trueforge/package.json` for
+ `appVersion` and checks whether `charts/trueforge@V` already exists. If not,
+ both server images build as `{appVersion}-{shortSha}` and
+ [`release-chart.yml`](.github/workflows/release-chart.yml) publishes the
+ chart at exactly `V`. If the tag does exist, this is a re-run: the images
+ are reused and the chart job finishes whatever the previous attempt left
+ undone. This path never consults npm.
+6. A **final minor** (`X.Y.0`, no `-rc.`) then opens and merges a back-merge PR
+ into `main` that deletes the `.changeset/*.md` this line consumed and copies
+ its `packages/*/CHANGELOG.md` across. No version field moves: `main` stays at
+ `0.0.0`. RCs and hotfixes do not back-merge.
## Prerelease mode
@@ -84,7 +94,7 @@ Repo-wide via `.changeset/pre.json` (absent = publish to `latest`):
| Goal | Command | Then |
| -------- | ----------------------------- | ------------------------------------------------------------------------- |
| Enter RC | `pnpm changeset pre enter rc` | Commit `pre.json`, merge; versions look like `x.y.z-rc.N` (`rc` dist-tag) |
-| Exit RC | `pnpm changeset pre exit` | Commit the delete, merge; next Version Packages merge publishes `latest` |
+| Exit RC | `pnpm changeset pre exit` | Commit the delete, merge; the next release publishes `latest` |
`pre enter` / `pre exit` do not bump or publish. Do not mix stable and RC packages in one
`changeset version`.
@@ -126,41 +136,49 @@ pnpm clean && pnpm build && pnpm standalone:start
## Troubleshooting
-- **No Version Packages PR** - no `.changeset/*.md` on the release branch. Add one on `main` before the TrueFoundry release cuts or updates `release-vX.Y.Z`.
+- **Nothing was versioned** - no `.changeset/*.md` on the release branch. That is not an error: the chart still publishes at `tfy_chart_version`. Add changesets on `main` before the next line is cut.
- **Publish wants a tag** - RCs need the `rc` dist-tag (set automatically while `pre.json` exists).
- **403** - version already on npm, or trusted-publisher config mismatch (filename must be `release.yml`).
- **OIDC fail** - pnpm >= 11.0.7; remove registry `_authToken`.
- **Missing `dist/_frontend/index.html`** - root `pnpm build` must build `frontend` first.
-- **SDK not regenerated on Version PR** - only when `@truefoundry/trueforge-sdk` version moved
+- **SDK not regenerated** - only when `@truefoundry/trueforge-sdk` version moved
(`scripts/version.mjs`; needs Docker). That path also mirrors the version into `python/trueforge_sdk`.
- **PyPI 403 / invalid-publisher** - register a trusted publisher for `trueforge-sdk` bound to
`release.yml` (and create the project if it does not exist yet).
- **Prod image / chart missing after package publish** - re-run **Version or publish packages**
- on the release branch, or publish a chart for an image already in the registry:
- `gh workflow run release-chart.yml --ref release-vX.Y.Z -f branch=release-vX.Y.Z -f app_version=X.Y.Z -f image_tag=X.Y.Z-<sha>`.
+ on the release branch with the same `tfy_chart_version` (every step is idempotent), or
+ publish a chart for an image already in the registry:
+ `gh workflow run release-chart.yml --ref release-vX.Y.Z -f branch=release-vX.Y.Z -f chart_version=X.Y.Z -f app_version=X.Y.Z -f image_tag=X.Y.Z-<sha>`.
---
# Image and Helm chart
```text
-TrueFoundry chart release V
- → branch release-vX.Y.Z (from main the first time; fail if an existing branch is missing commits from main)
+parent chart release V
+ → branch release-vX.Y.Z (from main for a new minor; from
+ refs/tags/v<base> for a hotfix; fail only on the FIRST rc if an existing
+ minor branch is missing commits from main)
→ workflow_dispatch release.yml --ref release-vX.Y.Z -f tfy_chart_version=V
→ prepare pre mode + 0.0.0 bootstrap
- → changeset version, auto-merge Version Packages PR
-merge push to release-vX.Y.Z (no pending changesets, unpublished versions)
- → release.yml: pack + smoke | npm view @truefoundry/trueforge@version
- → npm | PyPI
- → if version not on npm: build image X.Y.Z-<shortSha>
- → after image: call release-chart.yml (release-vX.Y.Z, app_version, image_tag)
- → release-chart.yml
- → helm lint/package/push OCI
- → commit Chart.yaml + values.yaml to that branch
- → tag charts/trueforge@<chartVersion> on that commit
+ → changeset version, commit straight to release-vX.Y.Z
+ → select-mode: publish | none
+ → (publish) pack + smoke → npm | PyPI
+ → resolve image identity; charts/trueforge@V missing?
+ yes → build both images X.Y.Z-<shortSha>
+ no → re-run: reuse the tagged commit's image
+ → release-chart.yml (branch, chart_version=V, app_version, image_tag)
+ → helm lint / package
+ → commit Chart.yaml + values.yaml to that branch (skip if unchanged)
+ → tag charts/trueforge@V (annotated) + vV (lightweight) on that
+ commit (no-op if already present at the same sha)
+ → helm push OCI (skip if V is already in the registry)
+ → (V is X.Y.0 and not an rc) back-merge PR into main:
+ delete the consumed .changeset/*.md, take packages/*/CHANGELOG.md
manual chart-only (image already in the registry)
- → workflow_dispatch release-chart.yml --ref <release-branch> -f branch=<release-branch>
+ → workflow_dispatch release-chart.yml --ref <release-branch>
+ -f branch=<release-branch> -f chart_version=X.Y.Z
(empty app_version / image_tag keep Chart.yaml / values.yaml)
```
@@ -181,34 +199,42 @@ peeled commit SHA (`git rev-parse HEAD`), not an annotated-tag object.
from the root [`Dockerfile`](Dockerfile), then calls
[`release-chart.yml`](.github/workflows/release-chart.yml) (`workflow_call`) with
`branch` set to the `release-vX.Y.Z` branch the workflow is running on,
-`app_version`, and `image_tag`. The chart workflow does not build images.
+`chart_version`, `app_version`, and `image_tag`. The chart workflow does not
+build images.
`--ref` selects which workflow file GitHub runs. `branch` is the git branch that
receives `Chart.yaml` / `values.yaml`.
-| Input | Default (manual dispatch only) | Meaning |
-| ------------- | ---------------------------------------- | --------------------------------------------- |
-| `branch` | `main` | Branch that receives the chart commit |
-| `app_version` | `Chart.yaml` `appVersion` on that branch | Written to Chart.yaml `appVersion` |
-| `image_tag` | `values.yaml` `image.tag` on that branch | Existing registry tag; written to `image.tag` |
-
-Always: replay chart `version` / `appVersion` / `image.tag` onto current
-`origin/<branch>`, lint, package, push OCI (fails if that chart version is
-already in the registry), commit those files to that branch, then tag
-`charts/trueforge@<chartVersion>` on that commit. The commit is replayed onto
-`origin/<branch>` if the branch moved. Tag and no-op metadata commits fail.
+| Input | Default (manual dispatch only) | Meaning |
+| --------------- | ---------------------------------------- | --------------------------------------------- |
+| `branch` | `main` | Branch that receives the chart commit |
+| `chart_version` | none - required | Written verbatim to Chart.yaml `version` |
+| `app_version` | `Chart.yaml` `appVersion` on that branch | Written to Chart.yaml `appVersion` |
+| `image_tag` | `values.yaml` `image.tag` on that branch | Existing registry tag; written to `image.tag` |
+
+Always, in this order: write chart `version` / `appVersion` / `image.tag` onto
+current `origin/<branch>`, lint, package, check the registry, commit those files
+to that branch, tag `charts/trueforge@<chartVersion>` on that commit, then push
+to OCI. The commit is replayed onto `origin/<branch>` if the branch moved. Every
+step is idempotent: an unchanged metadata diff skips the commit, the tag already
+on that commit is a no-op, and a chart version already in the registry skips the
+push. The one hard failure is the tag existing on a _different_ commit - the same
+chart version cannot ship two different contents.
```bash
-gh workflow run release-chart.yml --ref main -f branch=main
+gh workflow run release-chart.yml --ref main -f branch=main -f chart_version=0.3.1
gh workflow run release-chart.yml --ref main \
-f branch=main \
+ -f chart_version=0.3.0-rc.0 \
-f app_version=0.3.0-rc.0 \
-f image_tag=0.3.0-rc.0-abcdef1
```
-Chart major.minor is taken from [`scripts/resolve-chart-version.sh`](scripts/resolve-chart-version.sh)
-so it matches `@truefoundry/trueforge` (and the docker tag prefix). Patch and RC
-still advance per chart release.
+The chart version is the `chart_version` input, verbatim - the same value as the
+parent chart release that dispatched it. Nothing in this repo derives it, so
+`oci://tfy.jfrog.io/tfy-helm/trueforge:<V>` and `charts/trueforge@<V>` are known
+before the release starts. `appVersion` tracks `@truefoundry/trueforge` and the
+image tag prefix; those are separate fields with separate owners.
## Devtest
diff --git a/charts/trueforge/Chart.yaml b/charts/trueforge/Chart.yaml
index 598992965..90b52f829 100644
--- a/charts/trueforge/Chart.yaml
+++ b/charts/trueforge/Chart.yaml
@@ -2,9 +2,11 @@ apiVersion: v2
name: trueforge
description: TrueForge server (API + UI) served from a single container image.
type: application
-# version / appVersion / image.tag are written on the branch passed to
-# release-chart.yml (main from release.yml). Image is built in release.yml.
-# That workflow then tags charts/trueforge@<version> on that commit.
+# version is the parent chart version, written verbatim from
+# release-chart.yml's chart_version input; nothing in this repo computes it.
+# appVersion follows packages/trueforge/package.json and image.tag follows the
+# image release.yml built. All three are written on the release-vX.Y.Z branch,
+# which is then tagged charts/trueforge@<version> on that commit.
version: "0.3.0"
appVersion: "0.3.0"
kubeVersion: ">=1.25.0-0"
diff --git a/package.json b/package.json
index 600471326..29bbc9f3f 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,6 @@
"push-sandbox-image-to-daytona": "pnpm --filter @truefoundry/trueforge push-sandbox-image-to-daytona",
"test:frontend": "pnpm --filter frontend test",
"test:assistant-ui-runtime": "pnpm --filter @truefoundry/trueforge-assistant-ui-runtime test",
- "test:chart-version": "bash tests/scripts/resolve-chart-version.test.sh",
"test:trueforge-core": "pnpm --filter @truefoundry/trueforge-core test",
"test:trueforge": "pnpm --filter @truefoundry/trueforge test",
"test:local-sandbox:contract": "pnpm --filter @truefoundry/trueforge test:local-sandbox:contract",
diff --git a/scripts/prepare-release.mjs b/scripts/prepare-release.mjs
index 6e72f00c3..692c225a9 100644
--- a/scripts/prepare-release.mjs
+++ b/scripts/prepare-release.mjs
@@ -6,10 +6,11 @@
*
* Changesets pre mode follows that version. Published packages still at
* `0.0.0` move to `X.Y.0` or `X.Y.0-rc.0`; private packages (`packages/frontend`)
- * stay `0.0.0`. Bootstrapping `packages/trueforge-sdk` also writes
- * `python/trueforge_sdk/pyproject.toml`: `scripts/version.mjs` only mirrors the
- * Python version when `changeset version` moves the TS SDK, so a bootstrap alone
- * would leave Poetry behind.
+ * stay `0.0.0`. Bootstrapping `packages/trueforge-sdk` deliberately leaves
+ * `python/trueforge_sdk/pyproject.toml` alone: `pnpm run version` runs straight
+ * after this script, and `scripts/version.mjs` syncs Poetry whenever the Python
+ * version diverges from the TS SDK's - not only when `changeset version` moves
+ * it - so the bootstrap is picked up there.
* `.changeset/config.json` `baseBranch` becomes the release branch so version
* changelogs are computed against it. `main` is not rewritten here.
*/
diff --git a/scripts/resolve-chart-version.sh b/scripts/resolve-chart-version.sh
deleted file mode 100755
index d0395aa26..000000000
--- a/scripts/resolve-chart-version.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-CURRENT=${1:?current chart version is required}
-APP_VERSION=${2:?app version is required}
-PR_VERSION=${3:-}
-
-SEMVER='^([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z.-]+)?$'
-
-parse() {
- local v=$1
- if [[ ! "$v" =~ $SEMVER ]]; then
- return 1
- fi
- _major=${BASH_REMATCH[1]}
- _minor=${BASH_REMATCH[2]}
- _patch=${BASH_REMATCH[3]}
- _pre=${BASH_REMATCH[4]:-}
-}
-
-if ! parse "$CURRENT"; then
- echo "Current chart version '$CURRENT' is not semver" >&2
- exit 1
-fi
-CUR_MAJOR=$_major
-CUR_MINOR=$_minor
-CUR_PATCH=$_patch
-CUR_PRE=$_pre
-
-if ! parse "$APP_VERSION"; then
- echo "App version '$APP_VERSION' is not semver" >&2
- exit 1
-fi
-APP_MAJOR=$_major
-APP_MINOR=$_minor
-APP_PRE=$_pre
-
-# Chart major.minor follows the app package (and thus the docker tag prefix).
-SELECTED_MAJOR=$APP_MAJOR
-SELECTED_MINOR=$APP_MINOR
-
-if ((CUR_MAJOR == APP_MAJOR && CUR_MINOR == APP_MINOR)); then
- # Same line: a stable chart starts the next patch. A prerelease chart is
- # already on its target core, so later RCs and the stable release keep it.
- if [[ -z "$CUR_PRE" ]]; then
- SELECTED_PATCH=$((CUR_PATCH + 1))
- else
- SELECTED_PATCH=$CUR_PATCH
- fi
-else
- SELECTED_PATCH=0
-fi
-
-PR_CORE_SELECTED=false
-PR_PRE=""
-if [[ -n "$PR_VERSION" ]] && parse "$PR_VERSION"; then
- PR_MAJOR=$_major
- PR_MINOR=$_minor
- PR_PATCH=$_patch
- PR_PRE=$_pre
- # A reviewer bump on the open PR is kept only when it stays on the app line.
- if ((PR_MAJOR == APP_MAJOR && PR_MINOR == APP_MINOR)); then
- if ((PR_PATCH > SELECTED_PATCH)); then
- SELECTED_PATCH=$PR_PATCH
- PR_CORE_SELECTED=true
- elif ((PR_PATCH == SELECTED_PATCH)); then
- PR_CORE_SELECTED=true
- fi
- fi
-fi
-
-SELECTED_PRE=""
-if [[ -n "$APP_PRE" ]]; then
- RC_COUNTER='^-rc\.([0-9]+)$'
- HIGHEST_RC=-1
-
- if ((CUR_MAJOR == SELECTED_MAJOR && CUR_MINOR == SELECTED_MINOR && CUR_PATCH == SELECTED_PATCH)) &&
- [[ "$CUR_PRE" =~ $RC_COUNTER ]]; then
- HIGHEST_RC=${BASH_REMATCH[1]}
- fi
-
- if [[ "$PR_CORE_SELECTED" == true && "$PR_PRE" =~ $RC_COUNTER ]]; then
- PR_COUNTER=${BASH_REMATCH[1]}
- if ((PR_COUNTER > HIGHEST_RC)); then
- HIGHEST_RC=$PR_COUNTER
- fi
- fi
-
- SELECTED_PRE="-rc.$((HIGHEST_RC + 1))"
-fi
-
-printf '%s\n' "${SELECTED_MAJOR}.${SELECTED_MINOR}.${SELECTED_PATCH}${SELECTED_PRE}"
diff --git a/tests/scripts/resolve-chart-version.test.sh b/tests/scripts/resolve-chart-version.test.sh
deleted file mode 100755
index 3514f5ab9..000000000
--- a/tests/scripts/resolve-chart-version.test.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-cd "$(dirname "$0")/../.."
-
-resolver=scripts/resolve-chart-version.sh
-failures=0
-
-assert_version() {
- local expected=$1
- local current=$2
- local app_version=$3
- local pr_version=${4:-}
- local actual
-
- actual=$(bash "$resolver" "$current" "$app_version" "$pr_version")
- if [[ "$actual" != "$expected" ]]; then
- printf 'FAIL: current=%s app=%s pr=%s expected=%s actual=%s\n' \
- "$current" "$app_version" "${pr_version:-none}" "$expected" "$actual" >&2
- failures=$((failures + 1))
- fi
-}
-
-# Same major.minor as the app: stable charts continue with patch bumps.
-assert_version 0.1.6 0.1.5 0.1.5
-assert_version 0.1.7 0.1.6 0.1.6
-
-# Entering prerelease mode on the same line starts the chart RC counter at zero.
-assert_version 0.1.6-rc.0 0.1.5 0.1.5-rc.2
-
-# Merged chart RCs and RCs in the open chart PR both advance linearly.
-assert_version 0.1.6-rc.1 0.1.6-rc.0 0.1.5-rc.99
-assert_version 0.1.6-rc.4 0.1.6-rc.3 0.1.5-rc.0
-assert_version 0.1.6-rc.1 0.1.5 0.1.5-rc.7 0.1.6-rc.0
-assert_version 0.1.6-rc.5 0.1.6-rc.3 0.1.5-rc.7 0.1.6-rc.4
-
-# Leaving prerelease mode stabilizes the existing core before patch bumps resume.
-assert_version 0.1.6 0.1.6-rc.4 0.1.6
-assert_version 0.1.6 0.1.5 0.1.6 0.1.6-rc.4
-
-# Chart major.minor follows the app (package / docker prefix).
-assert_version 0.3.0-rc.0 0.2.3-rc.0 0.3.0-rc.0
-assert_version 0.3.0 0.2.5 0.3.0
-assert_version 0.4.0-rc.0 0.3.1 0.4.0-rc.1
-
-# A reviewer patch bump on the open PR is kept when it stays on the app line.
-assert_version 0.3.1-rc.0 0.3.0 0.3.0-rc.1 0.3.1
-assert_version 0.3.0-rc.5 0.3.0-rc.3 0.3.0-rc.0 0.3.0-rc.4
-
-# A PR version on a different minor than the app is ignored.
-assert_version 0.3.0-rc.0 0.2.3-rc.0 0.3.0-rc.0 0.4.0
-assert_version 0.1.6-rc.0 0.1.5 0.1.5-rc.3 0.2.0
-
-if ((failures > 0)); then
- exit 1
-fi
-
-echo "Chart version resolution tests passed"