Skip to content

Add thumbnail_path to the apps resource - #7728

Open
fjakobs wants to merge 12 commits into
mainfrom
fjakobs/app-thumbnail
Open

fjakobs wants to merge 12 commits into
mainfrom
fjakobs/app-thumbnail

Conversation

@fjakobs

@fjakobs fjakobs commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Changes

New resources.apps.<key>.thumbnail_path: path of a local PNG or JPEG image, relative to the file that defines the app. bundle deploy uploads it as the app's thumbnail in the Apps UI (PATCH /api/2.0/apps/{name}/thumbnail).

  • The Apps API can't return the image, only thumbnail_url, so the direct engine keeps a hash of it in state (hashed_fields, as for dashboards.serialized_dashboard). An unchanged file makes no API call. New content uploads only the thumbnail, without an app update. Removing the field deletes the thumbnail (DELETE .../thumbnail). A bundle that never sets the field leaves a thumbnail uploaded in the UI alone.
  • The file is checked when the bundle loads, so bundle validate rejects a missing file, a file that isn't PNG or JPEG (detected by its signature, as the API does), or one over 250,000 bytes.
  • On create, the upload runs right after the app is created. If it fails, the deploy warns and leaves the thumbnail out of state, so the next deploy retries it. Failing the create there would leave the new app out of the state.
  • Fake server handlers for the two endpoints, schema annotation, and regenerated JSON schema, refschema and Python models.

Why

Apps can have a thumbnail, but bundles had no way to set it.

  • Name: thumbnail_path follows the _path naming of other local-file fields (source_code_path, file_path). It is also the name of the matching databricks_app argument in Add thumbnail_path to databricks_app terraform-provider-databricks#6196.
  • Limit: 250,000 bytes is the Apps UI's limit and the one the Terraform provider checks at plan time, so all clients accept the same images. The backend allows more (requests up to 1 MiB).

Tests

  • Unit tests for the file checks (PNG, JPEG, exactly 250,000 bytes accepted, 250,001 rejected, GIF, empty file, missing file) and the path visitor.
  • New acceptance tests:
    • bundle/resources/apps/thumbnail records the requests for: create plus upload, an unchanged redeploy (no thumbnail request), new content (thumbnail upload only), deploy --plan from a saved plan (uploads the image, not its hash), removal (delete), and destroy.
    • thumbnail-invalid covers bundle validate errors.
    • thumbnail-upload-fails covers the warn-and-retry path on create.
  • Ran ./task fmt, ./task checks and ./task lint, go test ./bundle/... ./libs/testserver/... and the full local acceptance suite.
  • Ran by hand against a live staging workspace with a locally built CLI:
    • Create sets thumbnail_url.
    • An unchanged redeploy only sends GET /apps/{name}.
    • New content sends a single PATCH .../thumbnail.
    • A JPEG works.
    • A GIF fails bundle validate.
    • Removing the field sends DELETE .../thumbnail.
    • Destroy works.

This pull request and its description were written by Isaac.

@fjakobs
fjakobs requested review from a team as code owners November 17, 2026 16:29
@github-actions github-actions Bot added the DABs DABs related issues label Nov 17, 2026
`resources.apps.<key>.thumbnail_path` points at a local PNG or JPEG image
that `bundle deploy` uploads as the app's thumbnail in the Apps UI. The
Apps API can't return the image, so the direct engine keeps only a hash of
it in state (hashed_fields): an unchanged file makes no API call, new
content uploads only the thumbnail (no app update), and removing the field
deletes the thumbnail.

The file is checked when the bundle is loaded, so `bundle validate` already
rejects files that aren't PNG or JPEG (by signature, like the API) or are
larger than 250,000 bytes, the limit of the Apps UI and of the Terraform
provider's databricks_app.thumbnail_path.

Co-authored-by: Isaac <no-reply@databricks.com>
@fjakobs
fjakobs force-pushed the fjakobs/app-thumbnail branch from bb827e0 to 8eac7c0 Compare November 17, 2026 16:29
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Commit: 45e5e5082 | Workflow run

Regression test report

Selected 4 changed tests (limit=20, 0 not selected)

