-
Notifications
You must be signed in to change notification settings - Fork 87
Set CWD to bundle root in bundle commands #2686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
699ea7c
to
b1544fc
Compare
7fe92d5
to
b8e330a
Compare
de2d5df
to
3180815
Compare
} | ||
|
||
abs := filepath.Join(cwd, *pathPtr) | ||
rel, err := filepath.Rel(root, abs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail if we provide DATABRICKS_BUNDLE_ROOT
which is outside of CWD. Can we have a test for this to confirm setting DATABRICKS_BUNDLE_ROOT works as expected?
JFYI See https://github.com/databricks/cli/pull/2555/files#diff-a20d49a34bb0f2a3c96a0fa01f1b990f6d15870a751ecf9eb3b95e47fb37a10bR34 as well, this has to continue to work for apps inside the bundles |
This is on hold, to get the following changes in first:
|
Changes
In bundle commands, set CWD early to bundle root.
Why
This aligns with internal representation where all files are relative to bundle root and most subprocesses should be run within bundle root directory.
Some parts of code could be simplified (e.g. path.Glob or opening files) - previously we always had to convert to abs path first, now we can process the paths directly. (I did not do all possible simplifications, just a few obvious ones that did not break any tests).
Less testing required - we don't need to test as much anymore that all features work when running bundle commands in directory different from bundle root. We only need to test boundary conditions w.r.t parameters passed.
Tests
Existing tests.