Skip to content

Commit 2065651

Browse files
authored
Fix Serving Endpoint resource field mapping for apps init flow (#4878)
## Summary - Use Serving Endpoint name instead of id, as name is required for DABs Proof: https://docs.databricks.com/gcp/en/dev-tools/bundles/resources#app-resources-serving_endpoint ## Demo (Tested against databricks/appkit@main...pkosiec/model-serving-impl) https://github.com/user-attachments/assets/d24d5dbf-d4fa-442e-8c40-b9468a259612 ## Test plan - [x] `go test ./libs/apps/generator/...` passes - [x] Manual: `databricks apps init` with serving plugin produces correct single-variable `databricks.yml` Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
1 parent bb8b828 commit 2065651

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

libs/apps/generator/generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ var appResourceSpecs = map[string]appResourceSpec{
290290
},
291291
"serving_endpoint": {
292292
yamlKey: "serving_endpoint",
293-
varFields: [][2]string{{"id", "name"}},
293+
varFields: [][2]string{{"name", "name"}},
294294
permission: "CAN_QUERY",
295295
},
296296
"experiment": {

libs/apps/generator/generator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ func TestGenerateResourceYAMLAllTypes(t *testing.T) {
392392
expectContains: []string{
393393
"- name: endpoint",
394394
"serving_endpoint:",
395-
"name: ${var.endpoint_id}",
395+
"name: ${var.endpoint_name}",
396396
"permission: CAN_QUERY",
397397
},
398398
},

libs/apps/prompt/listers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func ListServingEndpoints(ctx context.Context) (*PagedFetcher, error) {
382382
if name == "" {
383383
name = e.Id
384384
}
385-
return ListItem{ID: e.Id, Label: name}
385+
return ListItem{ID: e.Name, Label: name}
386386
}
387387
items, hasMore, err := collectN(ctx, iter, pageSize, mapFn)
388388
if err != nil {

0 commit comments

Comments
 (0)