8 tests: regression=8 unreleased=0 coverage=0 failing=0
test branch main (f4a7fe5) latest (v1.27.0)
TestAccept/bundle/refschema/DMS= ✅ ❌ ❌
TestAccept/bundle/refschema/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/apps/thumbnail-invalid/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/apps/thumbnail-invalid/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/apps/thumbnail-upload-fails/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/apps/thumbnail-upload-fails/DMS=true ✅ ❌ ❌
TestAccept/bundle/resources/apps/thumbnail/DMS= ✅ ❌ ❌
TestAccept/bundle/resources/apps/thumbnail/DMS=true ✅ ❌ ❌
TestAccept/bundle/refschema/DMS=: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: Diff:
        --- bundle/refschema/output/apps.txt
        +++ /tmp/TestAcceptbundlerefschemaDMS=3534988619/001/output/apps.txt
        @@ -230,9 +230,6 @@
         resources.apps.*.telemetry_export_destinations[*].unity_catalog.logs_table	string	ALL
         resources.apps.*.telemetry_export_destinations[*].unity_catalog.metrics_table	string	ALL
         resources.apps.*.telemetry_export_destinations[*].unity_catalog.traces_table	string	ALL
        -resources.apps.*.thumbnail	string	STATE
        -resources.apps.*.thumbnail_content	string	INPUT
        -resources.apps.*.thumbnail_path	string	INPUT
         resources.apps.*.thumbnail_url	string	ALL
         resources.apps.*.update_time	string	ALL
         resources.apps.*.updater	string	ALL

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/refschema/DMS=true: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: Diff:
        --- bundle/refschema/output/apps.txt
        +++ /tmp/TestAcceptbundlerefschemaDMS=true58835317/001/output/apps.txt
        @@ -230,9 +230,6 @@
         resources.apps.*.telemetry_export_destinations[*].unity_catalog.logs_table	string	ALL
         resources.apps.*.telemetry_export_destinations[*].unity_catalog.metrics_table	string	ALL
         resources.apps.*.telemetry_export_destinations[*].unity_catalog.traces_table	string	ALL
        -resources.apps.*.thumbnail	string	STATE
        -resources.apps.*.thumbnail_content	string	INPUT
        -resources.apps.*.thumbnail_path	string	INPUT
         resources.apps.*.thumbnail_url	string	ALL
         resources.apps.*.update_time	string	ALL
         resources.apps.*.updater	string	ALL

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/resources/apps/thumbnail-invalid/DMS=: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1400
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1141
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n=== thumbnail_path: ./thumbnail.gif\n\n>>> musterr [CLI] bundle validate\nError: app thumbnail thumbnail.gif must be a PNG or JPEG image, got image/gif\n  in databricks.yml:9:23\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 error\n\n=== thumbnail_path: ./large.png\n\n>>> musterr [CLI] bundle validate\nError: app thumbnail large.png is 250001 bytes, larger than the limit of 250000 bytes\n  in databricks.yml:9:23\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 error\n\n=== thumbnail_path: ./missing.png\n\n>>> musterr [CLI] bundle validate\nError: failed to read app thumbnail missing.png: open missing.png: no such file or directory\n  in databricks.yml:9:23\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 error\n"
        	            	actual  : "\n=== thumbnail_path: ./thumbnail.gif\n\n>>> musterr [CLI] bundle validate\nWarning: unknown field: thumbnail_path\n  at resources.apps.myapp\n  in databricks.yml:9:7\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 warning\n\nUnexpected success\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -4,4 +4,5 @@
        	            	 >>> musterr [CLI] bundle validate
        	            	-Error: app thumbnail thumbnail.gif must be a PNG or JPEG image, got image/gif
        	            	-  in databricks.yml:9:23
        	            	+Warning: unknown field: thumbnail_path
        	            	+  at resources.apps.myapp
        	            	+  in databricks.yml:9:7
        	            	 
        	            	@@ -13,31 +14,7 @@
        	            	 
        	            	-Found 1 error
        	            	+Found 1 warning
        	            	 
        	            	-=== thumbnail_path: ./large.png
        	            	+Unexpected success
        	            	 
        	            	->>> musterr [CLI] bundle validate
        	            	-Error: app thumbnail large.png is 250001 bytes, larger than the limit of 250000 bytes
        	            	-  in databricks.yml:9:23
        	            	+Exit code: 1
        	            	 
        	            	-Name: test-bundle
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        	            	-
        	            	-Found 1 error
        	            	-
        	            	-=== thumbnail_path: ./missing.png
        	            	-
        	            	->>> musterr [CLI] bundle validate
        	            	-Error: failed to read app thumbnail missing.png: open missing.png: no such file or directory
        	            	-  in databricks.yml:9:23
        	            	-
        	            	-Name: test-bundle
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        	            	-
        	            	-Found 1 error
        	            	-
        	Test:       	TestAccept/bundle/resources/apps/thumbnail-invalid/DMS=
        	Messages:   	bundle/resources/apps/thumbnail-invalid/output.txt vs /tmp/TestAcceptbundleresourcesappsthumbnail-invalidDMS=3835141189/002/output.txt
    acceptance_test.go:1190: Test produced unexpected files:
        .databricks/.gitignore

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/resources/apps/thumbnail-invalid/DMS=true: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1400
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1141
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "\n=== thumbnail_path: ./thumbnail.gif\n\n>>> musterr [CLI] bundle validate\nError: app thumbnail thumbnail.gif must be a PNG or JPEG image, got image/gif\n  in databricks.yml:9:23\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 error\n\n=== thumbnail_path: ./large.png\n\n>>> musterr [CLI] bundle validate\nError: app thumbnail large.png is 250001 bytes, larger than the limit of 250000 bytes\n  in databricks.yml:9:23\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 error\n\n=== thumbnail_path: ./missing.png\n\n>>> musterr [CLI] bundle validate\nError: failed to read app thumbnail missing.png: open missing.png: no such file or directory\n  in databricks.yml:9:23\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 error\n"
        	            	actual  : "\n=== thumbnail_path: ./thumbnail.gif\n\n>>> musterr [CLI] bundle validate\nWarning: unknown field: thumbnail_path\n  at resources.apps.myapp\n  in databricks.yml:9:7\n\nName: test-bundle\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default\n\nFound 1 warning\n\nUnexpected success\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -4,4 +4,5 @@
        	            	 >>> musterr [CLI] bundle validate
        	            	-Error: app thumbnail thumbnail.gif must be a PNG or JPEG image, got image/gif
        	            	-  in databricks.yml:9:23
        	            	+Warning: unknown field: thumbnail_path
        	            	+  at resources.apps.myapp
        	            	+  in databricks.yml:9:7
        	            	 
        	            	@@ -13,31 +14,7 @@
        	            	 
        	            	-Found 1 error
        	            	+Found 1 warning
        	            	 
        	            	-=== thumbnail_path: ./large.png
        	            	+Unexpected success
        	            	 
        	            	->>> musterr [CLI] bundle validate
        	            	-Error: app thumbnail large.png is 250001 bytes, larger than the limit of 250000 bytes
        	            	-  in databricks.yml:9:23
        	            	+Exit code: 1
        	            	 
        	            	-Name: test-bundle
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        	            	-
        	            	-Found 1 error
        	            	-
        	            	-=== thumbnail_path: ./missing.png
        	            	-
        	            	->>> musterr [CLI] bundle validate
        	            	-Error: failed to read app thumbnail missing.png: open missing.png: no such file or directory
        	            	-  in databricks.yml:9:23
        	            	-
        	            	-Name: test-bundle
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
        	            	-
        	            	-Found 1 error
        	            	-
        	Test:       	TestAccept/bundle/resources/apps/thumbnail-invalid/DMS=true
        	Messages:   	bundle/resources/apps/thumbnail-invalid/output.txt vs /tmp/TestAcceptbundleresourcesappsthumbnail-invalidDMS=true1599598090/002/output.txt
    acceptance_test.go:1190: Test produced unexpected files:
        .databricks/.gitignore

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/resources/apps/thumbnail-upload-fails/DMS=: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: Diff:
        --- bundle/resources/apps/thumbnail-upload-fails/output.txt
        +++ /tmp/TestAcceptbundleresourcesappsthumbnail-upload-failsDMS=707434397/002/output.txt
        @@ -2,8 +2,11 @@
         === A failed upload after create keeps the app in state and leaves the thumbnail out of it
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warning: failed to upload the thumbnail of app myappname, the next deploy retries it: Unsupported image
         Created apps.mykey
         Files: 2 uploaded, 0 deleted
         Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        @@ -14,25 +16,33 @@
         === The next deploy retries the upload
         
         >>> [CLI] bundle plan
        -update apps.mykey
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
        +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
         >>> musterr [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Error: cannot update resources.apps.mykey: updating id=myappname: Unsupported image (400 INVALID_PARAMETER_VALUE)
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/apps/myappname/thumbnail
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Unsupported image
        -
        +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Files: 0 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
        +Unexpected success
        +
         >>> [CLI] bundle destroy --auto-approve
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         The following resources will be deleted:
           delete resources.apps.mykey
         
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/resources/apps/thumbnail-upload-fails/DMS=true: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: Diff:
        --- bundle/resources/apps/thumbnail-upload-fails/output.txt
        +++ /tmp/TestAcceptbundleresourcesappsthumbnail-upload-failsDMS=true3261120272/002/output.txt
        @@ -2,8 +2,11 @@
         === A failed upload after create keeps the app in state and leaves the thumbnail out of it
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Warning: failed to upload the thumbnail of app myappname, the next deploy retries it: Unsupported image
         Created apps.mykey
         Files: 2 uploaded, 0 deleted
         Resources: 1 created, 0 changed, 0 deleted, 0 unchanged
        @@ -14,25 +16,33 @@
         === The next deploy retries the upload
         
         >>> [CLI] bundle plan
        -update apps.mykey
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
        +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
         >>> musterr [CLI] bundle deploy
        -Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Error: cannot update resources.apps.mykey: updating id=myappname: Unsupported image (400 INVALID_PARAMETER_VALUE)
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        -Endpoint: PATCH [DATABRICKS_URL]/api/2.0/apps/myappname/thumbnail
        -HTTP Status: 400 Bad Request
        -API error_code: INVALID_PARAMETER_VALUE
        -API message: Unsupported image
        -
        +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Files: 0 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
        +Unexpected success
        +
         >>> [CLI] bundle destroy --auto-approve
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         The following resources will be deleted:
           delete resources.apps.mykey
         
         All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/test-bundle/default
         
         Destroy: 1 deleted
        +
        +Exit code: 1

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/resources/apps/thumbnail/DMS=: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: Diff:
        --- bundle/resources/apps/thumbnail/output.txt
        +++ /tmp/TestAcceptbundleresourcesappsthumbnailDMS=1135839591/002/output.txt
        @@ -2,6 +2,10 @@
         === Deploy with a thumbnail: the image is uploaded after the app is created
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Created apps.mykey
         Files: 5 uploaded, 0 deleted
        @@ -10,19 +14,31 @@
         >>> print_requests
         
         >>> [CLI] apps get myappname
        -"/ajax-api/2.0/thumbnails/raw/apps/1000/SMALL_DEFAULT.png"
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        +null
        +
         === State keeps only a hash of the image
         
         >>> jq .state["resources.apps.mykey"].state.thumbnail .databricks/bundle/default/resources.json
        -"sha256:[HASH]"
        +null
         
         === Redeploy with an unchanged image: no thumbnail request
         
         >>> [CLI] bundle plan
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Files: 1 uploaded, 0 deleted
         Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        @@ -32,41 +37,49 @@
         === New content at the same path: only the thumbnail is uploaded
         
         >>> [CLI] bundle plan
        -update apps.mykey
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
        +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Updated apps.mykey
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
         >>> print_requests
         
         === Deploy from a saved plan: the plan carries the image, not its hash
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        +
         >>> [CLI] bundle deploy --plan tmp.plan.json
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Updated apps.mykey
        -Files: 3 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        +Files: 2 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
         >>> print_requests.py //apps ^//api/2.0/bundle
        -iVBORw0KGgoA
         
         === Remove thumbnail_path: the thumbnail is deleted
         
         >>> [CLI] bundle plan
        -update apps.mykey
        +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
        -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
        -
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Updated apps.mykey
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
         >>> print_requests
         
        
    acceptance_test.go:1400: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1400
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1153
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "{\n  \"method\": \"POST\",\n  \"path\": \"/api/2.0/apps\",\n  \"q\": {\n    \"no_compute\": \"true\"\n  },\n  \"body\": {\n    \"description\": \"\",\n    \"name\": \"myappname\",\n    \"source_code_path\": \"/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/app\"\n  }\n}\n{\n  \"method\": \"PATCH\",\n  \"path\": \"/api/2.0/apps/myappname/thumbnail\",\n  \"body\": {\n    \"app_thumbnail\": {\n      \"thumbnail\": \"iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAHklEQVR42mNgYPhPYzRqwagFoxaMWjBqwagFdLAAAM9QPd+sTeHpAAAAAElFTkSuQmCC\"\n    }\n  }\n}\n{\n  \"method\": \"PATCH\",\n  \"path\": \"/api/2.0/apps/myappname/thumbnail\",\n  \"body\": {\n    \"app_thumbnail\": {\n      \"thumbnail\": \"iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAH0lEQVR42mP4z8BAU8QwasGoBaMWjFowasGoBfSwAABLGz3fTe+jHwAAAABJRU5ErkJggg==\"\n    }\n  }\n}\n{\n  \"method\": \"DELETE\",\n  \"path\": \"/api/2.0/apps/myappname/thumbnail\"\n}\n{\n  \"method\": \"DELETE\",\n  \"path\": \"/api/2.0/apps/myappname\"\n}\n"
        	            	actual  : "{\n  \"method\": \"POST\",\n  \"path\": \"/api/2.0/apps\",\n  \"q\": {\n    \"no_compute\": \"true\"\n  },\n  \"body\": {\n    \"description\": \"\",\n    \"name\": \"myappname\",\n    \"source_code_path\": \"/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/app\"\n  }\n}\n{\n  \"method\": \"DELETE\",\n  \"path\": \"/api/2.0/apps/myappname\"\n}\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -13,24 +13,2 @@
        	            	 {
        	            	-  "method": "PATCH",
        	            	-  "path": "/api/2.0/apps/myappname/thumbnail",
        	            	-  "body": {
        	            	-    "app_thumbnail": {
        	            	-      "thumbnail": "iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAHklEQVR42mNgYPhPYzRqwagFoxaMWjBqwagFdLAAAM9QPd+sTeHpAAAAAElFTkSuQmCC"
        	            	-    }
        	            	-  }
        	            	-}
        	            	-{
        	            	-  "method": "PATCH",
        	            	-  "path": "/api/2.0/apps/myappname/thumbnail",
        	            	-  "body": {
        	            	-    "app_thumbnail": {
        	            	-      "thumbnail": "iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAH0lEQVR42mP4z8BAU8QwasGoBaMWjFowasGoBfSwAABLGz3fTe+jHwAAAABJRU5ErkJggg=="
        	            	-    }
        	            	-  }
        	            	-}
        	            	-{
        	            	-  "method": "DELETE",
        	            	-  "path": "/api/2.0/apps/myappname/thumbnail"
        	            	-}
        	            	-{
        	            	   "method": "DELETE",
        	Test:       	TestAccept/bundle/resources/apps/thumbnail/DMS=
        	Messages:   	bundle/resources/apps/thumbnail/out.requests.json vs /tmp/TestAcceptbundleresourcesappsthumbnailDMS=1135839591/001/out.requests.json

latest (v1.27.0): same output as main (f4a7fe5)

TestAccept/bundle/resources/apps/thumbnail/DMS=true: branch ✅ | main (f4a7fe5) ❌ | latest (v1.27.0) ❌

main (f4a7fe5):

acceptance_test.go:1400: Diff:
        --- bundle/resources/apps/thumbnail/output.txt
        +++ /tmp/TestAcceptbundleresourcesappsthumbnailDMS=true2594946967/002/output.txt
        @@ -2,6 +2,10 @@
         === Deploy with a thumbnail: the image is uploaded after the app is created
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Created apps.mykey
         Files: 5 uploaded, 0 deleted
        @@ -10,19 +14,31 @@
         >>> print_requests
         
         >>> [CLI] apps get myappname
        -"/ajax-api/2.0/thumbnails/raw/apps/1000/SMALL_DEFAULT.png"
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        +null
        +
         === State keeps only a hash of the image
         
         >>> jq .state["resources.apps.mykey"].state.thumbnail .databricks/bundle/default/resources.json
        -"sha256:[HASH]"
        +null
         
         === Redeploy with an unchanged image: no thumbnail request
         
         >>> [CLI] bundle plan
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
         Files: 1 uploaded, 0 deleted
         Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
        @@ -32,41 +37,49 @@
         === New content at the same path: only the thumbnail is uploaded
         
         >>> [CLI] bundle plan
        -update apps.mykey
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
        +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
         >>> [CLI] bundle deploy
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Updated apps.mykey
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
         >>> print_requests
         
         === Deploy from a saved plan: the plan carries the image, not its hash
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
         
        +
         >>> [CLI] bundle deploy --plan tmp.plan.json
        +Warning: unknown field: thumbnail_path
        +  at resources.apps.mykey
        +  in databricks.yml:9:7
        +
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Updated apps.mykey
        -Files: 3 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        +Files: 2 uploaded, 0 deleted
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
         >>> print_requests.py //apps ^//api/2.0/bundle
        -iVBORw0KGgoA
         
         === Remove thumbnail_path: the thumbnail is deleted
         
         >>> [CLI] bundle plan
        -update apps.mykey
        +Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
         
        -Plan: 0 to add, 1 to change, 0 to delete, 0 unchanged
        -
         >>> [CLI] bundle deploy
         Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files...
        -Updated apps.mykey
         Files: 1 uploaded, 0 deleted
        -Resources: 0 created, 1 changed, 0 deleted, 0 unchanged
        +Resources: 0 created, 0 changed, 0 deleted, 1 unchanged
         
         >>> print_requests
         
        
    acceptance_test.go:1400: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1400
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1153
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:704
        	Error:      	Not equal: 
        	            	expected: "{\n  \"method\": \"POST\",\n  \"path\": \"/api/2.0/apps\",\n  \"q\": {\n    \"no_compute\": \"true\"\n  },\n  \"body\": {\n    \"description\": \"\",\n    \"name\": \"myappname\",\n    \"source_code_path\": \"/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/app\"\n  }\n}\n{\n  \"method\": \"PATCH\",\n  \"path\": \"/api/2.0/apps/myappname/thumbnail\",\n  \"body\": {\n    \"app_thumbnail\": {\n      \"thumbnail\": \"iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAHklEQVR42mNgYPhPYzRqwagFoxaMWjBqwagFdLAAAM9QPd+sTeHpAAAAAElFTkSuQmCC\"\n    }\n  }\n}\n{\n  \"method\": \"PATCH\",\n  \"path\": \"/api/2.0/apps/myappname/thumbnail\",\n  \"body\": {\n    \"app_thumbnail\": {\n      \"thumbnail\": \"iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAH0lEQVR42mP4z8BAU8QwasGoBaMWjFowasGoBfSwAABLGz3fTe+jHwAAAABJRU5ErkJggg==\"\n    }\n  }\n}\n{\n  \"method\": \"DELETE\",\n  \"path\": \"/api/2.0/apps/myappname/thumbnail\"\n}\n{\n  \"method\": \"DELETE\",\n  \"path\": \"/api/2.0/apps/myappname\"\n}\n"
        	            	actual  : "{\n  \"method\": \"POST\",\n  \"path\": \"/api/2.0/apps\",\n  \"q\": {\n    \"no_compute\": \"true\"\n  },\n  \"body\": {\n    \"description\": \"\",\n    \"name\": \"myappname\",\n    \"source_code_path\": \"/Workspace/Users/[USERNAME]/.bundle/test-bundle/default/files/app\"\n  }\n}\n{\n  \"method\": \"DELETE\",\n  \"path\": \"/api/2.0/apps/myappname\"\n}\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -13,24 +13,2 @@
        	            	 {
        	            	-  "method": "PATCH",
        	            	-  "path": "/api/2.0/apps/myappname/thumbnail",
        	            	-  "body": {
        	            	-    "app_thumbnail": {
        	            	-      "thumbnail": "iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAHklEQVR42mNgYPhPYzRqwagFoxaMWjBqwagFdLAAAM9QPd+sTeHpAAAAAElFTkSuQmCC"
        	            	-    }
        	            	-  }
        	            	-}
        	            	-{
        	            	-  "method": "PATCH",
        	            	-  "path": "/api/2.0/apps/myappname/thumbnail",
        	            	-  "body": {
        	            	-    "app_thumbnail": {
        	            	-      "thumbnail": "iVBORw0KGgoAAAANSUhEUgAAACAAAAASCAIAAAC1qksFAAAAH0lEQVR42mP4z8BAU8QwasGoBaMWjFowasGoBfSwAABLGz3fTe+jHwAAAABJRU5ErkJggg=="
        	            	-    }
        	            	-  }
        	            	-}
        	            	-{
        	            	-  "method": "DELETE",
        	            	-  "path": "/api/2.0/apps/myappname/thumbnail"
        	            	-}
        	            	-{
        	            	   "method": "DELETE",
        	Test:       	TestAccept/bundle/resources/apps/thumbnail/DMS=true
        	Messages:   	bundle/resources/apps/thumbnail/out.requests.json vs /tmp/TestAcceptbundleresourcesappsthumbnailDMS=true2594946967/001/out.requests.json
FAIL

latest (v1.27.0): same output as main (f4a7fe5)

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 45e5e50

Run: 44721672805

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 275 22 4:13
💚​ aws-windows-latest-4core-16gb 1 277 20 3:26
💚​ azure linux-2core-8gb 1 274 22 3:55
💚​ azure-windows-latest-4core-16gb 1 276 20 3:43
💚​ gcp linux-2core-8gb 1 275 22 4:02
💚​ gcp-windows-latest-4core-16gb 1 277 20 4:07
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
4:00 gcp-windows-latest-4core-16gb TestAccept
3:36 azure-windows-latest-4core-16gb TestAccept
3:13 aws-windows-latest-4core-16gb TestAccept

@janniklasrose

Copy link
Copy Markdown
Member

/review

Comment thread libs/testserver/apps.go

// AppsGet returns the app, keeping DELETING resources visible so callers can
// observe transient state (matches the cloud DELETE lifecycle).
// AppsUpdateThumbnail sets thumbnail_url, the only trace of the image the real API returns.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two new functions were inserted between the AppsGet doc comment (lines 227–228) and AppsGet itself (now line 256). Go treats consecutive // lines as a single block, so AppsUpdateThumbnail now carries AppsGet's comment and AppsGet has none. Move the AppsGet comment down to just above func (s *FakeWorkspace) AppsGet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — AppsGet's comment moved back down to AppsGet, and AppsDeleteThumbnail got its own.

// and the next deploy retries it. Failing here would leave the new app out of the state.
if config.Thumbnail != "" {
if err := r.updateThumbnail(ctx, app.Name, config.Thumbnail); err != nil {
cmdio.LogString(ctx, fmt.Sprintf("Warning: failed to upload the thumbnail of app %s, the next deploy retries it: %s", app.Name, err))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use diags here for warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direct apply path has no diag plumbing: adapters and the apply loop return only errors, so a diag.Warning can't travel out of DoCreate. The loop surfaces progress via cmdio.LogString (the Updated apps.mykey lines), so the warning uses the same channel and is visible at the default log level; log.Warnf would only show with --log-level raised.

trace print_requests.py //apps '^//api/2.0/bundle' | jq -r '.body.app_thumbnail.thumbnail | .[0:12]'

title "Remove thumbnail_path: the thumbnail is deleted"
grep -v thumbnail_path databricks.yml > databricks.yml.new

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a python helper to update databricks.yml in-place

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — now update_file.py databricks.yml $' thumbnail_path: ./thumbnail.png\n' '' (untraced, like the dms tests).

trap cleanup EXIT

title "A failed upload after create keeps the app in state and leaves the thumbnail out of it"
trace $CLI bundle deploy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use musterr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept errcode here deliberately: this deploy should exit 0. The app was already created, so failing the deploy would leave it out of the bundle state and the next deploy would try to create it again (name conflict). The warning keeps the app managed with the thumbnail left out of state, so the next deploy retries it — that retry is the musterr in the next section.


title "The next deploy retries the upload"
trace $CLI bundle plan
errcode trace $CLI bundle deploy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, musterr.

title "thumbnail_path: $THUMBNAIL_PATH"
export THUMBNAIL_PATH
envsubst < databricks.yml.tmpl > databricks.yml
errcode trace $CLI bundle validate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

musterr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, musterr.

@@ -0,0 +1,2 @@
Cloud = false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not Cloud = true to encode server limit on image size and type being rejected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto for other sibling tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Cloud = true. One caveat: these checks fire at bundle load, before any API call, so the cloud run exercises the same client-side rejection against a real workspace, not the server's own limit (the API accepts PNG/JPEG and larger payloads; 250 KB matches the Apps UI and the Terraform provider).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other two are fake-server-only: thumbnail records requests with print_requests and thumbnail-upload-fails injects a 400 via a [[Server]] override, so they can't run in the cloud matrix. The real-workspace behavior (set / unchanged no-op / change / remove / JPEG / GIF rejected) was verified by hand against a staging workspace — see the PR description.

fjakobs and others added 3 commits November 18, 2026 15:03
Co-authored-by: Isaac <no-reply@databricks.com>
# Conflicts:
#	bundle/direct/dresources/app.go
Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants