Skip to content

acceptance: add destroy-bundle to clean up the bundle directory - #6318

Open
shreyas-goenka wants to merge 4 commits into
mainfrom
isaac/acceptance-destroy-bundle-helper
Open

acceptance: add destroy-bundle to clean up the bundle directory#6318
shreyas-goenka wants to merge 4 commits into
mainfrom
isaac/acceptance-destroy-bundle-helper

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Why

As we run more tests and create more PRs we are causing the production DB for webapp to slow down because of the number of treenodes. This PR adds a best-effort cleanup step that was added to existing tests to lower the amount of folder treenodes we end up with over a day.

The cleanup nightly job still handles the final cleanup and actually pruning all nodes after a day.

`bundle destroy` removes `~/.bundle/<name>/<target>` but not the `<name>`
parent, and it does not run at all when a script fails before reaching it.
Acceptance tests use a unique bundle name per run, so nothing reuses what is
left behind: the shared CI workspace accumulates the leftovers until they hit
its child-node limit.

Add a `destroy-bundle` helper that destroys the bundle and then removes the
`~/.bundle/<name>` directory it was deployed under. The cleanup runs even when
destroy fails, which is when a deployment is most likely to be left behind, and
the destroy exit code is still propagated so `set -e` behaves as before.

The `bundle destroy` call is traced exactly as a direct invocation would be and
the cleanup only runs against a real workspace, so no expected output changes.
Cleanup failures are ignored: they must never turn a passing test red. Only the
`~/.bundle/<name>/<target>` layout is touched, since `root_path` is
configurable and the parent of an arbitrary path is not ours to remove.

Converted the 58 scripts whose single destroy is the plain form and that use no
`-t` target, leaving the shapes where a rewrite could change behaviour
(`errcode`, `musterr`, `trap`, several destroys in one script) for a follow-up.

Co-authored-by: Isaac
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 0c1f59b

Run: 32246699270

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 363 1136 17:16
💚​ aws windows 4 4 302 1155 11:13
💚​ azure linux 4 4 362 1136 14:52
💚​ azure windows 4 4 301 1155 11:41
💚​ gcp linux 4 4 363 1136 17:56
🔄​ gcp windows 1 3 4 302 1155 12:48
8 interesting tests: 4 SKIP, 3 RECOVERED, 1 flaky
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 20 slowest tests (at least 2 minutes):
duration env testname
7:21 gcp windows TestAccept
7:16 azure windows TestAccept
7:09 aws windows TestAccept
6:49 gcp linux TestAccept/bundle/config-remote-sync/multiple_resources/DATABRICKS_BUNDLE_ENGINE=terraform
6:44 aws linux TestAccept/bundle/config-remote-sync/multiple_resources/DATABRICKS_BUNDLE_ENGINE=direct
6:36 gcp linux TestAccept/bundle/config-remote-sync/multiple_resources/DATABRICKS_BUNDLE_ENGINE=direct
6:17 aws linux TestAccept/bundle/config-remote-sync/multiple_resources/DATABRICKS_BUNDLE_ENGINE=terraform
6:05 azure linux TestAccept/bundle/config-remote-sync/multiple_resources/DATABRICKS_BUNDLE_ENGINE=terraform
3:55 azure linux TestAccept
3:51 aws linux TestAccept
3:49 gcp linux TestAccept
2:46 azure windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform
2:43 gcp linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform
2:43 gcp windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform
2:43 aws linux TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct
2:42 aws windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=terraform
2:28 azure windows TestAccept/bundle/apps/job_permissions/DATABRICKS_BUNDLE_ENGINE=direct
2:08 gcp windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=direct
2:04 gcp linux TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform
2:00 gcp windows TestAccept/bundle/apps/compute_size/DATABRICKS_BUNDLE_ENGINE=terraform

Co-authored-by: Isaac
The first pass only matched destroy invocations at the start of a line, which
skipped every one indented inside a `cleanup() { ... }` body registered with
`trap cleanup EXIT` — the most common shape in the suite.

Convert those too, along with the one-line `cleanup()` definitions and the
`trap "errcode trace '$CLI' bundle destroy --auto-approve" EXIT` form, all of
which produce identical trace output through the helper.

Only the last destroy in a script is converted: an earlier one would remove the
parent directory recursively while a later destroy still needs it. The
invocation also has to be terminal, meaning it sits in a trap, in a function a
trap references, or at top level with no deploy after it.

Left alone are the shapes whose recorded output would move: `musterr`, a traced
`errcode` wrapper, untraced or redirected invocations, and flags placed before
`--auto-approve`.

Co-authored-by: Isaac
That test asserts the CLI itself removes the .bundle/<name> directory. Routing
it through destroy-bundle would satisfy the assertion from the helper's own
cleanup instead, hiding the behaviour under test.

Co-authored-by: Isaac
@shreyas-goenka
shreyas-goenka marked this pull request as ready for review August 19, 2026 11:11
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/apps/ - needs approval

Files: acceptance/apps/deploy/bundle-no-args-with-flags/script, acceptance/apps/deploy/bundle-no-args/script
Suggested: @MarioCadenas
Also eligible: @fjakobs, @Shridhad, @atilafassina, @keugenek, @igrekun, @pkosiec, @pffigueiredo, @ditadi, @calvarjorge

/acceptance/bundle/ - needs approval

262 files changed
Suggested: @denik
Also eligible: @janniklasrose, @pietern, @andrewnester, @anton-107, @lennartkats-db

General files (require maintainer)

Files: .agents/rules/testing.md, acceptance/script.prepare
Based on git history:

  • @denik -- recent work in .agents/rules/, acceptance/bundle/deployment/bind/job/generate-and-bind/, acceptance/bundle/summary/modified_status/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db, @rugpanov, @rclarey) can approve all areas.
See OWNERS for ownership rules.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants