chore: add read-only diagnostic to list stale acceptance-test projects - #725
Draft
dbtagarovat wants to merge 6 commits into
Draft
chore: add read-only diagnostic to list stale acceptance-test projects#725dbtagarovat wants to merge 6 commits into
dbtagarovat wants to merge 6 commits into
Conversation
The live acceptance-test account has accumulated a large number of orphaned projects from acceptance-test runs whose destroy step failed (a transient API timeout leaves the project dangling). That bloat is itself now making list/create/read calls against /projects/ slow enough to trip client timeouts, which is a likely contributor to the project/credential-resource acceptance test failures seen in CI. Adds a workflow_dispatch-only GitHub Actions job and a small Go tool that lists projects in the account with their age. GET requests only, no delete call exists anywhere in this change. Intended to produce a candidate list for review/approval before any manual cleanup.
…flow_dispatch workflow_dispatch can't be invoked until this file exists on the default branch, but this is meant to run from this throwaway diagnostic PR without merging. pull_request runs the workflow as it exists on the PR branch itself, and secrets are still available since this branch is pushed directly to the repo rather than from a fork.
TEST_DBT_CLOUD_HOST_URL isn't actually configured as a secret anywhere in this repo (checked repo secrets and the cloud-tests environment) - the existing acceptance-test workflows have been passing an empty value and relying on acctest_helper.SharedClient()'s fallback default all along. Match that behavior here instead of hard-requiring the env var.
All 695 projects failed to parse created_at with the previous layouts (likely a fractional-seconds-with-Z format like RFC3339Nano needs). Try a broader set of layouts and surface a sample raw value on failure instead of silently reporting everything as unparsed. Also set pipefail in the workflow step - `cmd | tee file` was reporting the exit status of tee, not the underlying tool, so a real failure would have shown as a green run.
Someone reviewing the candidate list asked which account/environment this actually is. Print the account name, plan, and state (from the same /v2/accounts/ auth-check endpoint NewClient already uses) so the report is self-explanatory instead of just an opaque account ID.
Someone asked whether this is effectively a specific person's individual
account rather than a dedicated CI account. Print the actual user list
(same /v3/accounts/{id}/users/ endpoint the provider's user data source
uses) so that can be answered with data instead of assumption.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While investigating CI acceptance-test flakiness (see #723), found the live test account's
/projects/list paginating pastoffset=690during a normal test run — the account has accumulated a large number of orphaned projects from acceptance-test runs whosedestroystep failed (a transient API timeout leaves the project dangling). That bloat looks like a real contributor to the timeout-driven failures on project/credential-resource tests (Athena, BigQuery, Project resource/data source, Salesforce credential), on top of the causes already fixed in #723.This adds a read-only,
workflow_dispatch-only diagnostic:tools/list-stale-projects: a small Go program (reuses the existingGetAllProjectsclient method) that lists every project in the account with its age, bucketed, plus a candidate list of anything older than-min-age(default 1h — a real CI run creates and destroys a project within ~20 minutes)..github/workflows/list-stale-test-projects.yml: manual-trigger-only workflow using the existingTEST_DBT_CLOUD_*secrets to run it.No delete call exists anywhere in this change. GET requests only. The intent is to produce a candidate list to review (and get sign-off on) before any actual cleanup, not to perform cleanup automatically.
Test plan
go build ./tools/...