From 55a9368ef2ee1e67cac3546d6e7ee8b6e77f59e9 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 28 Feb 2025 11:26:17 +0100 Subject: [PATCH] a bunch of wip code --- acceptance/acceptance_test.go | 1 + .../artifacts/same_name_libraries/output.txt | 11 ++++------- .../unique_name_libraries/output.txt | 15 ++++++++------- acceptance/bundle/debug/out.stderr.txt | 2 +- .../auth/describe/profile_flag/.databrickscfg | 3 +++ .../cmd/auth/describe/profile_flag/output.txt | 11 +++++++++++ .../cmd/auth/describe/profile_flag/script | 5 +++++ .../.databrickscfg | 3 +++ .../databricks.yml | 5 +++++ .../output.txt | 6 ++++++ .../script | 19 +++++++++++++++++++ .../test.toml | 1 + .../describe/profile_with_bundle/test.toml | 4 +--- .../cmd/auth/describe/{profile => }/test.toml | 0 14 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 acceptance/cmd/auth/describe/profile_flag/.databrickscfg create mode 100644 acceptance/cmd/auth/describe/profile_flag/output.txt create mode 100644 acceptance/cmd/auth/describe/profile_flag/script create mode 100644 acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/.databrickscfg create mode 100644 acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/databricks.yml create mode 100644 acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/output.txt create mode 100644 acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/script create mode 100644 acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/test.toml rename acceptance/cmd/auth/describe/{profile => }/test.toml (100%) diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index 066a84299..ddc02eee6 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -32,6 +32,7 @@ import ( "github.com/stretchr/testify/require" ) +// TODO: Unset auth type as well. var ( KeepTmp bool NoRepl bool diff --git a/acceptance/bundle/artifacts/same_name_libraries/output.txt b/acceptance/bundle/artifacts/same_name_libraries/output.txt index ee6c9d566..d6c084608 100644 --- a/acceptance/bundle/artifacts/same_name_libraries/output.txt +++ b/acceptance/bundle/artifacts/same_name_libraries/output.txt @@ -1,14 +1,11 @@ >>> errcode [CLI] bundle deploy Building whl1... -Building whl2... -Error: Duplicate local library names: my_default_python-0.0.1-py3-none-any.whl - at resources.jobs.test.tasks[0].libraries[0].whl - resources.jobs.test.tasks[1].libraries[0].whl - in databricks.yml:36:15 - databricks.yml:45:15 +Error: build failed whl1, error: exit status 1, output: Traceback (most recent call last): + File "[TMPDIR]/whl1/setup.py", line 1, in + from setuptools import setup, find_packages +ModuleNotFoundError: No module named 'setuptools' -Local library names must be unique but found libraries with the same name: whl1/dist/my_default_python-0.0.1-py3-none-any.whl, whl2/dist/my_default_python-0.0.1-py3-none-any.whl Exit code: 1 diff --git a/acceptance/bundle/artifacts/unique_name_libraries/output.txt b/acceptance/bundle/artifacts/unique_name_libraries/output.txt index ecc7bf57b..d6c084608 100644 --- a/acceptance/bundle/artifacts/unique_name_libraries/output.txt +++ b/acceptance/bundle/artifacts/unique_name_libraries/output.txt @@ -1,10 +1,11 @@ >>> errcode [CLI] bundle deploy Building whl1... -Building whl2... -Uploading [package name] -Uploading [package name] -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/unique_name_libraries/default/files... -Deploying resources... -Updating deployment state... -Deployment complete! +Error: build failed whl1, error: exit status 1, output: Traceback (most recent call last): + File "[TMPDIR]/whl1/setup.py", line 1, in + from setuptools import setup, find_packages +ModuleNotFoundError: No module named 'setuptools' + + + +Exit code: 1 diff --git a/acceptance/bundle/debug/out.stderr.txt b/acceptance/bundle/debug/out.stderr.txt index 147b33a45..36a5f17c1 100644 --- a/acceptance/bundle/debug/out.stderr.txt +++ b/acceptance/bundle/debug/out.stderr.txt @@ -68,7 +68,7 @@ 10:07:59 Debug: Apply pid=12345 mutator=metadata.AnnotatePipelines 10:07:59 Debug: Apply pid=12345 mutator=terraform.Initialize 10:07:59 Debug: Using Terraform from DATABRICKS_TF_EXEC_PATH at [TERRAFORM] pid=12345 mutator=terraform.Initialize -10:07:59 Debug: Using Terraform CLI config from DATABRICKS_TF_CLI_CONFIG_FILE at [DATABRICKS_TF_CLI_CONFIG_FILE] pid=12345 mutator=terraform.Initialize +10:07:59 Debug: DATABRICKS_TF_PROVIDER_VERSION as 1.62.0 does not match the current version 1.65.1, ignoring DATABRICKS_TF_CLI_CONFIG_FILE pid=12345 mutator=terraform.Initialize 10:07:59 Debug: Environment variables for Terraform: ...redacted... pid=12345 mutator=terraform.Initialize 10:07:59 Debug: Apply pid=12345 mutator=scripts.postinit 10:07:59 Debug: No script defined for postinit, skipping pid=12345 mutator=scripts.postinit diff --git a/acceptance/cmd/auth/describe/profile_flag/.databrickscfg b/acceptance/cmd/auth/describe/profile_flag/.databrickscfg new file mode 100644 index 000000000..e4e065ea5 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag/.databrickscfg @@ -0,0 +1,3 @@ +[myprofile] +host = https://test@non-existing-subdomain.databricks.com +token = dapi1234 diff --git a/acceptance/cmd/auth/describe/profile_flag/output.txt b/acceptance/cmd/auth/describe/profile_flag/output.txt new file mode 100644 index 000000000..c44cfd4b2 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag/output.txt @@ -0,0 +1,11 @@ + +>>> [CLI] auth describe -p myprofile +Unable to authenticate: Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted) +----- +Current configuration: + ✓ host: https://non-existing-subdomain.databricks.com (from .databrickscfg config file) + ✓ token: ******** (from .databrickscfg config file) + ✓ profile: myprofile (from --profile flag) + ✓ config_file: .databrickscfg (from DATABRICKS_CONFIG_FILE environment variable) + ✓ databricks_cli_path: [CLI] + ✓ auth_type: pat diff --git a/acceptance/cmd/auth/describe/profile_flag/script b/acceptance/cmd/auth/describe/profile_flag/script new file mode 100644 index 000000000..d271dd26a --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag/script @@ -0,0 +1,5 @@ +export DATABRICKS_HOST="" +export DATABRICKS_TOKEN="" +export DATABRICKS_CONFIG_FILE=".databrickscfg" + +trace $CLI auth describe -p myprofile diff --git a/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/.databrickscfg b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/.databrickscfg new file mode 100644 index 000000000..e4e065ea5 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/.databrickscfg @@ -0,0 +1,3 @@ +[myprofile] +host = https://test@non-existing-subdomain.databricks.com +token = dapi1234 diff --git a/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/databricks.yml b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/databricks.yml new file mode 100644 index 000000000..7c20c2e60 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/databricks.yml @@ -0,0 +1,5 @@ +bundle: + name: foobar + +targets: + foo: diff --git a/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/output.txt b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/output.txt new file mode 100644 index 000000000..8e91529de --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/output.txt @@ -0,0 +1,6 @@ + +>>> [CLI] auth describe -p myprofile -t foo +Unable to authenticate: Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted) +----- +Current configuration: + ✓ profile: myprofile (from --profile flag) diff --git a/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/script b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/script new file mode 100644 index 000000000..569fb4891 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/script @@ -0,0 +1,19 @@ +export DATABRICKS_HOST="" +export DATABRICKS_TOKEN="" +export DATABRICKS_CONFIG_FILE=".databrickscfg" + +trace $CLI auth describe -p myprofile -t foo + +# TODO CONTINUE: +# Is this diff bad? Why not describe where the host is being from any longer? +# ->>> [CLI] auth describe -p myprofile +# +>>> [CLI] auth describe -p myprofile -t foo +# Unable to authenticate: Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted) +# @@ -5,8 +5,3 @@ +# Current configuration: +# - ✓ host: https://non-existing-subdomain.databricks.com (from .databrickscfg config file) +# - ✓ token: ******** (from .databrickscfg config file) +# ✓ profile: myprofile (from --profile flag) +# - ✓ config_file: .databrickscfg (from DATABRICKS_CONFIG_FILE environment variable) +# - ✓ databricks_cli_path: [CLI] +# - ✓ auth_type: pat diff --git a/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/test.toml b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/test.toml new file mode 100644 index 000000000..50a542fc2 --- /dev/null +++ b/acceptance/cmd/auth/describe/profile_flag_with_bundle_and_target/test.toml @@ -0,0 +1 @@ +Badness = "The profile is coming from the --flag, not the bundle. This is a bug because auth describe attributes it to the bundle." diff --git a/acceptance/cmd/auth/describe/profile_with_bundle/test.toml b/acceptance/cmd/auth/describe/profile_with_bundle/test.toml index 4f011b070..498bcf8c8 100644 --- a/acceptance/cmd/auth/describe/profile_with_bundle/test.toml +++ b/acceptance/cmd/auth/describe/profile_with_bundle/test.toml @@ -1,5 +1,3 @@ Badness = "The profile is coming from the environment variable, not the bundle. This is a bug because auth describe attributes it to the bundle." -[[Repls]] -Old='Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": .*' -New='Get "https://non-existing-subdomain.databricks.com/api/2.0/preview/scim/v2/Me": (redacted)' + diff --git a/acceptance/cmd/auth/describe/profile/test.toml b/acceptance/cmd/auth/describe/test.toml similarity index 100% rename from acceptance/cmd/auth/describe/profile/test.toml rename to acceptance/cmd/auth/describe/test.toml