From d45dc9a22cdb66e10a2071a38a30a6be402c48cb Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 6 May 2026 21:01:51 +0200 Subject: [PATCH 1/8] Add workflow to update jsonschema_for_docs.json after each release `bundle/internal/schema/since_version.go` reads `git tag --list 'v*'` to compute `x-since-version` annotations. The committed file therefore goes stale by one release as soon as the next tag is pushed: fields shipped in that tag don't get stamped until the schema is regenerated against a tag list that includes the new tag. The new workflow runs on every `v*` tag push (and via workflow_dispatch), regenerates the file from `main`, asserts that nothing other than `bundle/schema/jsonschema_for_docs.json` changed, and pushes the update directly to `main`. Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 103 +++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/update-schema-docs.yml diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml new file mode 100644 index 0000000000..4481112afa --- /dev/null +++ b/.github/workflows/update-schema-docs.yml @@ -0,0 +1,103 @@ +name: update-schema-docs + +# Regenerate bundle/schema/jsonschema_for_docs.json after every release. +# +# bundle/internal/schema/since_version.go computes `x-since-version` annotations +# from the list of `v*` git tags that exist when the schema is generated. The +# committed file is therefore stale by one release as soon as the next tag is +# pushed: fields shipped in that tag don't get stamped until the file is +# regenerated against a tag list that includes it. +# +# This workflow runs on every `v*` tag push, regenerates the file from `main`, +# and pushes the updated file directly to `main`. + +on: + push: + tags: + - "v*" + + workflow_dispatch: + inputs: + tag: + description: "Release tag this run is updating annotations for (e.g. v0.299.0). Used in the commit message only." + required: false + +permissions: + contents: write + +jobs: + update-schema-docs: + runs-on: + group: databricks-protected-runner-group-large + labels: linux-ubuntu-latest-large + + steps: + - name: Checkout main + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + # The commit lands on main, not the tagged commit, so check main out + # directly. fetch-depth: 0 + fetch-tags: true ensure since_version.go + # can resolve `git show :bundle/schema/jsonschema.json` for every + # historical release. + ref: main + fetch-depth: 0 + fetch-tags: true + + - name: Setup Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + with: + go-version-file: go.mod + cache-dependency-path: | + go.sum + bundle/internal/schema/*.* + + - name: Determine release tag + id: tag + env: + GITHUB_REF: ${{ github.ref }} + INPUT_TAG: ${{ inputs.tag }} + run: | + if [ "${{ github.event_name }}" = "push" ]; then + tag="${GITHUB_REF#refs/tags/}" + else + tag="${INPUT_TAG:-manual}" + fi + echo "tag=$tag" >> "$GITHUB_OUTPUT" + + - name: Regenerate jsonschema_for_docs.json + run: go tool -modfile=tools/task/go.mod task --force generate-schema-docs + + - name: Show diff + run: git diff -- bundle/schema/jsonschema_for_docs.json + + # Fail loudly if regeneration touches anything other than the docs schema. + # Anything else (annotations.yml, untracked files, ...) is a bug in the + # generator, not something we want to silently push to main. + - name: Assert only jsonschema_for_docs.json changed + id: check + run: | + changed=$(git status --porcelain) + if [ -z "$changed" ]; then + echo "No changes; skipping commit." + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + expected=" M bundle/schema/jsonschema_for_docs.json" + if [ "$changed" != "$expected" ]; then + echo "Expected only bundle/schema/jsonschema_for_docs.json to be modified." + echo "Actual git status --porcelain:" + echo "$changed" + exit 1 + fi + echo "skip=false" >> "$GITHUB_OUTPUT" + + - name: Commit and push to main + if: steps.check.outputs.skip != 'true' + env: + TAG: ${{ steps.tag.outputs.tag }} + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add bundle/schema/jsonschema_for_docs.json + git commit -m "Update jsonschema_for_docs.json since-versions for ${TAG}" + git push origin HEAD:main From 6a8a5edf0d52507178e761754da8205ed90e1808 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 6 May 2026 21:14:55 +0200 Subject: [PATCH 2/8] Publish jsonschema_for_docs.json to docgen branch instead of main main remains untouched. The workflow regenerates the schema in a main checkout (full history + tags so since_version.go can stamp), copies the result into a worktree on the docgen branch, and pushes there. workflow_dispatch no longer takes a tag input; it picks up the most recent v* tag automatically. Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 76 ++++++++++++++---------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index 4481112afa..b67d98f822 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -1,15 +1,12 @@ name: update-schema-docs -# Regenerate bundle/schema/jsonschema_for_docs.json after every release. +# Regenerate bundle/schema/jsonschema_for_docs.json after every release and +# publish it to the `docgen` branch. # -# bundle/internal/schema/since_version.go computes `x-since-version` annotations +# bundle/internal/schema/since_version.go derives `x-since-version` annotations # from the list of `v*` git tags that exist when the schema is generated. The -# committed file is therefore stale by one release as soon as the next tag is -# pushed: fields shipped in that tag don't get stamped until the file is -# regenerated against a tag list that includes it. -# -# This workflow runs on every `v*` tag push, regenerates the file from `main`, -# and pushes the updated file directly to `main`. +# `docgen` branch is therefore stale by one release as soon as the next tag is +# pushed; this workflow keeps it current. on: push: @@ -17,10 +14,6 @@ on: - "v*" workflow_dispatch: - inputs: - tag: - description: "Release tag this run is updating annotations for (e.g. v0.299.0). Used in the commit message only." - required: false permissions: contents: write @@ -35,10 +28,9 @@ jobs: - name: Checkout main uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: - # The commit lands on main, not the tagged commit, so check main out - # directly. fetch-depth: 0 + fetch-tags: true ensure since_version.go - # can resolve `git show :bundle/schema/jsonschema.json` for every - # historical release. + # Regen runs against `main`. fetch-depth: 0 + fetch-tags: true ensure + # since_version.go can resolve `git show :bundle/schema/jsonschema.json` + # for every historical release. ref: main fetch-depth: 0 fetch-tags: true @@ -55,49 +47,67 @@ jobs: id: tag env: GITHUB_REF: ${{ github.ref }} - INPUT_TAG: ${{ inputs.tag }} run: | if [ "${{ github.event_name }}" = "push" ]; then tag="${GITHUB_REF#refs/tags/}" else - tag="${INPUT_TAG:-manual}" + tag=$(git tag --list 'v*' --sort=-version:refname | head -n 1) + fi + if [ -z "$tag" ]; then + echo "Could not determine a v* tag to publish for." >&2 + exit 1 fi echo "tag=$tag" >> "$GITHUB_OUTPUT" + echo "Publishing for tag $tag" - name: Regenerate jsonschema_for_docs.json run: go tool -modfile=tools/task/go.mod task --force generate-schema-docs - - name: Show diff - run: git diff -- bundle/schema/jsonschema_for_docs.json - # Fail loudly if regeneration touches anything other than the docs schema. # Anything else (annotations.yml, untracked files, ...) is a bug in the - # generator, not something we want to silently push to main. - - name: Assert only jsonschema_for_docs.json changed - id: check + # generator, not something we want to silently publish. + - name: Assert only jsonschema_for_docs.json changed on main run: | changed=$(git status --porcelain) + expected=" M bundle/schema/jsonschema_for_docs.json" if [ -z "$changed" ]; then - echo "No changes; skipping commit." - echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Regeneration produced no diff against main." exit 0 fi - expected=" M bundle/schema/jsonschema_for_docs.json" if [ "$changed" != "$expected" ]; then echo "Expected only bundle/schema/jsonschema_for_docs.json to be modified." echo "Actual git status --porcelain:" echo "$changed" exit 1 fi - echo "skip=false" >> "$GITHUB_OUTPUT" - - name: Commit and push to main - if: steps.check.outputs.skip != 'true' + - name: Capture regenerated file + run: | + mkdir -p "$RUNNER_TEMP/regen" + cp bundle/schema/jsonschema_for_docs.json "$RUNNER_TEMP/regen/jsonschema_for_docs.json" + + - name: Check out docgen worktree + run: | + git fetch origin docgen + git worktree add "$RUNNER_TEMP/docgen" origin/docgen + + - name: Stage regenerated file on docgen + working-directory: ${{ runner.temp }}/docgen + run: | + mkdir -p bundle/schema + cp "$RUNNER_TEMP/regen/jsonschema_for_docs.json" bundle/schema/jsonschema_for_docs.json + git add bundle/schema/jsonschema_for_docs.json + + - name: Commit and push to docgen + working-directory: ${{ runner.temp }}/docgen env: TAG: ${{ steps.tag.outputs.tag }} run: | + if git diff --cached --quiet; then + echo "docgen already up to date for ${TAG}; nothing to commit." + exit 0 + fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add bundle/schema/jsonschema_for_docs.json - git commit -m "Update jsonschema_for_docs.json since-versions for ${TAG}" - git push origin HEAD:main + git commit -m "Update jsonschema_for_docs.json for ${TAG}" + git push origin HEAD:docgen From f5e93db7f3ef8cc94789391fcd1cec1464ba2b5a Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 6 May 2026 21:15:35 +0200 Subject: [PATCH 3/8] TEMP: trigger update-schema-docs on PR branch push for end-to-end test Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index b67d98f822..9071c7867d 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -12,6 +12,10 @@ on: push: tags: - "v*" + # TEMP: drives end-to-end test on the PR branch (workflow_dispatch is + # unavailable until the file lands on main). Remove before merging. + branches: + - workflow/update-schema-docs-on-release workflow_dispatch: From e980cf78357eb5bab2e73948d95adf77979271cc Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 6 May 2026 21:17:53 +0200 Subject: [PATCH 4/8] Use JFrog Go proxy in update-schema-docs workflow Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index 9071c7867d..5c54f2b27c 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -21,6 +21,8 @@ on: permissions: contents: write + # Required by setup-jfrog (GOPROXY exchange). + id-token: write jobs: update-schema-docs: @@ -39,6 +41,9 @@ jobs: fetch-depth: 0 fetch-tags: true + - name: Setup JFrog + uses: ./.github/actions/setup-jfrog + - name: Setup Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: From 1708a6e37ed3076761905b2499dda90a2e338c7b Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 6 May 2026 21:20:52 +0200 Subject: [PATCH 5/8] Detect tag via github.ref_type instead of stripping refs/tags/ A branch push left GITHUB_REF starting with refs/heads/, so the strip was a no-op and the wrong value ended up in the commit message. ref_type/ref_name are unambiguous. Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index 5c54f2b27c..cd288db4f4 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -55,10 +55,11 @@ jobs: - name: Determine release tag id: tag env: - GITHUB_REF: ${{ github.ref }} + REF_TYPE: ${{ github.ref_type }} + REF_NAME: ${{ github.ref_name }} run: | - if [ "${{ github.event_name }}" = "push" ]; then - tag="${GITHUB_REF#refs/tags/}" + if [ "$REF_TYPE" = "tag" ]; then + tag="$REF_NAME" else tag=$(git tag --list 'v*' --sort=-version:refname | head -n 1) fi From aeb0d4246c9e08e46dfe014a55b4d6e995e599a9 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Wed, 6 May 2026 21:22:53 +0200 Subject: [PATCH 6/8] Remove temporary PR-branch trigger now that end-to-end test passed Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index cd288db4f4..915bddccec 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -12,10 +12,6 @@ on: push: tags: - "v*" - # TEMP: drives end-to-end test on the PR branch (workflow_dispatch is - # unavailable until the file lands on main). Remove before merging. - branches: - - workflow/update-schema-docs-on-release workflow_dispatch: From 6341c6399ea16b529ab96425fb941447c1b9b9ae Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 7 May 2026 11:27:41 +0200 Subject: [PATCH 7/8] Scope tag matching to vN.N.N* (review feedback from @janniklasrose) Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index 915bddccec..634eacdd3c 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -11,7 +11,7 @@ name: update-schema-docs on: push: tags: - - "v*" + - "v[0-9]+.[0-9]+.[0-9]+*" workflow_dispatch: @@ -57,10 +57,12 @@ jobs: if [ "$REF_TYPE" = "tag" ]; then tag="$REF_NAME" else - tag=$(git tag --list 'v*' --sort=-version:refname | head -n 1) + # git tag --list uses fnmatch (no `+`), so post-filter with grep + # to match the same shape as the trigger above. + tag=$(git tag --list 'v*' --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' | head -n 1) fi if [ -z "$tag" ]; then - echo "Could not determine a v* tag to publish for." >&2 + echo "Could not determine a release tag to publish for." >&2 exit 1 fi echo "tag=$tag" >> "$GITHUB_OUTPUT" From 2a53bae26c618c07566182a6feee17ccc5fea848 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 7 May 2026 11:47:36 +0200 Subject: [PATCH 8/8] Use chomp-strip block scalar for last run block (yamlfmt) Co-authored-by: Isaac --- .github/workflows/update-schema-docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-schema-docs.yml b/.github/workflows/update-schema-docs.yml index 634eacdd3c..f47e191e49 100644 --- a/.github/workflows/update-schema-docs.yml +++ b/.github/workflows/update-schema-docs.yml @@ -110,7 +110,7 @@ jobs: working-directory: ${{ runner.temp }}/docgen env: TAG: ${{ steps.tag.outputs.tag }} - run: | + run: |- if git diff --cached --quiet; then echo "docgen already up to date for ${TAG}; nothing to commit." exit 0