From c50f374fd6c640950d820b494fd781c3b76080cc Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Mon, 5 Oct 2026 11:04:00 +0000 Subject: [PATCH 1/2] Run generate-clijson cleanup via .codegen.json post_generate Relocate the post-`genkit update-sdk` cleanup (restore .gitattributes, relocate the tagging scripts, rewrite and format tagging.yml, drop the unused next-changelog.yml, scrub internal proxy URLs from the genkit *.py.lock files) from the generate-clijson Taskfile steps into .codegen.json's toolchain.post_generate, so genkit performs it for every update-sdk caller rather than only `./task generate-clijson`. The SDK-version consistency check stays in the Taskfile for faster feedback when running generate-clijson manually. Co-authored-by: Isaac --- .codegen.json | 9 +++++++++ Taskfile.yml | 35 +++++------------------------------ 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/.codegen.json b/.codegen.json index 990e248ed56..b6c5b78092f 100644 --- a/.codegen.json +++ b/.codegen.json @@ -19,6 +19,15 @@ "toolchain": { "required": [ "go" + ], + "post_generate": [ + "git checkout -- .gitattributes", + "rm .github/workflows/next-changelog.yml", + "mv tagging.py internal/genkit/tagging.py", + "mv tagging.py.lock internal/genkit/tagging.py.lock", + "if [ \"$(uname)\" = \"Darwin\" ]; then sed -i '' 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml; else sed -i 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml; fi", + "if [ \"$(uname)\" = \"Darwin\" ]; then sed -i '' 's|https://pypi-proxy.cloud.databricks.com/simple/\\{0,1\\}|https://pypi.org/simple|g' internal/genkit/*.py.lock; else sed -i 's|https://pypi-proxy.cloud.databricks.com/simple/\\{0,1\\}|https://pypi.org/simple|g' internal/genkit/*.py.lock; fi", + "go tool -modfile=tools/go.mod yamlfmt .github/workflows/tagging.yml" ] } } diff --git a/Taskfile.yml b/Taskfile.yml index 2c9229dad51..1b018cf52c6 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -934,37 +934,12 @@ tasks: --dir "{{.ROOT_DIR}}" \ --openapi-spec-file "$BUILD_DIR/universe/bazel-bin/openapi/all-internal.json" \ --openapi-spec-sha "$OPENAPI_SHA" - # genkit also writes .gitattributes, but that file is owned by - # generate-cligen (which derives it from .gitattributes.manual plus the - # rendered file list), so discard genkit's copy. - - git checkout -- .gitattributes + # .codegen.json owns cleanup so all update-sdk callers use the same script + # locations and workflow paths. Its lock rewrite preserves dependency changes + # while removing internal registry URLs from published files. + # The SDK-version consistency check stays here (not in post_generate) for + # faster feedback when running generate-clijson manually. - go test -timeout 240s -run TestConsistentDatabricksSdkVersion github.com/databricks/cli/internal/build - - rm .github/workflows/next-changelog.yml - - mv tagging.py internal/genkit/tagging.py - - mv tagging.py.lock internal/genkit/tagging.py.lock - # The release workflow tagging.yml expects tagging.py in a different location - # so we rewrite via sed - - | - if [ "$(uname)" = "Darwin" ]; then - sed -i '' 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml - else - sed -i 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml - fi - # In an environment configured with the internal PyPI proxy, uv bakes the - # proxy URL into the resolved locks. Unlike pydabs (which blind-reverts its - # locks because codegen never wants to change them), these locks legitimately - # track the synced producer's deps, so rewrite only the proxy URL back to the - # public registry and preserve any real dependency changes. Glob the lock - # files so a future genkit lock is scrubbed without editing this task. The - # trailing slash is optional so both proxy URL forms are matched. - # check-lockfiles is the backstop if this ever misses. - - | - if [ "$(uname)" = "Darwin" ]; then - sed -i '' 's|https://pypi-proxy.cloud.databricks.com/simple/\{0,1\}|https://pypi.org/simple|g' internal/genkit/*.py.lock - else - sed -i 's|https://pypi-proxy.cloud.databricks.com/simple/\{0,1\}|https://pypi.org/simple|g' internal/genkit/*.py.lock - fi - - "{{.GO_TOOL}} yamlfmt .github/workflows/tagging.yml" - task: ws # Refreshes out.fields.txt, which records the field paths / types emitted by From 950a39c47de76ff42d222d521df7b7f7ac0f0ef2 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Fri, 9 Oct 2026 15:50:31 +0000 Subject: [PATCH 2/2] Move generate-clijson cleanup into a reusable generate-clijson-post task Instead of running the post-`genkit update-sdk` cleanup from .codegen.json's toolchain.post_generate, keep it in the Taskfile as a dedicated generate-clijson-post task that generate-clijson references at the end. The SDK bumper can then invoke the same cleanup after its own update-sdk run. The cleanup steps (restore .gitattributes, drop next-changelog.yml, relocate the tagging scripts, rewrite and format tagging.yml, scrub internal proxy URLs from the genkit *.py.lock files) and the trailing 'ws' whitespace step all move into the new task. The SDK-version consistency check stays inline in generate-clijson for faster feedback when run manually. Co-authored-by: Isaac --- .codegen.json | 9 --------- Taskfile.yml | 46 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.codegen.json b/.codegen.json index b6c5b78092f..990e248ed56 100644 --- a/.codegen.json +++ b/.codegen.json @@ -19,15 +19,6 @@ "toolchain": { "required": [ "go" - ], - "post_generate": [ - "git checkout -- .gitattributes", - "rm .github/workflows/next-changelog.yml", - "mv tagging.py internal/genkit/tagging.py", - "mv tagging.py.lock internal/genkit/tagging.py.lock", - "if [ \"$(uname)\" = \"Darwin\" ]; then sed -i '' 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml; else sed -i 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml; fi", - "if [ \"$(uname)\" = \"Darwin\" ]; then sed -i '' 's|https://pypi-proxy.cloud.databricks.com/simple/\\{0,1\\}|https://pypi.org/simple|g' internal/genkit/*.py.lock; else sed -i 's|https://pypi-proxy.cloud.databricks.com/simple/\\{0,1\\}|https://pypi.org/simple|g' internal/genkit/*.py.lock; fi", - "go tool -modfile=tools/go.mod yamlfmt .github/workflows/tagging.yml" ] } } diff --git a/Taskfile.yml b/Taskfile.yml index cecf21fd6df..be1c0e72146 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -887,12 +887,48 @@ tasks: --dir "{{.ROOT_DIR}}" \ --openapi-spec-file "$BUILD_DIR/universe/bazel-bin/openapi/all-internal.json" \ --openapi-spec-sha "$OPENAPI_SHA" - # .codegen.json owns cleanup so all update-sdk callers use the same script - # locations and workflow paths. Its lock rewrite preserves dependency changes - # while removing internal registry URLs from published files. - # The SDK-version consistency check stays here (not in post_generate) for - # faster feedback when running generate-clijson manually. + # The SDK-version consistency check runs here for fast feedback when + # generate-clijson is invoked manually. Cleanup of genkit's output is + # delegated to generate-clijson-post so the SDK bumper can reuse it. - go test -timeout 240s -run TestConsistentDatabricksSdkVersion github.com/databricks/cli/internal/build + - task: generate-clijson-post + + # Post-processing for genkit's `update-sdk` output, factored out of + # generate-clijson so the SDK bumper can run the same cleanup after its own + # update-sdk invocation. + generate-clijson-post: + desc: Clean up genkit update-sdk output (shared by generate-clijson and the SDK bumper) + cmds: + # genkit also writes .gitattributes, but that file is owned by + # generate-cligen (which derives it from .gitattributes.manual plus the + # rendered file list), so discard genkit's copy. + - git checkout -- .gitattributes + - rm .github/workflows/next-changelog.yml + - mv tagging.py internal/genkit/tagging.py + - mv tagging.py.lock internal/genkit/tagging.py.lock + # The release workflow tagging.yml expects tagging.py in a different location + # so we rewrite via sed + - | + if [ "$(uname)" = "Darwin" ]; then + sed -i '' 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml + else + sed -i 's|tagging.py|internal/genkit/tagging.py|g' .github/workflows/tagging.yml + fi + # In an environment configured with the internal PyPI proxy, uv bakes the + # proxy URL into the resolved locks. Unlike pydabs (which blind-reverts its + # locks because codegen never wants to change them), these locks legitimately + # track the synced producer's deps, so rewrite only the proxy URL back to the + # public registry and preserve any real dependency changes. Glob the lock + # files so a future genkit lock is scrubbed without editing this task. The + # trailing slash is optional so both proxy URL forms are matched. + # check-lockfiles is the backstop if this ever misses. + - | + if [ "$(uname)" = "Darwin" ]; then + sed -i '' 's|https://pypi-proxy.cloud.databricks.com/simple/\{0,1\}|https://pypi.org/simple|g' internal/genkit/*.py.lock + else + sed -i 's|https://pypi-proxy.cloud.databricks.com/simple/\{0,1\}|https://pypi.org/simple|g' internal/genkit/*.py.lock + fi + - "{{.GO_TOOL}} yamlfmt .github/workflows/tagging.yml" - task: ws # Refreshes out.fields.txt, which records the field paths / types emitted by