From f4e0817ff5b26bc84aa5db72cc2abe74e0047520 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 19 Apr 2024 15:20:47 +0200 Subject: [PATCH 1/3] -0 --- bundle/config/mutator/run_as.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundle/config/mutator/run_as.go b/bundle/config/mutator/run_as.go index 578591eb14..a08994dfb3 100644 --- a/bundle/config/mutator/run_as.go +++ b/bundle/config/mutator/run_as.go @@ -35,10 +35,10 @@ type errUnsupportedResourceTypeForRunAs struct { runAsUser string } -// TODO(6 March 2024): Link the docs page describing run_as semantics in the error below -// once the page is ready. + + func (e errUnsupportedResourceTypeForRunAs) Error() string { - return fmt.Sprintf("%s are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Location of the unsupported resource: %s. Current identity: %s. Run as identity: %s", e.resourceType, e.resourceLocation, e.currentUser, e.runAsUser) + return fmt.Sprintf("%s are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Please refer to the documentation at https://docs.databricks.com/dev-tools/bundles/run-as.html for more details. Location of the unsupported resource: %s. Current identity: %s. Run as identity: %s", e.resourceType, e.resourceLocation, e.currentUser, e.runAsUser) } type errBothSpAndUserSpecified struct { From f69d32ec56ed3e28ac943fe831a6ba592a8023e8 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 19 Apr 2024 15:32:28 +0200 Subject: [PATCH 2/3] update tests --- bundle/tests/run_as_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundle/tests/run_as_test.go b/bundle/tests/run_as_test.go index 3b9deafe0d..40359c17d8 100644 --- a/bundle/tests/run_as_test.go +++ b/bundle/tests/run_as_test.go @@ -113,7 +113,7 @@ func TestRunAsErrorForPipelines(t *testing.T) { err := diags.Error() configPath := filepath.FromSlash("run_as/not_allowed/pipelines/databricks.yml") - assert.EqualError(t, err, fmt.Sprintf("pipelines are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Location of the unsupported resource: %s:14:5. Current identity: jane@doe.com. Run as identity: my_service_principal", configPath)) + assert.EqualError(t, err, fmt.Sprintf("pipelines are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Please refer to the documentation at https://docs.databricks.com/dev-tools/bundles/run-as.html for more details. Location of the unsupported resource: %s:14:5. Current identity: jane@doe.com. Run as identity: my_service_principal", configPath)) } func TestRunAsNoErrorForPipelines(t *testing.T) { @@ -152,7 +152,7 @@ func TestRunAsErrorForModelServing(t *testing.T) { err := diags.Error() configPath := filepath.FromSlash("run_as/not_allowed/model_serving/databricks.yml") - assert.EqualError(t, err, fmt.Sprintf("model_serving_endpoints are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Location of the unsupported resource: %s:14:5. Current identity: jane@doe.com. Run as identity: my_service_principal", configPath)) + assert.EqualError(t, err, fmt.Sprintf("model_serving_endpoints are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Please refer to the documentation at https://docs.databricks.com/dev-tools/bundles/run-as.html for more details. Location of the unsupported resource: %s:14:5. Current identity: jane@doe.com. Run as identity: my_service_principal", configPath)) } func TestRunAsNoErrorForModelServingEndpoints(t *testing.T) { From 15c8308cd35ae123fe5aba0e893fafa4e3bf24f2 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 19 Apr 2024 15:33:48 +0200 Subject: [PATCH 3/3] fmt --- bundle/config/mutator/run_as.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/bundle/config/mutator/run_as.go b/bundle/config/mutator/run_as.go index a08994dfb3..8da233c270 100644 --- a/bundle/config/mutator/run_as.go +++ b/bundle/config/mutator/run_as.go @@ -35,8 +35,6 @@ type errUnsupportedResourceTypeForRunAs struct { runAsUser string } - - func (e errUnsupportedResourceTypeForRunAs) Error() string { return fmt.Sprintf("%s are not supported when the current deployment user is different from the bundle's run_as identity. Please deploy as the run_as identity. Please refer to the documentation at https://docs.databricks.com/dev-tools/bundles/run-as.html for more details. Location of the unsupported resource: %s. Current identity: %s. Run as identity: %s", e.resourceType, e.resourceLocation, e.currentUser, e.runAsUser) }