Skip to content

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

Split package publish from Docker and Helm release (#861)

Raman Tehlan7ab8b615f5f4
diff --git a/.github/workflows/build-and-prepare-chart-release.yml b/.github/workflows/build-and-prepare-chart-release.yml
deleted file mode 100644
index 654c172b2..000000000
--- a/.github/workflows/build-and-prepare-chart-release.yml
+++ /dev/null
@@ -1,197 +0,0 @@
-name: Build and prepare chart release
-
-# Prod lane: build the npm-install Dockerfile, push {appVersion}-{shortSha},
-# then open/update the chart-release bot PR (merge of that PR tags + publishes).
-#
-# Called from release.yml after npm publish (same commit as the publish job).
-# workflow_dispatch is for manual rebuilds. Do not use `gh workflow run --ref
-# $GITHUB_SHA`: the dispatch API only accepts a branch or tag name (HTTP 422).
-on:
- workflow_call:
- inputs:
- app_version:
- description: npm version to install (empty = Chart.yaml appVersion)
- required: false
- type: string
- update_app_version:
- description: Also set Chart.yaml appVersion to app_version on the bot PR
- required: false
- type: boolean
- default: false
- workflow_dispatch:
- inputs:
- app_version:
- description: npm version to install (empty = Chart.yaml appVersion)
- required: false
- type: string
- update_app_version:
- description: Also set Chart.yaml appVersion to app_version on the bot PR
- required: false
- type: boolean
- default: false
-
-concurrency:
- group: release-image-and-chart
- cancel-in-progress: false
-
-permissions: {}
-
-jobs:
- resolve:
- name: Resolve versions
- runs-on: ubuntu-latest
- outputs:
- app_version: ${{ steps.resolve.outputs.app_version }}
- image_tag: ${{ steps.resolve.outputs.image_tag }}
- update_app_version: ${{ steps.resolve.outputs.update_app_version }}
- short_sha: ${{ steps.resolve.outputs.short_sha }}
- permissions:
- contents: read
- steps:
- - name: Check out
- uses: actions/checkout@v7
-
- - name: Install yq
- run: |
- sudo wget -q https://github.com/mikefarah/yq/releases/download/v4.53.3/yq_linux_amd64 -O /usr/bin/yq
- sudo chmod +x /usr/bin/yq
-
- - name: Resolve app version and image tag
- id: resolve
- env:
- INPUT_APP_VERSION: ${{ inputs.app_version }}
- INPUT_UPDATE_APP_VERSION: ${{ inputs.update_app_version }}
- run: |
- set -euo pipefail
- CHART_APP=$(yq -r '.appVersion' charts/trueforge/Chart.yaml | tr -d '"')
- if [[ -n "${INPUT_APP_VERSION}" ]]; then
- APP_VERSION="$INPUT_APP_VERSION"
- else
- APP_VERSION="$CHART_APP"
- fi
- if [[ -z "$APP_VERSION" || "$APP_VERSION" == "null" ]]; then
- echo "Could not resolve APP_VERSION" >&2
- exit 1
- fi
- if ! printf '%s' "$APP_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$'; then
- echo "APP_VERSION '$APP_VERSION' is not a semver-like version" >&2
- exit 1
- fi
- SHORT_SHA="${GITHUB_SHA:0:7}"
- IMAGE_TAG="${APP_VERSION}-${SHORT_SHA}"
- UPDATE_APP="${INPUT_UPDATE_APP_VERSION:-false}"
- # workflow_dispatch boolean can be the string "true"/"false"
- if [[ "$UPDATE_APP" == "true" ]]; then
- UPDATE_OUT=true
- else
- UPDATE_OUT=false
- fi
- echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
- echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
- echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
- echo "update_app_version=$UPDATE_OUT" >> "$GITHUB_OUTPUT"
- echo "Resolved APP_VERSION=$APP_VERSION IMAGE_TAG=$IMAGE_TAG update_app_version=$UPDATE_OUT"
-
- build:
- name: Build and push server image
- needs: [resolve]
- uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
- permissions:
- id-token: write
- contents: read
- with:
- artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
- artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
- image_artifact_name: trueforge
- image_tag: ${{ needs.resolve.outputs.image_tag }}
- image_context: .
- dockerfile_path: Dockerfile
- image_build_args: |
- APP_VERSION=${{ needs.resolve.outputs.app_version }}
- platforms: linux/amd64
- enable_jfrog: true
- enable_public_ecr: false
- secrets:
- artifactory_username: ${{ secrets.TRUEFORGE_ARTIFACTORY_USERNAME }}
- artifactory_password: ${{ secrets.TRUEFORGE_ARTIFACTORY_PASSWORD }}
-
- open-chart-pr:
- name: Open chart release PR
- needs: [resolve, build]
- runs-on: ubuntu-latest
- permissions:
- contents: write
- pull-requests: write
- env:
- PR_BRANCH: release-chart/trueforge
- 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
- uses: actions/checkout@v7
- with:
- token: ${{ steps.app-token.outputs.token }}
-
- - name: Install yq
- run: |
- sudo wget -q https://github.com/mikefarah/yq/releases/download/v4.53.3/yq_linux_amd64 -O /usr/bin/yq
- sudo chmod +x /usr/bin/yq
-
- - name: Update chart metadata
- id: chart
- env:
- IMAGE_TAG: ${{ needs.resolve.outputs.image_tag }}
- APP_VERSION: ${{ needs.resolve.outputs.app_version }}
- UPDATE_APP_VERSION: ${{ needs.resolve.outputs.update_app_version }}
- run: |
- set -euo pipefail
- CURRENT=$(yq -r '.version' charts/trueforge/Chart.yaml)
- PR_VERSION=""
-
- # create-pull-request rebuilds the PR branch from base plus this
- # workspace, so a reviewer's major/minor bump on the open PR is dropped
- # unless it is re-applied here.
- if git ls-remote --exit-code --heads origin "$PR_BRANCH" >/dev/null 2>&1; then
- git fetch --depth=1 origin "$PR_BRANCH"
- PR_VERSION=$(git show FETCH_HEAD:charts/trueforge/Chart.yaml | yq -r '.version')
- fi
- VERSION=$(bash scripts/resolve-chart-version.sh "$CURRENT" "$APP_VERSION" "$PR_VERSION")
- if [[ -n "$PR_VERSION" && "$VERSION" == "$PR_VERSION" ]]; then
- echo "Keeping chart version $PR_VERSION from $PR_BRANCH"
- fi
- export VERSION IMAGE_TAG APP_VERSION
- yq -i '.version = strenv(VERSION)' charts/trueforge/Chart.yaml
- yq -i '.image.tag = strenv(IMAGE_TAG)' charts/trueforge/values.yaml
- if [[ "$UPDATE_APP_VERSION" == "true" ]]; then
- yq -i '.appVersion = strenv(APP_VERSION)' charts/trueforge/Chart.yaml
- fi
- APP_VERSION=$(yq -r '.appVersion' charts/trueforge/Chart.yaml)
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"
-
- - name: Open or update chart-release PR
- uses: peter-evans/create-pull-request@v8
- with:
- token: ${{ steps.app-token.outputs.token }}
- branch: ${{ env.PR_BRANCH }}
- base: main
- commit-message: 'release(chart): ${{ steps.chart.outputs.version }}'
- title: 'release(chart): ${{ steps.chart.outputs.version }} (image ${{ needs.resolve.outputs.image_tag }})'
- body: |
- ## Chart release
-
- | Field | Value |
- | --- | --- |
- | Chart version | `${{ steps.chart.outputs.version }}` |
- | appVersion | `${{ steps.chart.outputs.app_version }}` |
- | image.tag | `${{ needs.resolve.outputs.image_tag }}` |
-
- Merging this PR creates `charts/trueforge@${{ steps.chart.outputs.version }}`,
- creates a GitHub Release, and publishes the OCI Helm chart.
- add-paths: |
- charts/trueforge/Chart.yaml
- charts/trueforge/values.yaml
diff --git a/.github/workflows/build-dev-image.yml b/.github/workflows/build-dev-image.yml
deleted file mode 100644
index 096727891..000000000
--- a/.github/workflows/build-dev-image.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-name: Build dev image
-
-# From-source image for floating-main / external deploy repos.
-# Builds Dockerfile.dev and pushes .../trueforge:<fullSha>. No chart publish.
-on:
- workflow_dispatch:
-
-concurrency:
- group: build-dev-image
- cancel-in-progress: false
-
-permissions:
- contents: read
-
-jobs:
- build:
- name: Build and push from-source image
- uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
- permissions:
- id-token: write
- contents: read
- with:
- artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
- artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
- image_artifact_name: trueforge
- image_tag: ${{ github.sha }}
- image_context: .
- dockerfile_path: Dockerfile.dev
- platforms: linux/amd64
- enable_jfrog: true
- enable_public_ecr: false
- secrets:
- artifactory_username: ${{ secrets.TRUEFORGE_ARTIFACTORY_USERNAME }}
- artifactory_password: ${{ secrets.TRUEFORGE_ARTIFACTORY_PASSWORD }}
-
- summary:
- name: Print image URI
- needs: [build]
- runs-on: ubuntu-latest
- permissions:
- contents: read
- steps:
- - name: Summary
- env:
- IMAGE_URI: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}/trueforge:${{ github.sha }}
- run: |
- set -euo pipefail
- echo "Pushed image URI: $IMAGE_URI"
- {
- echo "### Dev image (from-source)"
- echo "\`$IMAGE_URI\`"
- echo ""
- echo "Patch this SHA into your external \`truefoundry.yaml\` as \`image.tag\`."
- } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f89a36777..1a3471b47 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -94,7 +94,6 @@ jobs:
chart:
- 'charts/trueforge/**'
- 'Dockerfile'
- - 'Dockerfile.dev'
- 'package.json'
- '.github/workflows/ci.yml'
diff --git a/.github/workflows/release-chart.yml b/.github/workflows/release-chart.yml
index 3a51464e7..e81bf4e0a 100644
--- a/.github/workflows/release-chart.yml
+++ b/.github/workflows/release-chart.yml
@@ -1,38 +1,60 @@
name: Publish Helm chart
-# A chart-release PR merge creates the tag/GitHub Release and publishes the
-# chart. Human charts/trueforge@* tags use the same publish job.
+# 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).
+#
+# 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.
+#
+# 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>.
on:
- pull_request:
- types: [closed]
- branches: [main]
- push:
- tags:
- - 'charts/trueforge@*'
+ workflow_call:
+ inputs:
+ branch:
+ 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
+ required: true
+ type: string
+ image_tag:
+ description: Image tag already pushed to the registry, written to values.yaml image.tag
+ required: true
+ type: string
workflow_dispatch:
inputs:
- tag:
- description: Existing tag to publish (e.g. charts/[email protected])
+ branch:
+ description: Git branch that receives the Chart.yaml / values.yaml commit
required: true
type: string
-
-concurrency:
- group: publish-helm-chart
- cancel-in-progress: false
+ default: main
+ app_version:
+ description: App version (empty = Chart.yaml appVersion on that branch)
+ required: false
+ type: string
+ image_tag:
+ description: Existing image tag (empty = values.yaml image.tag on that branch)
+ required: false
+ type: string
permissions: {}
jobs:
- release:
- name: Create release and publish chart
- if: >-
- github.event_name != 'pull_request' ||
- (
- github.event.pull_request.merged == true &&
- github.event.pull_request.head.ref == 'release-chart/trueforge' &&
- github.event.pull_request.head.repo.full_name == github.repository
- )
+ publish-chart:
+ name: Publish Helm chart
runs-on: ubuntu-latest
+ timeout-minutes: 20
+ # Job-level so it also applies when this workflow is called from release.yml.
+ concurrency:
+ group: release-chart-${{ inputs.branch }}
+ cancel-in-progress: false
permissions:
contents: write
env:
@@ -40,11 +62,18 @@ jobs:
HELM_REGISTRY_URL: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
HELM_CHART_REPOSITORY: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_HELM_REPOSITORY }}
steps:
- - name: Check out chart commit
+ # App token: GITHUB_TOKEN often cannot push to a protected branch.
+ - 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
uses: actions/checkout@v7
with:
- ref: ${{ github.event.pull_request.merge_commit_sha || inputs.tag || github.ref }}
fetch-depth: 0
+ token: ${{ steps.app-token.outputs.token }}
- name: Install yq
run: |
@@ -56,84 +85,68 @@ jobs:
with:
version: v3.16.4
- - name: Resolve or create chart release
+ - name: Checkout branch and resolve versions
+ id: resolve
env:
- EVENT_NAME: ${{ github.event_name }}
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- INPUT_TAG: ${{ inputs.tag }}
- MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
- PR_BODY: ${{ github.event.pull_request.body }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
+ INPUT_BRANCH: ${{ inputs.branch }}
+ INPUT_APP_VERSION: ${{ inputs.app_version }}
+ INPUT_IMAGE_TAG: ${{ inputs.image_tag }}
run: |
set -euo pipefail
-
- # Read the chart identity from the checked-out commit.
- VERSION=$(yq -r '.version' charts/trueforge/Chart.yaml)
- APP_VERSION=$(yq -r '.appVersion' charts/trueforge/Chart.yaml)
- IMAGE_TAG=$(yq -r '.image.tag' charts/trueforge/values.yaml)
-
- if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
- echo "Invalid chart version: $VERSION" >&2
+ BRANCH="$INPUT_BRANCH"
+ if [[ -z "$BRANCH" || "$BRANCH" == refs/* || "$BRANCH" == *..* ]] ||
+ ! printf '%s' "$BRANCH" | grep -Eq '^[A-Za-z0-9][A-Za-z0-9._/-]*$'; then
+ echo "branch '$BRANCH' is not a valid git branch name" >&2
exit 1
fi
+ git fetch origin "$BRANCH"
+ git checkout -B "chart-release-${GITHUB_RUN_ID}-$(openssl rand -hex 4)" "origin/${BRANCH}"
- # Path A: bot chart-release PR was merged.
- # Create the charts/trueforge@<version> tag + GitHub Release here,
- # because GITHUB_TOKEN tag pushes do not start a separate push workflow.
- if [[ "$EVENT_NAME" == "pull_request" ]]; then
- TAG="charts/trueforge@${VERSION}"
-
- if git rev-parse "$TAG" >/dev/null 2>&1; then
- echo "Tag $TAG already exists; refusing to move it" >&2
- exit 1
- fi
-
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- git tag -a "$TAG" -m "Helm chart ${VERSION} (appVersion ${APP_VERSION}, image ${IMAGE_TAG})"
- git push origin "$TAG"
-
- # Write notes via a file so PR body cannot inject into the shell.
- NOTES_FILE="$(mktemp)"
- {
- echo "Source PR: #${PR_NUMBER}"
- echo
- printf '%s\n' "$PR_BODY"
- } >"$NOTES_FILE"
- gh release create "$TAG" \
- --target "$MERGE_SHA" \
- --title "$TAG" \
- --notes-file "$NOTES_FILE"
- rm -f "$NOTES_FILE"
- # Path B: manual retry via workflow_dispatch with an explicit tag.
- elif [[ -n "${INPUT_TAG:-}" ]]; then
- TAG="$INPUT_TAG"
-
- # Path C: human pushed charts/trueforge@* themselves.
- else
- TAG="${GITHUB_REF#refs/tags/}"
+ SEMVER='^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$'
+ APP_VERSION="$INPUT_APP_VERSION"
+ if [[ -z "$APP_VERSION" ]]; then
+ APP_VERSION=$(yq -r '.appVersion' "$CHART_DIR/Chart.yaml")
fi
-
- # Every path must publish the same chart version the tag names.
- case "$TAG" in
- charts/trueforge@*) EXPECTED="${TAG#charts/trueforge@}" ;;
- *) echo "Invalid chart tag: $TAG" >&2; exit 1 ;;
- esac
-
- ACTUAL=$(yq -r '.version' "$CHART_DIR/Chart.yaml")
- if [[ "$ACTUAL" != "$EXPECTED" ]]; then
- echo "Chart.yaml version '$ACTUAL' does not match tag version '$EXPECTED'" >&2
+ if [[ -z "$APP_VERSION" || "$APP_VERSION" == "null" ]] || ! printf '%s' "$APP_VERSION" | grep -Eq "$SEMVER"; then
+ echo "app_version '$APP_VERSION' is not a semver-like version" >&2
+ exit 1
+ fi
+ IMAGE_TAG="$INPUT_IMAGE_TAG"
+ if [[ -z "$IMAGE_TAG" ]]; then
+ IMAGE_TAG=$(yq -r '.image.tag' "$CHART_DIR/values.yaml")
+ fi
+ if [[ -z "$IMAGE_TAG" || "$IMAGE_TAG" == "null" ]] ||
+ ! printf '%s' "$IMAGE_TAG" | grep -Eq '^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$'; then
+ echo "image_tag '$IMAGE_TAG' is not a valid OCI tag" >&2
exit 1
fi
+ echo "branch=$BRANCH" >> "$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"
- # VERSION is consumed by the package/push step below.
- echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- echo "Publishing chart version=$ACTUAL appVersion=$APP_VERSION image.tag=$IMAGE_TAG"
+ - name: Update chart metadata
+ id: chart
+ env:
+ 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"
- # Pull deps before registry login.
- name: Build chart dependencies
run: helm dependency build "$CHART_DIR"
+ - name: Lint chart
+ run: helm lint "$CHART_DIR" --values "$CHART_DIR/ci/lint-values.yaml"
+
- name: Helm registry login
env:
HELM_REGISTRY_USERNAME: ${{ secrets.TRUEFORGE_ARTIFACTORY_USERNAME }}
@@ -143,6 +156,10 @@ jobs:
| helm registry login -u "$HELM_REGISTRY_USERNAME" --password-stdin "$HELM_REGISTRY_URL"
- name: Package and push chart
+ env:
+ VERSION: ${{ steps.chart.outputs.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")
@@ -154,4 +171,56 @@ jobs:
{
echo "### Helm chart"
echo "Pushed \`oci://${HELM_CHART_REPOSITORY}/${CHART_NAME}:${VERSION}\`"
+ echo "Image tag \`${IMAGE_TAG}\`"
+ echo "Branch \`${BRANCH}\`"
} >> "$GITHUB_STEP_SUMMARY"
+
+ - name: Commit chart metadata and tag
+ env:
+ VERSION: ${{ steps.chart.outputs.version }}
+ APP_VERSION: ${{ steps.resolve.outputs.app_version }}
+ IMAGE_TAG: ${{ steps.resolve.outputs.image_tag }}
+ BRANCH: ${{ steps.resolve.outputs.branch }}
+ run: |
+ set -euo pipefail
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+ 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
+ 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)"
+ }
+
+ 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
+ fi
+ git commit -m "release(chart): ${VERSION}"
+ if git push origin "HEAD:${BRANCH}"; then
+ tag_chart
+ exit 0
+ fi
+ echo "Push to $BRANCH failed (attempt $attempt); replay metadata onto origin/${BRANCH}"
+ git fetch origin "$BRANCH"
+ git reset --hard "origin/${BRANCH}"
+ apply_metadata
+ done
+ echo "Could not fast-forward chart metadata onto $BRANCH" >&2
+ exit 1
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 560552b86..1dcb94923 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,21 +1,24 @@
# npm publish for the four public packages, plus PyPI for python/trueforge_sdk.
#
-# npm and PyPI trusted publishers are bound to `release.yml`.
-# Do not rename this file without updating every package on npmjs.com and PyPI.
+# 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.
#
# On every push to main, changesets/action/select-mode chooses:
# - pending `.changeset/*.md` → version job opens/updates the Version Packages PR
# (install only; that PR is gated by CI.yml). 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,
-# then npm publish and PyPI publish in parallel
-# Merge the Version Packages PR to publish. There is no separate publish Action
-# and no `v*` tag trigger.
+# - 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). After the image is pushed, this workflow calls release-chart.yml
+# with branch main, app_version, and image_tag. Helm does not wait on pack.
+# Merge the Version Packages PR to publish. After Helm publish, release-chart.yml
+# tags charts/trueforge@<chartVersion> on the metadata commit.
#
# 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 only on the publish jobs.
-name: Release
+name: Version or publish packages
on:
push:
@@ -172,9 +175,6 @@ jobs:
needs: [pack, windows-npx-smoke]
runs-on: ubuntu-latest
timeout-minutes: 20
- outputs:
- trueforge_published: ${{ steps.trueforge.outputs.published }}
- trueforge_version: ${{ steps.trueforge.outputs.version }}
permissions:
contents: write
id-token: write
@@ -209,51 +209,6 @@ jobs:
# publishConfig.provenance is true on every public package.
NPM_CONFIG_PROVENANCE: 'true'
- - name: Detect @truefoundry/trueforge publish
- id: trueforge
- env:
- PUBLISHED: ${{ steps.publish.outputs.published }}
- PACKAGES_KEBAB: ${{ steps.publish.outputs['published-packages'] }}
- PACKAGES_CAMEL: ${{ steps.publish.outputs.publishedPackages }}
- run: |
- set -euo pipefail
- if [[ "${PUBLISHED:-}" != "true" ]]; then
- echo "published=false" >> "$GITHUB_OUTPUT"
- echo "version=" >> "$GITHUB_OUTPUT"
- exit 0
- fi
- PACKAGES="${PACKAGES_KEBAB:-${PACKAGES_CAMEL:-[]}}"
- VERSION=$(printf '%s' "$PACKAGES" | python3 -c '
- import json,sys
- pkgs=json.load(sys.stdin)
- for p in pkgs:
- if p.get("name")=="@truefoundry/trueforge":
- print(p["version"])
- break
- ')
- if [[ -n "$VERSION" ]]; then
- echo "published=true" >> "$GITHUB_OUTPUT"
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- echo "Published @truefoundry/trueforge@$VERSION"
- else
- echo "published=false" >> "$GITHUB_OUTPUT"
- echo "version=" >> "$GITHUB_OUTPUT"
- echo "@truefoundry/trueforge was not in this publish set"
- fi
-
- - name: Wait for npm to advertise package
- if: steps.trueforge.outputs.published == 'true'
- env:
- VERSION: ${{ steps.trueforge.outputs.version }}
- run: |
- echo "Newly published npm packages are typically available in about five minutes, and may take up to 15 minutes or more at peak times."
- echo "https://github.blog/changelog/2026-07-28-npm-publish-time-malware-scanning-and-dual-use-metadata/"
- for _ in $(seq 30); do
- npm view "@truefoundry/trueforge@$VERSION" version && exit 0
- sleep 30
- done
- exit 1
-
# Sibling of npm publish (same gates). Skips when pyproject version is already on PyPI.
publish-python:
name: Publish Python SDK
@@ -314,18 +269,90 @@ jobs:
with:
packages-dir: python/trueforge_sdk/dist
- # Same commit as this publish run (GITHUB_SHA). A workflow_dispatch --ref SHA
- # is rejected: the dispatch API only accepts a branch or tag name (HTTP 422).
- build-and-prepare-chart-release:
- name: Build and prepare chart release
- needs: publish
- if: needs.publish.outputs.trueforge_published == 'true'
- uses: ./.github/workflows/build-and-prepare-chart-release.yml
+ resolve-image:
+ name: Resolve image identity
+ if: needs.select-mode.outputs.mode == 'publish'
+ needs: select-mode
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ outputs:
+ app_version: ${{ steps.resolve.outputs.app_version }}
+ image_tag: ${{ steps.resolve.outputs.image_tag }}
+ skip: ${{ steps.resolve.outputs.skip }}
+ permissions:
+ contents: read
+ steps:
+ - name: Check out repo
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v7
+ with:
+ node-version: 24
+
+ - name: Resolve image identity
+ id: resolve
+ run: |
+ set -euo pipefail
+ SEMVER='^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$'
+ APP_VERSION=$(node -p "require('./packages/trueforge/package.json').version")
+ if [[ -z "$APP_VERSION" || "$APP_VERSION" == "undefined" ]] || ! printf '%s' "$APP_VERSION" | grep -Eq "$SEMVER"; then
+ echo "app_version '$APP_VERSION' is not a semver-like version" >&2
+ 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=true" >> "$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=false" >> "$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
+ fi
+
+ build-image:
+ name: Build and push server image
+ if: needs.resolve-image.outputs.skip == 'false'
+ needs: [resolve-image]
+ uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
permissions:
- contents: write
id-token: write
- pull-requests: write
- secrets: inherit
+ contents: read
with:
- app_version: ${{ needs.publish.outputs.trueforge_version }}
- update_app_version: true
+ artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
+ artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
+ image_artifact_name: trueforge
+ image_tag: ${{ needs.resolve-image.outputs.image_tag }}
+ image_context: .
+ dockerfile_path: Dockerfile
+ platforms: linux/amd64
+ enable_jfrog: true
+ enable_public_ecr: false
+ secrets:
+ artifactory_username: ${{ secrets.TRUEFORGE_ARTIFACTORY_USERNAME }}
+ artifactory_password: ${{ secrets.TRUEFORGE_ARTIFACTORY_PASSWORD }}
+
+ release-chart:
+ name: Publish Helm chart
+ if: needs.resolve-image.outputs.skip == 'false'
+ needs: [resolve-image, build-image]
+ uses: ./.github/workflows/release-chart.yml
+ permissions:
+ contents: write
+ with:
+ branch: main
+ app_version: ${{ needs.resolve-image.outputs.app_version }}
+ image_tag: ${{ needs.resolve-image.outputs.image_tag }}
+ secrets: inherit
diff --git a/.railway/README.md b/.railway/README.md
index 5375b3a89..9eef0348b 100644
--- a/.railway/README.md
+++ b/.railway/README.md
@@ -15,7 +15,7 @@ railway config apply
railway domain # public URL for the trueforge service
```
-- **Image:** `RAILWAY_DOCKERFILE_PATH=Dockerfile.dev` selects the from-source build.
+- **Image:** Railway builds the root from-source [`Dockerfile`](../Dockerfile).
- **API key:** Set `TRUEFORGE_API_KEY` yourself as a Railway shared variable. IaC only wires `${{shared.TRUEFORGE_API_KEY}}` onto `trueforge` and `trueforge-controller`.
- **Auth:** Off by default — anyone who can reach the URL is admin. Before sharing a deployment, enable [OIDC login](https://trueforge.dev/authentication/overview) (optional shared-variable block is commented in `railway.ts`).
diff --git a/.railway/railway.ts b/.railway/railway.ts
index d94a378db..288be706b 100644
--- a/.railway/railway.ts
+++ b/.railway/railway.ts
@@ -15,7 +15,7 @@
* Docs: https://docs.railway.com/infrastructure-as-code
*
* Auth is off by default (anyone who can reach the URL is admin). Before
- * sharing a deployment, enable OIDC — see the commented block below and
+ * sharing a deployment, enable OIDC - see the commented block below and
* https://trueforge.dev/authentication/overview
*/
import { defineRailway, github, group, postgres, project, redis, service } from 'railway/iac';
@@ -28,10 +28,7 @@ export default defineRailway(_ctx => {
// Deploys from this repository's default branch. Forks: change owner/repo
// (and optionally branch) to build your own copy.
source: github('truefoundry/trueforge'),
- // IaC `build` is a build *command* string (not CaC's builder/dockerfilePath object).
- // Non-root Dockerfile is selected via RAILWAY_DOCKERFILE_PATH below — without it,
- // Railway picks the root Dockerfile (npm install of a published version) and fails
- // without APP_VERSION.
+ // Railway uses the root from-source Dockerfile by default.
healthcheck: '/healthz',
healthcheckTimeout: 300,
deploy: {
@@ -41,15 +38,13 @@ export default defineRailway(_ctx => {
drainingSeconds: 35,
},
env: {
- // From-source image; root Dockerfile is the published npm recipe and needs APP_VERSION.
- RAILWAY_DOCKERFILE_PATH: 'Dockerfile.dev',
// Postgres + Redis (hosted topology)
STANDALONE: 'false',
DATABASE_URL: db.env.DATABASE_URL,
REDIS_URL: cache.env.REDIS_URL,
// Expanded by Railway at runtime once a public domain exists on this service.
PUBLIC_BASE_URL: 'https://${{RAILWAY_PUBLIC_DOMAIN}}',
- // Set once in Railway (shared); IaC only references it — see header.
+ // Set once in Railway (shared); IaC only references it - see header.
TRUEFORGE_API_KEY: _ctx.shared.TRUEFORGE_API_KEY,
// Optional OIDC (login off until these are set). Create matching *shared*
@@ -82,7 +77,6 @@ export default defineRailway(_ctx => {
drainingSeconds: 35,
},
env: {
- RAILWAY_DOCKERFILE_PATH: 'Dockerfile.dev',
STANDALONE: 'false',
DATABASE_URL: db.env.DATABASE_URL,
// Same shared key as the app (Bearer auth for schedule dispatch).
diff --git a/Dockerfile b/Dockerfile
index afb5dc4b2..a126843d4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,33 +1,115 @@
# syntax=docker/dockerfile:1
#
-# Production image: installs published @truefoundry/trueforge from npm.
-# The app bits match the npm package exactly (not floating monorepo source).
+# From-source multi-stage image for prod Helm, local smoke, and Railway.
+# Lives at the repository root because the
+# build needs the whole pnpm workspace as its context: the server depends on
+# the workspace package @truefoundry/trueforge-core.
#
-# Required build-arg:
-# APP_VERSION — npm version to install, e.g. 0.1.0
-#
-# Example:
-# docker build --build-arg APP_VERSION=0.1.0 -t trueforge:0.1.0 .
+# Dependency install uses pnpm fetch (lockfile-only) then install --offline so
+# the download layer stays cached when only package.json / scripts change.
+# See https://pnpm.io/cli/fetch. BuildKit cache mounts are avoided so the same
+# file builds on Railway Metal (which requires a hardcoded service id in mount ids).
-FROM node:24-slim AS runner
+FROM node:24-slim AS base
+ENV PNPM_HOME=/pnpm
+ENV PATH="$PNPM_HOME:$PATH"
+RUN corepack enable && pnpm config set store-dir /pnpm/store
WORKDIR /app
-# HOST=0.0.0.0 so Kubernetes Service/probe traffic reaches the process.
+
+# ---------------------------------------------------------------------------
+# store: the pnpm store, from the lockfile only (stable when manifests churn).
+# BuildKit cache mounts are omitted: Railway's Metal builder requires
+# `id=s/<service-id>-…` (hardcoded per deploy), which cannot live in a shared
+# OSS Dockerfile. Layer cache on this stage still hits when the lockfile is
+# unchanged.
+# ---------------------------------------------------------------------------
+FROM base AS store
+COPY pnpm-lock.yaml pnpm-workspace.yaml ./
+RUN pnpm fetch
+
+# ---------------------------------------------------------------------------
+# workspace: install inputs shared by every stage below - the manifests plus the
+# sources the root postinstall hook (build:gen) inlines.
+# ---------------------------------------------------------------------------
+FROM store AS workspace
+COPY package.json .npmrc tsconfig.base.json ./
+# Root scripts used by package build steps (rm-path.mjs, chmod-path.mjs).
+COPY scripts scripts
+COPY packages/trueforge-core/package.json packages/trueforge-core/package.json
+COPY packages/trueforge/package.json packages/trueforge/package.json
+COPY packages/trueforge-sdk/package.json packages/trueforge-sdk/package.json
+COPY packages/frontend/package.json packages/frontend/package.json
+COPY packages/trueforge-ui/package.json packages/trueforge-ui/package.json
+COPY packages/assistant-ui-runtime/package.json packages/assistant-ui-runtime/package.json
+COPY packages/trueforge-core/scripts packages/trueforge-core/scripts
+COPY packages/trueforge-core/src/core/sandbox/scripts packages/trueforge-core/src/core/sandbox/scripts
+
+# ---------------------------------------------------------------------------
+# builder: install all deps (incl. dev) and build trueforge-core + server.
+# SDK dist is copied into the production runner; host-dev/typecheck resolve SDK
+# from src/ via trueforge-dev. Build it here once for the image.
+# ---------------------------------------------------------------------------
+FROM workspace AS builder
+RUN pnpm install --frozen-lockfile --offline --filter @truefoundry/trueforge...
+COPY packages/trueforge-core packages/trueforge-core
+COPY packages/trueforge-sdk packages/trueforge-sdk
+RUN pnpm --filter @truefoundry/trueforge-sdk build
+COPY packages/trueforge packages/trueforge
+RUN pnpm --filter @truefoundry/trueforge-core build && pnpm --filter @truefoundry/trueforge build
+
+# ---------------------------------------------------------------------------
+# frontend-builder: build the UI the server serves (parallel to builder above).
+# Bundlers read SDK src/ (trueforge-dev); the UI prebuild emits the declarations
+# tsc needs, so this stage never compiles SDK JavaScript.
+# ---------------------------------------------------------------------------
+FROM workspace AS frontend-builder
+RUN pnpm install --frozen-lockfile --offline --filter frontend...
+COPY packages/trueforge-sdk packages/trueforge-sdk
+COPY packages/assistant-ui-runtime packages/assistant-ui-runtime
+COPY packages/trueforge-ui packages/trueforge-ui
+RUN pnpm --filter @truefoundry/trueforge-ui build
+COPY packages/frontend packages/frontend
+RUN pnpm --filter frontend build
+
+# ---------------------------------------------------------------------------
+# prod-deps: production dependency tree (no dev tooling), resolved offline.
+# ---------------------------------------------------------------------------
+FROM workspace AS prod-deps
+RUN pnpm install --frozen-lockfile --offline --prod --filter @truefoundry/trueforge...
+
+# ---------------------------------------------------------------------------
+# runner: minimal image with prod node_modules + built artifacts.
+# ---------------------------------------------------------------------------
+FROM base AS runner
+
ENV NODE_ENV=production \
- STANDALONE=false \
HOST=0.0.0.0
-ARG APP_VERSION
-RUN test -n "$APP_VERSION" || (echo "APP_VERSION build-arg is required" >&2 && exit 1)
+# Production dependency tree (pnpm workspace symlinks preserved).
+COPY --from=prod-deps /app/node_modules ./node_modules
+COPY --from=prod-deps /app/packages/trueforge-core/node_modules ./packages/trueforge-core/node_modules
+COPY --from=prod-deps /app/packages/trueforge/node_modules ./packages/trueforge/node_modules
+
+# Built workspace dependencies (@truefoundry/trueforge-core + SDK).
+COPY --from=builder /app/packages/trueforge-core/package.json ./packages/trueforge-core/package.json
+COPY --from=builder /app/packages/trueforge-core/dist ./packages/trueforge-core/dist
+COPY --from=builder /app/packages/trueforge-sdk/package.json ./packages/trueforge-sdk/package.json
+COPY --from=builder /app/packages/trueforge-sdk/dist ./packages/trueforge-sdk/dist
+
+# Built server (JS). UI is copied below from the parallel frontend stage into
+# dist/_frontend - same path as the npm tarball / `pnpm build` copy step.
+COPY --from=builder /app/packages/trueforge/package.json ./packages/trueforge/package.json
+COPY --from=builder /app/packages/trueforge/dist ./packages/trueforge/dist
+# Frontend builds in a parallel stage; place it at the same path as the npm tarball.
+COPY --from=frontend-builder /app/packages/frontend/dist ./packages/trueforge/dist/_frontend
-# Fail closed if the version is not on the registry (no workspace fallback).
-RUN npm install --omit=dev "@truefoundry/trueforge@${APP_VERSION}" \
- && npm cache clean --force
+WORKDIR /app/packages/trueforge
RUN groupadd --gid 10001 trueforge \
- && useradd --uid 10001 --gid trueforge --shell /usr/sbin/nologin trueforge
+ && useradd --uid 10001 --gid trueforge trueforge
EXPOSE 8790
-# Same entry as the from-source image / `pnpm start` (launch-only; dist is in the package).
+# Launch-only (matches root `pnpm start` / `standalone:start`). Image already contains dist.
USER 10001:10001
-CMD ["node", "node_modules/@truefoundry/trueforge/dist/main.js"]
+CMD ["node", "dist/main.js"]
diff --git a/Dockerfile.dev b/Dockerfile.dev
deleted file mode 100644
index 3e44d270b..000000000
--- a/Dockerfile.dev
+++ /dev/null
@@ -1,116 +0,0 @@
-# syntax=docker/dockerfile:1
-#
-# From-source multi-stage build for local smoke / floating-main / SHA-tagged
-# dev images. Production/OSS Helm images use the root Dockerfile (npm install).
-#
-# Lives at the repository root because the build needs the whole pnpm workspace
-# as its context: the server depends on the workspace package @truefoundry/trueforge-core.
-#
-# Dependency install uses pnpm fetch (lockfile-only) then install --offline so
-# the download layer stays cached when only package.json / scripts change.
-# See https://pnpm.io/cli/fetch. BuildKit cache mounts are avoided so the same
-# file builds on Railway Metal (which requires a hardcoded service id in mount ids).
-
-FROM node:24-slim AS base
-ENV PNPM_HOME=/pnpm
-ENV PATH="$PNPM_HOME:$PATH"
-RUN corepack enable && pnpm config set store-dir /pnpm/store
-WORKDIR /app
-
-# ---------------------------------------------------------------------------
-# store: the pnpm store, from the lockfile only (stable when manifests churn).
-# BuildKit cache mounts are omitted: Railway's Metal builder requires
-# `id=s/<service-id>-…` (hardcoded per deploy), which cannot live in a shared
-# OSS Dockerfile. Layer cache on this stage still hits when the lockfile is
-# unchanged.
-# ---------------------------------------------------------------------------
-FROM base AS store
-COPY pnpm-lock.yaml pnpm-workspace.yaml ./
-RUN pnpm fetch
-
-# ---------------------------------------------------------------------------
-# workspace: install inputs shared by every stage below — the manifests plus the
-# sources the root postinstall hook (build:gen) inlines.
-# ---------------------------------------------------------------------------
-FROM store AS workspace
-COPY package.json .npmrc tsconfig.base.json ./
-# Root scripts used by package build steps (rm-path.mjs, chmod-path.mjs).
-COPY scripts scripts
-COPY packages/trueforge-core/package.json packages/trueforge-core/package.json
-COPY packages/trueforge/package.json packages/trueforge/package.json
-COPY packages/trueforge-sdk/package.json packages/trueforge-sdk/package.json
-COPY packages/frontend/package.json packages/frontend/package.json
-COPY packages/trueforge-ui/package.json packages/trueforge-ui/package.json
-COPY packages/assistant-ui-runtime/package.json packages/assistant-ui-runtime/package.json
-COPY packages/trueforge-core/scripts packages/trueforge-core/scripts
-COPY packages/trueforge-core/src/core/sandbox/scripts packages/trueforge-core/src/core/sandbox/scripts
-
-# ---------------------------------------------------------------------------
-# builder: install all deps (incl. dev) and build trueforge-core + server.
-# SDK dist is copied into the production runner; host-dev/typecheck resolve SDK
-# from src/ via trueforge-dev. Build it here once for the image.
-# ---------------------------------------------------------------------------
-FROM workspace AS builder
-RUN pnpm install --frozen-lockfile --offline --filter @truefoundry/trueforge...
-COPY packages/trueforge-core packages/trueforge-core
-COPY packages/trueforge-sdk packages/trueforge-sdk
-RUN pnpm --filter @truefoundry/trueforge-sdk build
-COPY packages/trueforge packages/trueforge
-RUN pnpm --filter @truefoundry/trueforge-core build && pnpm --filter @truefoundry/trueforge build
-
-# ---------------------------------------------------------------------------
-# frontend-builder: build the UI the server serves (parallel to builder above).
-# Bundlers read SDK src/ (trueforge-dev); the UI prebuild emits the declarations
-# tsc needs, so this stage never compiles SDK JavaScript.
-# ---------------------------------------------------------------------------
-FROM workspace AS frontend-builder
-RUN pnpm install --frozen-lockfile --offline --filter frontend...
-COPY packages/trueforge-sdk packages/trueforge-sdk
-COPY packages/assistant-ui-runtime packages/assistant-ui-runtime
-COPY packages/trueforge-ui packages/trueforge-ui
-RUN pnpm --filter @truefoundry/trueforge-ui build
-COPY packages/frontend packages/frontend
-RUN pnpm --filter frontend build
-
-# ---------------------------------------------------------------------------
-# prod-deps: production dependency tree (no dev tooling), resolved offline.
-# ---------------------------------------------------------------------------
-FROM workspace AS prod-deps
-RUN pnpm install --frozen-lockfile --offline --prod --filter @truefoundry/trueforge...
-
-# ---------------------------------------------------------------------------
-# runner: minimal image with prod node_modules + built artifacts.
-# ---------------------------------------------------------------------------
-FROM base AS runner
-
-ENV NODE_ENV=production \
- HOST=0.0.0.0
-
-# Production dependency tree (pnpm workspace symlinks preserved).
-COPY --from=prod-deps /app/node_modules ./node_modules
-COPY --from=prod-deps /app/packages/trueforge-core/node_modules ./packages/trueforge-core/node_modules
-COPY --from=prod-deps /app/packages/trueforge/node_modules ./packages/trueforge/node_modules
-
-# Built workspace dependencies (@truefoundry/trueforge-core + SDK).
-COPY --from=builder /app/packages/trueforge-core/package.json ./packages/trueforge-core/package.json
-COPY --from=builder /app/packages/trueforge-core/dist ./packages/trueforge-core/dist
-COPY --from=builder /app/packages/trueforge-sdk/package.json ./packages/trueforge-sdk/package.json
-COPY --from=builder /app/packages/trueforge-sdk/dist ./packages/trueforge-sdk/dist
-
-# Built server (JS). UI is copied below from the parallel frontend stage into
-# dist/_frontend — same path as the npm tarball / `pnpm build` copy step.
-COPY --from=builder /app/packages/trueforge/package.json ./packages/trueforge/package.json
-COPY --from=builder /app/packages/trueforge/dist ./packages/trueforge/dist
-# Frontend builds in a parallel stage; place it at the same path as the npm tarball.
-COPY --from=frontend-builder /app/packages/frontend/dist ./packages/trueforge/dist/_frontend
-
-WORKDIR /app/packages/trueforge
-
-RUN groupadd --gid 10001 trueforge \
- && useradd --uid 10001 --gid trueforge trueforge
-
-EXPOSE 8790
-
-# Launch-only (matches root `pnpm start` / `standalone:start`). Image already contains dist.
-USER 10001:10001
-CMD ["node", "dist/main.js"]
diff --git a/Dockerfile.npm b/Dockerfile.npm
new file mode 100644
index 000000000..592593c88
--- /dev/null
+++ b/Dockerfile.npm
@@ -0,0 +1,33 @@
+# syntax=docker/dockerfile:1
+#
+# npm-install production image (the previous root Dockerfile). Prod Helm,
+# Compose, and Railway now build the from-source root Dockerfile instead.
+#
+# Required build-arg:
+# APP_VERSION - npm version to install, e.g. 0.1.0
+#
+# Example:
+# docker build -f Dockerfile.npm --build-arg APP_VERSION=0.1.0 -t trueforge:0.1.0 .
+
+FROM node:24-slim AS runner
+WORKDIR /app
+# HOST=0.0.0.0 so Kubernetes Service/probe traffic reaches the process.
+ENV NODE_ENV=production \
+ STANDALONE=false \
+ HOST=0.0.0.0
+
+ARG APP_VERSION
+RUN test -n "$APP_VERSION" || (echo "APP_VERSION build-arg is required" >&2 && exit 1)
+
+# Fail closed if the version is not on the registry (no workspace fallback).
+RUN npm install --omit=dev "@truefoundry/trueforge@${APP_VERSION}" \
+ && npm cache clean --force
+
+RUN groupadd --gid 10001 trueforge \
+ && useradd --uid 10001 --gid trueforge --shell /usr/sbin/nologin trueforge
+
+EXPOSE 8790
+
+# Same entry as the from-source image / `pnpm start` (launch-only; dist is in the package).
+USER 10001:10001
+CMD ["node", "node_modules/@truefoundry/trueforge/dist/main.js"]
diff --git a/RELEASING.md b/RELEASING.md
index b52b2b6ae..1e3ea4b35 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -1,29 +1,28 @@
# Releasing
-This repo ships npm packages, a production container image, a Helm chart, a
-sandbox image, and optional from-source **dev** images.
-
-| What | Trigger | Workflow |
-| ----------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
-| npm packages | Push to `main` (Changesets) | [`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 + chart-release PR | After `@truefoundry/trueforge` npm publish (reusable workflow), or manual dispatch | [`build-and-prepare-chart-release.yml`](.github/workflows/build-and-prepare-chart-release.yml) |
-| Chart tag, GitHub Release, OCI push | Merge of `release-chart/trueforge`, or push/dispatch of `charts/trueforge@*` | [`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) |
-| Dev (from-source) image | Manual `workflow_dispatch` | [`build-dev-image.yml`](.github/workflows/build-dev-image.yml) |
+This repo ships npm packages, a production container image, a Helm chart, and a
+sandbox image.
+
+| What | Trigger | Workflow |
+| ---------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------- |
+| npm packages | Push to `main` (Changesets) | [`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) |
## Versioning
| Artifact | Identity |
| ---------------------------- | --------------------------------------------------------------------------------------------------------- |
-| npm `@truefoundry/trueforge` | SemVer `X.Y.Z` — source of truth for app bits |
+| npm `@truefoundry/trueforge` | SemVer `X.Y.Z` - source of truth for published packages |
| PyPI `trueforge-sdk` | Same SemVer as `@truefoundry/trueforge-sdk` (mirrored into `pyproject.toml` on Version Packages) |
-| Chart `appVersion` | A **published** npm version |
-| Prod image | Root [`Dockerfile`](Dockerfile): `npm install @truefoundry/trueforge@$APP_VERSION` |
-| Prod image tag | `{appVersion}-{shortSha}` (shortSha of the build commit) |
-| Chart `version` | Independent SemVer; git tag `charts/[email protected]` must match |
+| 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 |
| Sandbox image | [`sandbox.Dockerfile`](packages/trueforge-core/scripts/sandbox/sandbox.Dockerfile); tag = full commit SHA |
-| Dev image | [`Dockerfile.dev`](Dockerfile.dev); tag = full commit SHA |
Install a published chart:
@@ -39,7 +38,7 @@ helm install trueforge oci://tfy.jfrog.io/tfy-helm/trueforge --version <chart-se
| ----------------------------- | ------------------------- | --------------------------------------------- |
| `@truefoundry/trueforge-core` | `packages/trueforge-core` | Library |
| `@truefoundry/trueforge` | `packages/trueforge` | App + CLI; tarball includes `dist/_frontend/` |
-| `@truefoundry/trueforge-sdk` | `packages/trueforge-sdk` | Fern-generated — do not hand-edit |
+| `@truefoundry/trueforge-sdk` | `packages/trueforge-sdk` | Fern-generated - do not hand-edit |
| `@truefoundry/trueforge-ui` | `packages/trueforge-ui` | Embeddable chat UI |
`packages/frontend` is not published; its build is copied into `@truefoundry/trueforge`'s tarball.
@@ -47,8 +46,9 @@ helm install trueforge oci://tfy.jfrog.io/tfy-helm/trueforge --version <chart-se
## Flow
-No `v*` tag publish. [`release.yml`](.github/workflows/release.yml) does both version and publish
-(`select-mode` → `version` \| `pack` → `publish`):
+No extra GitHub tag on the Version Packages path. [`release.yml`](.github/workflows/release.yml)
+is packages plus the from-source image (`select-mode` → `version` \| `pack` in
+parallel with image after `npm view`, then Helm):
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
@@ -58,16 +58,15 @@ No `v*` tag publish. [`release.yml`](.github/workflows/release.yml) does both ve
`scripts/version.mjs` mirrors that version into `python/trueforge_sdk` and
regenerates both SDKs. Review and merge.
3. With no pending changesets, **pack** (build/test) and **Windows npx smoke**
- run in parallel, then **npm publish** and **PyPI publish** run in parallel
- via trusted publishing (OIDC; no `NPM_TOKEN` / `PYPI_TOKEN`). PyPI skips when
- that `pyproject.toml` version is already published.
-4. If `@truefoundry/trueforge` was published, **Release** calls **Build and
- prepare chart release** as a reusable workflow on the same commit (so a
- newer `main` push cannot change the Dockerfile / shortSha). GitHub's
- `workflow_dispatch` API only accepts a branch or tag name, not a SHA.
-5. Pin dependents to exact versions during early `0.x`.
+ run 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=main`,
+ `app_version`, and `image_tag`. Helm does not wait on pack or npm.
+4. Pin dependents to exact versions during early `0.x`.
-`workflow_dispatch` on **Release** re-runs the same workflow.
+`workflow_dispatch` on **Version or publish packages** re-runs the same workflow.
## Prerelease mode
@@ -89,8 +88,12 @@ Each public **npm** package must list this repo + workflow as a trusted publishe
- Workflow: `release.yml` (exact filename)
- No GitHub Environment name
-Do not set `NPM_TOKEN` / `_authToken` on the npm publish job — that disables OIDC.
-Only the **publish** / **publish-python** jobs use OIDC (`id-token: write`).
+Do not rename this file without updating every package on npmjs.com (and PyPI
+below), or OIDC will 403.
+
+Do not set `NPM_TOKEN` / `_authToken` on the npm publish job - that disables OIDC.
+Only the **publish** / **publish-python** jobs use npm/PyPI OIDC (`id-token: write`).
+The image job also uses `id-token: write` for JFrog.
Publish attaches npm provenance (`NPM_CONFIG_PROVENANCE` on the publish job, and
`publishConfig.provenance: true` on every public package). That publicly attests
@@ -114,107 +117,89 @@ pnpm clean && pnpm build && pnpm standalone:start
## Troubleshooting
-- **No Version Packages PR** — no `.changeset/*.md` on `main`. Add one, or re-run **Release**.
-- **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.
-- **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
+- **No Version Packages PR** - no `.changeset/*.md` on `main`. Add one, or re-run **Version or publish packages**.
+- **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
(`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
+- **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 missing after npm publish** — dispatch the chart workflow on a
- **branch or tag** (not a SHA): `gh workflow run build-and-prepare-chart-release.yml --ref main -f app_version=X.Y.Z -f update_app_version=true`.
+- **Prod image / chart missing after package publish** - re-run **Version or publish packages**,
+ or publish a chart for an image already in the registry:
+ `gh workflow run release-chart.yml --ref main -f branch=main -f app_version=X.Y.Z -f image_tag=X.Y.Z-<sha>`.
---
# Image and Helm chart
```text
-npm publish @truefoundry/[email protected]
- → call build-and-prepare-chart-release (same commit as publish)
- → build Dockerfile (APP_VERSION=X.Y.Z) → push X.Y.Z-<shortSha>
- → open/update PR on branch release-chart/trueforge
- → merge PR → tag + GH Release + OCI push (release-chart.yml)
-
-manual rebuild (same or other app version)
- → workflow_dispatch build-and-prepare-chart-release
- → same PR path
-
-chart-only
- → human PR bumps Chart.yaml version
- → human tags charts/[email protected] (or gh release create)
- → release-chart.yml publishes OCI (no image rebuild)
+push to main (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 (main, 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
+
+manual chart-only (image already in the registry)
+ → workflow_dispatch release-chart.yml --ref main -f branch=main
+ (empty app_version / image_tag keep Chart.yaml / values.yaml)
```
-## Dockerfiles
-
-| File | Role |
-| ---------------------------------- | --------------------------------------------------------------------------------------- |
-| [`Dockerfile`](Dockerfile) | Prod/OSS. `ARG APP_VERSION` → `npm install @truefoundry/trueforge@$APP_VERSION` |
-| [`Dockerfile.dev`](Dockerfile.dev) | From-source. Used by [`docker-compose.yml`](docker-compose.yml) and **Build dev image** |
-
-Prod fails if that npm version is missing (no workspace fallback), so `appVersion` stays honest
-even when `main` has moved on.
-
-## Build and prepare chart release
-
-[`build-and-prepare-chart-release.yml`](.github/workflows/build-and-prepare-chart-release.yml)
-(`workflow_call` from **Release**, or manual `workflow_dispatch`):
-
-| Input | Default | Meaning |
-| -------------------- | ------------------------- | -------------------------------------------------------------------- |
-| `app_version` | `Chart.yaml` `appVersion` | npm version to install into the image |
-| `update_app_version` | `false` | Also write that version into `Chart.yaml` `appVersion` on the bot PR |
+## Dockerfile
-Always: build/push `{appVersion}-{shortSha}`, patch-bump chart `version`, set `image.tag`,
-open/update one PR on `release-chart/trueforge`.
+| File | Role |
+| ---------------------------------- | --------------------------------------------------------------------------- |
+| [`Dockerfile`](Dockerfile) | From-source. Prod Helm, [`docker-compose.yml`](docker-compose.yml), Railway |
+| [`Dockerfile.npm`](Dockerfile.npm) | Previous npm-install image (`APP_VERSION` from the registry) |
-```bash
-gh workflow run build-and-prepare-chart-release.yml
-gh workflow run build-and-prepare-chart-release.yml -f app_version=0.1.0
-# after npm publish of a new app version:
-gh workflow run build-and-prepare-chart-release.yml \
- -f app_version=0.1.0 -f update_app_version=true
-```
-
-You may edit chart SemVer (minor/major) on the PR before merging; the tag follows
-`Chart.yaml` `version` at merge time. Each run rebuilds the `release-chart/trueforge` branch
-from `main`, but a chart `version` on the branch that outranks the patch bump is carried over,
-so a manual bump survives later image rebuilds. Other manual edits on that branch do not —
-commit them to `main` instead.
+The image is the workspace at the package-publish commit. Chart `appVersion` is
+that commit's `packages/trueforge/package.json` version. Image tags use the
+peeled commit SHA (`git rev-parse HEAD`), not an annotated-tag object.
## Publish Helm chart
-[`release-chart.yml`](.github/workflows/release-chart.yml) is one job with three entry points:
+[`release.yml`](.github/workflows/release.yml) builds/pushes `{appVersion}-{shortSha}`
+from the root [`Dockerfile`](Dockerfile), then calls
+[`release-chart.yml`](.github/workflows/release-chart.yml) (`workflow_call`) with
+`branch=main`, `app_version`, and `image_tag`. The chart workflow does not build images.
-| Trigger | What it does |
-| --------------------------------------------------------- | ------------------------------------------------------------------- |
-| Merged PR from `release-chart/trueforge` (same repo only) | Create `charts/trueforge@<version>` + GitHub Release, then OCI push |
-| Push of tag `charts/trueforge@*` | OCI push only (tag already exists) |
-| `workflow_dispatch` with `tag=` | OCI push for an existing tag (retry) |
+`--ref` selects which workflow file GitHub runs. `branch` is the git branch that
+receives `Chart.yaml` / `values.yaml`.
-Only the `release-chart/trueforge` branch auto-tags. Ordinary merges never create chart tags.
+| 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` |
-Chart-only example:
+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.
```bash
-# after merging a PR that bumped Chart.yaml version:
-git tag charts/[email protected]
-git push origin charts/[email protected]
+gh workflow run release-chart.yml --ref main -f branch=main
+gh workflow run release-chart.yml --ref main \
+ -f branch=main \
+ -f app_version=0.3.0-rc.0 \
+ -f image_tag=0.3.0-rc.0-abcdef1
```
-## Dev / floating main
+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.
-External deploy repo owns `truefoundry.yaml` (`git-helm-repo` @ `main`). Build a from-source image:
-
-```bash
-gh workflow run build-dev-image.yml --ref main
-# → tfy.jfrog.io/tfy-images/trueforge:<fullSha>
-```
+## Devtest
-Patch that SHA into `image.tag`. Secrets via `secretKeyRef` only — never plaintext in git.
-Do not use SHA-tagged images as production chart defaults.
+[`deploy-devtest.yml`](.github/workflows/deploy-devtest.yml) pins the current
+`main` SHA into `truefoundry/trueforge-devtest-deployment`. That environment
+builds from source. Secrets via `secretKeyRef` only - never plaintext in git.
## Bundled chart dependencies
diff --git a/charts/trueforge/Chart.yaml b/charts/trueforge/Chart.yaml
index 950d9cb36..c3ed87f9b 100644
--- a/charts/trueforge/Chart.yaml
+++ b/charts/trueforge/Chart.yaml
@@ -2,8 +2,9 @@ apiVersion: v2
name: trueforge
description: TrueForge server (API + UI) served from a single container image.
type: application
-# version / appVersion are maintained on main (bot chart-release PR or human).
-# Publishing is gated by git tag charts/trueforge@<version> (must match version).
+# 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: "0.2.3-rc.0"
appVersion: "0.3.0-rc.0"
kubeVersion: ">=1.25.0-0"
diff --git a/charts/trueforge/README.md b/charts/trueforge/README.md
index d80dc2068..5c8bcc17c 100644
--- a/charts/trueforge/README.md
+++ b/charts/trueforge/README.md
@@ -1,17 +1,18 @@
# trueforge Helm chart
Deploys the TrueForge server, a single container image that serves both the API
-and the UI. **Production** images install `@truefoundry/trueforge` from npm
-(repository-root [`Dockerfile`](../../Dockerfile) with `APP_VERSION`).
-**Local smoke / from-source** builds use [`Dockerfile.dev`](../../Dockerfile.dev)
-(see [`docker-compose.yml`](../../docker-compose.yml)).
+and the UI. Production, Compose smoke, and Railway all build the repository-root
+[`Dockerfile`](../../Dockerfile) from the workspace checkout (see
+[`docker-compose.yml`](../../docker-compose.yml)).
The chart always runs the server in **distributed** mode (`STANDALONE=false`) against
Postgres and Redis.
-Chart `version` / `appVersion` / `image.tag` are maintained on `main` (chart-release
-bot PR or human). Publishing is gated by git tag `charts/trueforge@<version>`.
-See [`RELEASING.md`](../../RELEASING.md).
+Chart `version` / `appVersion` / `image.tag` are written on the branch passed to
+[`release-chart.yml`](../../.github/workflows/release-chart.yml) (`main` from
+[`release.yml`](../../.github/workflows/release.yml) after the image is pushed).
+That workflow then tags `charts/trueforge@<version>` on the metadata commit. See
+[`RELEASING.md`](../../RELEASING.md).
## Dev defaults (read before exposing)
diff --git a/charts/trueforge/values.yaml b/charts/trueforge/values.yaml
index 5bed10d0c..6d33b72cc 100644
--- a/charts/trueforge/values.yaml
+++ b/charts/trueforge/values.yaml
@@ -38,8 +38,9 @@ global:
sizeLimit: 10Mi
image:
repository: tfy.jfrog.io/tfy-images/trueforge
- # Tag defaults to chart appVersion when empty. Prod chart-release PRs set this
- # to {appVersion}-{shortSha} for the npm-install image already in the registry.
+ # Tag defaults to chart appVersion when empty. release-chart.yml sets this
+ # to {appVersion}-{shortSha} for the from-source image already in the
+ # registry.
tag: "0.3.0-rc.0-346221b"
pullPolicy: IfNotPresent
imagePullSecrets: []
@@ -116,11 +117,10 @@ controller:
enabled: true
# Annotations on the controller Deployment object (for example, Argo CD sync waves).
deploymentAnnotations: {}
- # Container command. Runs the controller entry from the published package inside
- # the image (root Dockerfile layout: /app/node_modules/@truefoundry/trueforge).
+ # Container command. Image WORKDIR is /app/packages/trueforge (from-source Dockerfile).
command:
- node
- - node_modules/@truefoundry/trueforge/dist/controller-main.js
+ - dist/controller-main.js
# Base URL the controller uses to reach the server (SERVER_URL).
# Empty → the in-cluster server Service (http(s)://<fullname>:<service.port>).
serverUrl: ""
diff --git a/docker-compose.yml b/docker-compose.yml
index df226c641..135ba13ad 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -33,8 +33,6 @@ services:
server:
build:
context: .
- # From-source image; root Dockerfile is the npm-install prod recipe.
- dockerfile: Dockerfile.dev
image: truefoundry-server:latest
ports:
# Host 8791 avoids conflict with host `pnpm dev` on 8790.
@@ -86,7 +84,6 @@ services:
controller:
build:
context: .
- dockerfile: Dockerfile.dev
image: truefoundry-server:latest
command: ['node', 'dist/controller-main.js']
environment:
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index 0a9a99e5b..9fbc2dd42 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -116,7 +116,7 @@ TrueForge runs in [two modes](/introduction#two-ways-to-run-it): **local mode**
</Tab>
<Tab title="Railway (Hosted)">
- Hosted topology on [Railway](https://railway.com) is defined with [Infrastructure as Code](https://docs.railway.com/infrastructure-as-code) in [`.railway/railway.ts`](https://github.com/truefoundry/trueforge/blob/main/.railway/railway.ts): one project with the server (UI + API), Postgres, and Redis. The app sets `RAILWAY_DOCKERFILE_PATH=Dockerfile.dev` so Railway builds the from-source image ([`Dockerfile.dev`](https://github.com/truefoundry/trueforge/blob/main/Dockerfile.dev)), and wires `DATABASE_URL`, `REDIS_URL`, and `PUBLIC_BASE_URL` in that file.
+ Hosted topology on [Railway](https://railway.com) is defined with [Infrastructure as Code](https://docs.railway.com/infrastructure-as-code) in [`.railway/railway.ts`](https://github.com/truefoundry/trueforge/blob/main/.railway/railway.ts): one project with the server (UI + API), Postgres, and Redis. Railway builds the from-source image ([`Dockerfile`](https://github.com/truefoundry/trueforge/blob/main/Dockerfile)), and wires `DATABASE_URL`, `REDIS_URL`, and `PUBLIC_BASE_URL` in that file.
From a clone of this repo:
@@ -136,7 +136,7 @@ TrueForge runs in [two modes](/introduction#two-ways-to-run-it): **local mode**
a Railway deployment beyond personal use.
</Warning>
- `STANDALONE=false` and `HOST=0.0.0.0` are baked into `Dockerfile.dev`. Railway injects `PORT` automatically.
+ `STANDALONE=false` and `HOST=0.0.0.0` are baked into `Dockerfile`. Railway injects `PORT` automatically.
</Tab>
</Tabs>
diff --git a/scripts/resolve-chart-version.sh b/scripts/resolve-chart-version.sh
index e74dce73c..d0395aa26 100755
--- a/scripts/resolve-chart-version.sh
+++ b/scripts/resolve-chart-version.sh
@@ -7,73 +7,86 @@ PR_VERSION=${3:-}
SEMVER='^([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z.-]+)?$'
-if [[ ! "$CURRENT" =~ $SEMVER ]]; then
+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
-MAJOR=${BASH_REMATCH[1]}
-MINOR=${BASH_REMATCH[2]}
-PATCH=${BASH_REMATCH[3]}
-CURRENT_PRERELEASE=${BASH_REMATCH[4]:-}
-SELECTED_MAJOR=$MAJOR
-SELECTED_MINOR=$MINOR
-SELECTED_PATCH=$PATCH
-
-# A stable chart starts the next patch. A prerelease chart is already on its
-# target core, so subsequent RCs and the stable release keep that core.
-if [[ -z "$CURRENT_PRERELEASE" ]]; then
- SELECTED_PATCH=$((PATCH + 1))
-fi
-
-if [[ ! "$APP_VERSION" =~ $SEMVER ]]; then
+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
-APP_PRERELEASE=${BASH_REMATCH[4]:-}
-PR_PRERELEASE=""
-PR_CORE_SELECTED=false
+# Chart major.minor follows the app package (and thus the docker tag prefix).
+SELECTED_MAJOR=$APP_MAJOR
+SELECTED_MINOR=$APP_MINOR
-if [[ -n "$PR_VERSION" && "$PR_VERSION" =~ $SEMVER ]]; then
- PR_MAJOR=${BASH_REMATCH[1]}
- PR_MINOR=${BASH_REMATCH[2]}
- PR_PATCH=${BASH_REMATCH[3]}
- PR_PRERELEASE=${BASH_REMATCH[4]:-}
+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
- if ((PR_MAJOR > SELECTED_MAJOR ||
- (PR_MAJOR == SELECTED_MAJOR && PR_MINOR > SELECTED_MINOR) ||
- (PR_MAJOR == SELECTED_MAJOR && PR_MINOR == SELECTED_MINOR && PR_PATCH > SELECTED_PATCH))); then
- SELECTED_MAJOR=$PR_MAJOR
- SELECTED_MINOR=$PR_MINOR
- SELECTED_PATCH=$PR_PATCH
- PR_CORE_SELECTED=true
- elif ((PR_MAJOR == SELECTED_MAJOR && PR_MINOR == SELECTED_MINOR && PR_PATCH == SELECTED_PATCH)); then
- PR_CORE_SELECTED=true
+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
-# The app version only selects stable or prerelease mode. Chart RC counters are
-# derived from chart versions and advance independently from the app's suffix.
-SELECTED_PRERELEASE=""
-if [[ -n "$APP_PRERELEASE" ]]; then
+SELECTED_PRE=""
+if [[ -n "$APP_PRE" ]]; then
RC_COUNTER='^-rc\.([0-9]+)$'
HIGHEST_RC=-1
- if ((MAJOR == SELECTED_MAJOR && MINOR == SELECTED_MINOR && PATCH == SELECTED_PATCH)) &&
- [[ "$CURRENT_PRERELEASE" =~ $RC_COUNTER ]]; then
+ 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_PRERELEASE" =~ $RC_COUNTER ]]; then
+ 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_PRERELEASE="-rc.$((HIGHEST_RC + 1))"
+ SELECTED_PRE="-rc.$((HIGHEST_RC + 1))"
fi
-VERSION="${SELECTED_MAJOR}.${SELECTED_MINOR}.${SELECTED_PATCH}${SELECTED_PRERELEASE}"
-printf '%s\n' "$VERSION"
+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
index 912cf7a3c..3514f5ab9 100755
--- a/tests/scripts/resolve-chart-version.test.sh
+++ b/tests/scripts/resolve-chart-version.test.sh
@@ -21,12 +21,11 @@ assert_version() {
fi
}
-# Stable chart releases continue with patch bumps.
+# 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 starts the chart's own RC counter at zero. The app's
-# prerelease tag and counter do not influence the chart version.
+# 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.
@@ -39,11 +38,18 @@ assert_version 0.1.6-rc.5 0.1.6-rc.3 0.1.5-rc.7 0.1.6-rc.4
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
-# A reviewed higher chart core is preserved without coupling it to the app core.
-assert_version 0.2.0-rc.0 0.1.5 0.1.5-rc.3 0.2.0
-assert_version 0.2.0-rc.5 0.1.5 0.1.5-rc.3 0.2.0-rc.4
-assert_version 0.2.0 0.1.5 0.1.5 0.2.0-rc.4
-assert_version 0.1.6-rc.0 0.1.5 0.1.5-rc.3 0.1.4-rc.9
+# 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