[POC] DABs AIR native fields - #6428
Conversation
…git ref
Proposal for AIR-on-DABs code_source parity (see DABs x AIR CLI Alignment).
Extends the existing `artifacts` block so DABs can build the code tarball itself
instead of only uploading a user build command's output:
artifacts:
code_source:
type: tgz # new ArtifactType (was whl|jar)
include: [src/...] # subpaths to pack, gitignore-honored
git: {branch|commit} # snapshot a ref instead of the working tree
files: [{source: ./dist/code.tgz}]
`build` and `git`/`include` are mutually exclusive: either the user's command
produces the tarball (today's behavior) or DABs does. The produced file flows
through the existing artifact upload path, so an ai_runtime_task's
code_source_path pointing at it is uploaded and rewritten to the remote path
with no new reference syntax.
- include: reuses the bundle sync walker (matches file-sync filtering)
- git: shells out to `git archive`
Verified end-to-end on staging (both modes deploy; code_source_path rewritten).
Open for review: this is a proposal to react to, not a finished feature.
jsonschema annotations for the new fields are a follow-up.
Co-authored-by: Isaac
Approval status: pending
|
- annotations.yml: descriptions for the new `include`/`git` (+ branch/commit) fields and `tgz` type, so TestRequiredAnnotationsForNewFields passes. - jsonschema.json: regenerated (adds include/git/ArtifactGit/tgz; scoped diff). - validate/strict acceptance golden: artifact type enum now [whl jar tgz]. All bundle/... unit tests, go vet, and the artifacts+validate acceptance subsets pass. Co-authored-by: Isaac
- tarball.go: use errors.New for the no-args git error (perfsprint lint). - jsonschema.json: regenerated post-merge; picks up the variable-ref regex the newer generator emits (validate-generated). Co-authored-by: Isaac
Integration test reportCommit: f2a8fd9
Top 3 slowest tests (at least 2 minutes):
|
ben-hansen-db
left a comment
There was a problem hiding this comment.
Looks good, let's follow the file generation flow for the autogen files
|
|
||
| // tarballFromGit snapshots a git ref via `git archive`, so the archive reflects the | ||
| // committed tree at that ref rather than the working tree. Commit wins over Branch. | ||
| func tarballFromGit(ctx context.Context, b *bundle.Bundle, a *config.Artifact, w io.Writer) error { |
There was a problem hiding this comment.
have we tested equivalence of tarballs from here vs CLI? Note also the tarball changes that landed in CLI recently to respect gitignore
There was a problem hiding this comment.
Made them share code instead of testing equivalence
| b.Metrics.AddBoolValue(metrics.ArtifactFilesIsSet, len(artifact.Files) != 0) | ||
|
|
||
| // A `tgz` artifact with `include`/`git` is built by DABs itself in the build | ||
| // phase (see artifacts.Build). `build` and `git`/`include` are mutually |
There was a problem hiding this comment.
is semantics for include the same as in air cli? There it is relative to code source root, is include relative to bundle root in DABs? Can we make sure that is documented well somewhere?
There was a problem hiding this comment.
include is now relative to the code-source root, same as the air CLI. The reason I decided this is so that convert-to-dabs can map air CLI's include_paths straight across later.
| var EnumFields = map[string][]string{ | ||
| "artifacts.*.executable": {"bash", "sh", "cmd"}, | ||
| "artifacts.*.type": {"whl", "jar"}, | ||
| "artifacts.*.type": {"whl", "jar", "tgz"}, |
There was a problem hiding this comment.
above it says this is autogenerated. Did claude update this file or was it infact autogenerated?
There was a problem hiding this comment.
there's probably a flow for autogenerating this file to follow
There was a problem hiding this comment.
^ claude ran the autogeneration script
- buildTarballArtifact writes to a temp file and renames on success, so a failed git archive / pack no longer leaves a partial tarball at the output path. - Drop the unreachable `.` fallback in tarballFromInclude; include mode is only entered with a non-empty a.Include. Co-authored-by: Isaac <no-reply@databricks.com>
Clarify that DABs `include` is bundle-root-relative and composes files from anywhere in the bundle (e.g. a code dir plus a sibling env file), intentionally broader than the air CLI's code-source-root-relative include. Update the field doc and schema annotation, and add a packing-layer test showing a tarball composed across two directories keeps both entries at bundle-root-relative paths. Co-authored-by: Isaac <no-reply@databricks.com>
The AI Runtime extracts a code_source tarball to /databricks/code_source/<dir>, so the archive must have a single load-bearing top-level directory. The previous include implementation packed bundle-root-relative entries with no such prefix, diverging from both the air CLI and DABs' own aicode directory packer. - Export aicode.BuildCodeSnapshot and reuse it for include mode, so entries nest under the code-source root's directory name (relBase + prefix), gitignore-aware and reproducible — identical layout to a directory code_source_path. - include now selects subpaths of the code-source root (`path`), relative to it, matching the air CLI's include_paths (so convert-to-dabs can translate 1:1). - git mode adds --prefix=<dir>/ so git archive produces the same top-level layout. - Replace the bundle-root-relative field docs/test from the prior commit with the code-source-root semantics and a git-mode prefix test. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Disable core.autocrlf in the temp repo and compare trimmed content, so the content assertion doesn't depend on the Windows runner's autocrlf default. Co-authored-by: Isaac <no-reply@databricks.com>
Proposal for AIR-on-DABs code_source parity (see DABs x AIR CLI Alignment). Extends the existing
artifactsblock so DABs can build the code tarball itself instead of only uploading a user build command's output:buildandgit/includeare mutually exclusive: either the user's command produces the tarball (today's behavior) or DABs does. The produced file flows through the existing artifact upload path, so an ai_runtime_task's code_source_path pointing at it is uploaded and rewritten to the remote path with no new reference syntax.git archiveVerified end-to-end on staging (both modes deploy; code_source_path rewritten).Open for review: this is a proposal to react to, not a finished feature. jsonschema annotations for the new fields are a follow-up.
Co-authored-by: Isaac
Changes
Why
Tests
Show that the include field is respected, we notice the
./dist/code.tgzis properly uploaded.Show that git refs are respected: