From 6ca57a7e68675a3be27cc3832a5a96e1a6e57073 Mon Sep 17 00:00:00 2001 From: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com> Date: Fri, 19 Apr 2024 19:39:33 +0530 Subject: [PATCH] Add docs URL for `run_as` in error message (#1381) --- bundle/config/mutator/run_as.go | 4 +--- bundle/tests/run_as_test.go | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bundle/config/mutator/run_as.go b/bundle/config/mutator/run_as.go index 578591eb..8da233c2 100644 --- a/bundle/config/mutator/run_as.go +++ b/bundle/config/mutator/run_as.go @@ -35,10 +35,8 @@ 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 { diff --git a/bundle/tests/run_as_test.go b/bundle/tests/run_as_test.go index 3b9deafe..40359c17 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) {