Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions acceptance/bundle/invariant/no_drift/script
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

invariant_setup

if [[ "$INPUT_CONFIG" == "model_service.yml.tmpl" ]]; then
assert_dms_unsupported model_services
fi

# Only compute a plan up front when the READPLAN variant actually consumes it via --plan.
# Without READPLAN, deploy computes its own plan internally, so a separate `bundle plan`
# invocation is pure waste.
Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/resources/grants/mcp_services/script
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported mcp_services

trace $CLI bundle plan -o json | jq 'del(.features)' > out.plan1.json
trace print_requests.py --get //permissions
trace $CLI bundle deploy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported model_provider_services

trace $CLI bundle plan -o json | jq 'del(.features)' > out.plan1.json
trace print_requests.py --get //permissions
trace $CLI bundle deploy
Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/resources/grants/model_services/script
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported model_services

trace $CLI bundle plan -o json | jq 'del(.features)' > out.plan1.json
trace print_requests.py --get //permissions
trace $CLI bundle deploy
Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/resources/mcp_services/basic/script
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
assert_dms_unsupported mcp_services

title "Initial summary before deploy"
trace $CLI bundle summary -o json | jq .resources.mcp_services.mcp1

Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/resources/mcp_services/lifecycle/script
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported mcp_services

CONN="mcp_conn_$UNIQUE_NAME"

cleanup() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
assert_dms_unsupported mcp_services

trace $CLI bundle deploy

title "Delete the resource out of band"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
assert_dms_unsupported model_provider_services

title "Initial summary before deploy"
trace $CLI bundle summary -o json | jq .resources.model_provider_services.mps1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported model_provider_services

cleanup() {
trace $CLI bundle destroy --auto-approve
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
assert_dms_unsupported model_provider_services

trace $CLI bundle deploy

title "Delete the resource out of band"
Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/resources/model_services/basic/script
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
assert_dms_unsupported model_services

title "Initial summary before deploy"
trace $CLI bundle summary -o json | jq .resources.model_services.ms1

Expand Down
2 changes: 2 additions & 0 deletions acceptance/bundle/resources/model_services/lifecycle/script
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported model_services

cleanup() {
trace $CLI bundle destroy --auto-approve
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
assert_dms_unsupported model_services

trace $CLI bundle deploy

title "Delete the resource out of band"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ schedule_name="projects/test-pg-proj-${UNIQUE_NAME}/branches/production/snapshot

title "Create with a snapshot schedule"
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported postgres_snapshot_schedules
rm -f "$OUT_REQUESTS"
trace $CLI bundle deploy
trace $CLI postgres get-snapshot-schedule "${schedule_name}" | snapshot_schedule_fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ schedule_name="projects/test-pg-proj-${UNIQUE_NAME}/branches/production/snapshot

title "Deploy with a snapshot schedule"
envsubst < databricks.yml.tmpl > databricks.yml

assert_dms_unsupported postgres_snapshot_schedules
trace $CLI bundle deploy
trace $CLI postgres get-snapshot-schedule "${schedule_name}" | snapshot_schedule_fields

Expand Down
21 changes: 21 additions & 0 deletions acceptance/script.prepare
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,27 @@ add_repl() {
env -u MSYS_NO_PATHCONV add_repl.py "$@"
}

# Assert the test server's unsupported-type rejection locally. Cloud runs
# exercise these resource lifecycles with file-backed state.
assert_dms_unsupported() {
local resource_type="$1"
shift
if [[ "$DMS" != "true" ]]; then
return
fi

if [[ -z "$CLOUD_ENV" ]]; then
# Keep these logs outside the bundle so they do not enter sync or snapshots.
local log_dir="$(dirname "$OUT_REQUESTS")"
musterr $CLI bundle deploy "$@" &> "$log_dir/LOG.dms_unsupported"
contains.py "operations.resource_key must have a known resource type prefix" "$resource_type." '!panic:' '!internal error' < "$log_dir/LOG.dms_unsupported" > /dev/null
$CLI bundle destroy "$@" --auto-approve &> "$log_dir/LOG.dms_unsupported_cleanup"
rm -rf .databricks
rm -f "$OUT_REQUESTS"
fi
export DATABRICKS_BUNDLE_DEPLOYMENT_HISTORY=false
}

nostamp() {
# Same MSYS_NO_PATHCONV workaround as envsubst above: otherwise Python cannot
# find nostamp.py on Windows.
Expand Down
44 changes: 43 additions & 1 deletion libs/testserver/bundledeployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,47 @@ const dmsDeploymentNodeName = "resources.deployment.json"
// created.
var dmsUpdatableOperationFields = []string{"state", "error_message", "resource_id", "status"}

// dmsResourceTypes mirrors the resource_key prefixes in Universe's bundle/metadata-service.
// NOTE: When adding a type here, also add the corresponding enum in bundle/metadata-service/service.proto
// and prefix mapping in parser/ResourceTypes.java in Universe.
var dmsResourceTypes = []string{
"alerts",
"apps",
"catalogs",
"cluster_policies",
"clusters",
"dashboards",
"database_catalogs",
"database_instances",
"experiments",
"external_locations",
"genie_spaces",
"instance_pools",
"internal_immutable_snapshots",
"job_runs",
"jobs",
"model_serving_endpoints",
"models",
"pipelines",
"postgres_branches",
"postgres_catalogs",
"postgres_databases",
"postgres_endpoints",
"postgres_projects",
"postgres_roles",
"postgres_synced_tables",
"quality_monitors",
"registered_models",
"schemas",
"secret_scopes",
"secrets",
"sql_warehouses",
"synced_database_tables",
"vector_search_endpoints",
"vector_search_indexes",
"volumes",
}

// DmsDeployment holds a deployment record together with the versions and
// resources recorded under it, so the read APIs (ListVersions/ListResources)
// can serve back what deploys wrote.
Expand Down Expand Up @@ -327,10 +368,11 @@ func (s *FakeWorkspace) CreateVersion(req Request, deploymentID string) Response
}
seen := make(map[string]bool, len(staged.Operations))
for _, staged := range staged.Operations {
resourceType, _, hasPrefix := strings.Cut(staged.ResourceKey, ".")
switch {
case staged.ResourceKey == "":
return dmsInvalidArgument("operations.resource_key is required")
case !strings.Contains(staged.ResourceKey, "."):
case !hasPrefix || !slices.Contains(dmsResourceTypes, resourceType):
return dmsInvalidArgument("operations.resource_key must have a known resource type prefix (e.g. 'jobs.', 'pipelines.'): " + staged.ResourceKey)
case staged.ActionType == "":
return dmsInvalidArgument("operations.action_type is required and must not be UNSPECIFIED for resource " + staged.ResourceKey)
Expand Down
Loading