Skip to content
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

Add DATABRICKS_BUNDLE_TMP env variable #462

Merged
merged 7 commits into from
Jun 21, 2023
Merged

Add DATABRICKS_BUNDLE_TMP env variable #462

merged 7 commits into from
Jun 21, 2023

Conversation

kanterov
Copy link
Contributor

@kanterov kanterov commented Jun 12, 2023

Changes

Add DATABRICKS_BUNDLE_TMP env variable. It allows using a temporary directory instead of writing to $CWD/.databricks/bundle

Tests

I added unit tests

// CacheDir returns directory to use for temporary files for this bundle.
// Scoped to the bundle's environment.
func (b *Bundle) CacheDir(paths ...string) (string, error) {
if b.Config.Bundle.Environment == "" {
panic("environment not set")
}

cacheDirName, exists := os.LookupEnv("DATABRICKS_BUNDLE_TMP")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use the root dir instead? e.g. there's already the env variable for root

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was @pietern suggestion. I think the rationale is that we do want to keep some files in ".databricks"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BUNDLE_ROOT env var is to specify the root of the bundle sources if it cannot be derived from $PWD.

(we should rename that to DATABRICKS_BUNDLE_ROOT btw...).

@pietern
Copy link
Contributor

pietern commented Jun 13, 2023

@kanterov Thanks for the PR. Could you add a unit test for this as well? Without one this could regress in the future.

@kanterov kanterov requested a review from pietern June 13, 2023 12:17
@kanterov
Copy link
Contributor Author

@pietern I've added tests, please take a look again

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the change LGTM. One remaining question.

bundle/bundle_test.go Outdated Show resolved Hide resolved
@kanterov kanterov requested a review from pietern June 14, 2023 15:18
@pietern pietern enabled auto-merge (squash) June 15, 2023 07:29
@pietern pietern disabled auto-merge June 21, 2023 07:53
@pietern pietern merged commit ccbcccd into databricks:main Jun 21, 2023
4 checks passed
@pietern pietern mentioned this pull request Jun 28, 2023
pietern added a commit that referenced this pull request Jun 28, 2023
## Changes

CLI:
* Add --absolute flag for ls command
([#508](#508)).
* Add dbfs scheme prefix to paths in cp command output
([#516](#516)).
* Add provider detection to the repos create command
([#528](#528)).
* Added configure-cluster flag for auth login
([#500](#500)).
* Added prompts for Databricks profile for auth login command
([#502](#502)).
* Allow specifying repo by path for repos commands
([#526](#526)).
* Decode contents by default in workspace export command
([#531](#531)).
* Fixed jobs create command to only accept JSON payload
([#498](#498)).
* Make local files default for fs commands
([#506](#506)).
* Remove \r from new line print statments
([#509](#509)).
* Remove extra call to filer.Stat in dbfs filer.Read
([#515](#515)).
* Update alerts command integration test
([#512](#512)).
* Update variable regex to support hyphens
([#503](#503)).

Bundles:
* Add DATABRICKS_BUNDLE_TMP env variable
([#462](#462)).
* Update Terraform provider schema structs
([#504](#504)).

Dependencies:
* Bump github.com/databricks/databricks-sdk-go from
0.9.1-0.20230614092458-b5bbc1c8dabb to 0.10.0
([#497](#497)).

Internal:
* Use direct download for workspace filer read
([#514](#514)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants