Repository navigation
[AIR] CNXT-2686: warn when a pushed image sets WORKDIR - #7867
Conversation
AI Runtime does not honor the Docker WORKDIR directive, so commands that rely on relative paths fail at runtime with file-not-found errors, and nothing warned at push time. `air images push` now inspects the source image's Config.WorkingDir and prints a warning telling the user to use absolute paths. The push itself is unchanged. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at 3031cd9. Each finding was verified against the code.
Not ready yet: 1 blocking issue(s), tagged [blocking].
This PR adds a WORKDIR warning to databricks air images push by inspecting the image config after the platform check. Two issues stand out: the "warning" can actually abort the push when the inspect subprocess fails, contradicting the stated non-blocking intent; and images that set WORKDIR / (effectively the default) trigger a misleading warning about relative paths.
An inspect failure now logs a warning instead of aborting, and WORKDIR / (the Docker default) no longer triggers the warning. Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at 42e16c3. Each finding was verified against the code.
No blocking issues found. 1 non-blocking comment(s) below.
This PR adds an informational WORKDIR warning to databricks air images push by inspecting the image config after the platform check. The implementation is correct and well-tested, but the new check spawns a second docker image inspect subprocess on the same image that was just inspected, when a single call with a combined format string would suffice.
Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at d48fc7f. Each finding was verified against the code.
No blocking issues found.
This PR adds a WORKDIR warning to databricks air images push by extending the existing docker image inspect format string to also retrieve Config.WorkingDir, then printing an informational warning when a non-trivial WORKDIR is set. The change is small, well-scoped, and covered by new and updated unit tests. No correctness issues survive verification.
Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
|
Commit: Regression test reportSelected 1 changed tests (limit=20, 0 not selected) 1 tests: regression=1 unreleased=0 coverage=0 failing=0
TestAccept/air/image-push: branch ✅ | main (b0fd4e6) ❌ | latest (v1.28.0) ❌main (b0fd4e6): latest (v1.28.0): same output as main (b0fd4e6) |
There was a problem hiding this comment.
Automated review at 0f620d5. Each finding was verified against the code.
No blocking issues found.
This PR adds an informational warning to databricks air images push when the source image sets a non-default WORKDIR, since AI Runtime ignores it at runtime. The implementation correctly extends the existing docker image inspect format string with a pipe-delimited field and parses it with strings.Cut on the first |. The warning condition (workingDir != "" && workingDir != "/") is sound, the comment on line 209 explains the rationale, and the unit and acceptance tests cover the key cases (unset, /, /app). No correctness issues found.
✅ Integration test reportCommit: 3ff28d1
Top 6 slowest tests (at least 2 minutes):
|
The CLI shouldn't state how AI Runtime behaves, since the backend can change that. Say the image sets WORKDIR and that commands should use absolute paths. Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at ec6a35c. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) below.
This PR makes databricks air images push read Config.WorkingDir from the existing docker image inspect call and print an informational warning when the source image sets a WORKDIR other than /. The push still goes through. The parsing and platform check look correct: the format string always includes |, so strings.Cut splits reliably, and the platform error behaves as before. I have two small points: the new unit test mostly repeats the acceptance coverage, and the comment above the skip condition says more than the code knows.
The acceptance test now runs the unset, / and /app cases, so the unit test only repeated it. Reword the skip comment to say what is decided without describing AI Runtime. Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at 679fc58. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) and 1 question(s) below.
This PR has air images push read Config.WorkingDir from the same docker image inspect call it already makes for the platform check, and print a warning when it is set to anything other than /. The push itself is otherwise unchanged. I found one real issue: the new template field can make the inspect call fail for images with no config, which turns an advisory warning into a failed push. There is also a small mismatch in the changelog wording.
Questions
- The warning skips images with no
WORKDIRorWORKDIR /. The comment atcmd/air/image.go:209justifies that by howdocker runbehaves, yet the description says the CLI doesn't know which directory AI Runtime starts in. It also fires for images whose commands use only absolute paths. Should the skip state its assumption about AI Runtime explicitly, or warn in every case? Or would the check fit better inair run, next tomissingTorchWarning, where the configured command and launch paths are known and the warning could fire only for relative paths? (non-blocking)
Read WORKDIR through {{with .Config}} so an image without a config
inspects cleanly instead of failing the push, and say in the changelog
that WORKDIR / doesn't warn.
Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at cd68335. Each finding was verified against the code.
No blocking issues found. 3 non-blocking comment(s) below.
This PR changes databricks air images push to read Config.WorkingDir in the same docker image inspect call as the platform check, and to print an advisory when the image sets a WORKDIR other than /. I traced the strings.Cut split for an unset WORKDIR, for /, for /app and for a nil Config. The platform check still rejects the same inputs it did before, and the acceptance test covers all three WORKDIR cases. What's left is wording: the warning, the comment above it and the changelog entry.
Say that relative paths depend on the working directory, without describing where AI Runtime starts commands, and tighten the comment and changelog wording. Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at c2b858c. Each finding was verified against the code.
No blocking issues found. 1 non-blocking comment(s) below.
This PR changes air images push to read Config.WorkingDir from the existing docker image inspect call and print an advisory when the image sets a WORKDIR other than /. The push itself is unchanged. The combined-format parsing is correct: the platform check is preserved, and the WORKDIR / and unset cases are covered by acceptance tests. One wording issue remains: the warning doesn't tell users why their paths might break.
Explain that relative paths only resolve against WORKDIR when the command runs from it, without saying where AI Runtime runs commands. Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at ce2b896. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) below.
This PR makes air images push read Config.WorkingDir from the existing docker image inspect call and print an advisory warning when the image sets a WORKDIR other than /. The parsing and platform gate are fine: the format always emits the |, and the platform comparison works the same as before. Two small things remain: the warning text doesn't tell users why they should switch to absolute paths, and the {{with .Config}} guard has no comment explaining why it's there.
Give the reason through the public docs instead of describing the runtime, and comment why the inspect format guards .Config. Co-authored-by: Isaac <no-reply@databricks.com>
|
/review |
There was a problem hiding this comment.
Automated review at 3ff28d1. Each finding was verified against the code.
No blocking issues found.
This PR makes databricks air images push read Config.WorkingDir from the docker image inspect call it already runs. When the source image sets a WORKDIR other than /, it prints a warning with links to the AI Runtime command docs, and the push still goes ahead. The combined format string is parsed correctly for real Docker output. The platform check and its error are unchanged, and the acceptance test covers no WORKDIR, WORKDIR / and WORKDIR /app. I found no defect that should block the merge.
Resolve conflicts with the WORKDIR warning from #7867: one docker image inspect call now returns the platform, the size and the working directory, so the size line and the WORKDIR warning both print. The image-push acceptance output is regenerated. Co-authored-by: Isaac <no-reply@databricks.com>
Changes
databricks air images pushnow readsConfig.WorkingDirfrom the existingdocker image inspectcall (combined format string). When it is set to anything other than/, it prints a warning that the source image setsWORKDIR, that commands and scripts should use absolute paths, and links the public AI Runtimecommanddocs (AWS and Azure) for how command paths work. The warning makes no claim about how AI Runtime treatsWORKDIR, because the backend owns that behavior and can change it without a CLI release; the docs carry the reason. The push itself is unchanged: the warning is informational and never blocks.Why
In the CUJ PE64 runthrough (Jira CNXT-2686), an image whose scripts relied on relative paths from its
WORKDIRworked underdocker runbut failed on AI Runtime with file-not-found errors. Neitherair images pushnorair runmentioned this, so users only found out from a failed run.Push time is the earliest point where the CLI sees the image config, and the check reuses the inspect call the platform check already makes, so there is no extra Docker invocation. No public docs page covers the runtime working directory specifically, so the warning links the
commandsection of the AI Runtime YAML config reference instead.The warning is advisory, so it skips images with no
WORKDIRorWORKDIR /(Docker's default), where relative paths don't depend on a directory the image chose. It lives inimages pushbecause that is where the CLI already inspects the image config.air runonly gets the image name, so checking there would add a registry lookup. The inspect format readsWORKDIRthrough{{with .Config}}, so an image with no config still pushes.Hard-coded values
~/loop/bin/cli-checkflags one line: the existingAIR requires linux/amd64platform error incmd/air/image.go. It is already onmain; this PR only moves it, because the inspect call now returns the platform andWORKDIRtogether.The warning also hard-codes two docs URLs, the AWS and Azure
yaml-config#commandpages (the same links cli#7865 adds, repeated here because #7865 isn't merged). They are CLI-owned docs pointers, like the docker-images links in this command's help text, not backend rules. No backend rule is hard-coded.Tests
acceptance/air/image-pushcovers all three cases through its fakedocker: noWORKDIR(default mode, no warning),WORKDIR /(workdir-rootmode, no warning) andWORKDIR /app(workdirmode, warning while the push proceeds). Golden output regenerated.TestRunImagePushTagsAndPushesLocalImageasserts the combined inspect format.go test ./acceptance -run TestAccept/air/image-push,task lint-qandtask check-changelogpass locally.This pull request and its description were written by Isaac.