Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add d1 and kv to e2e cleanup job #7681

Merged
merged 3 commits into from
Jan 7, 2025
Merged

chore: add d1 and kv to e2e cleanup job #7681

merged 3 commits into from
Jan 7, 2025

Conversation

emily-shen
Copy link
Contributor

@emily-shen emily-shen commented Jan 6, 2025

Fixes https://jira.cfdata.org/browse/DEVX-1537


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because:
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: doesn't affect e2e's (cleanup is a separate job)
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal

@emily-shen emily-shen requested a review from a team as a code owner January 6, 2025 19:38
Copy link

changeset-bot bot commented Jan 6, 2025

⚠️ No Changeset found

Latest commit: 5fe3749

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@emily-shen emily-shen marked this pull request as draft January 6, 2025 19:38
Copy link
Contributor

github-actions bot commented Jan 6, 2025

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-wrangler-7681

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7681/npm-package-wrangler-7681

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-wrangler-7681 dev path/to/script.js
Additional artifacts:
wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-workers-bindings-extension-7681 -O ./cloudflare-workers-bindings-extension.0.0.0-v28a0f1b02.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v28a0f1b02.vsix
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-create-cloudflare-7681 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-kv-asset-handler-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-miniflare-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-pages-shared-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-unenv-preset-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-vitest-pool-workers-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-workers-editor-shared-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-workers-shared-7681
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12649891388/npm-package-cloudflare-workflows-shared-7681

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241218.0
workerd 1.20241230.0 1.20241230.0
workerd --version 1.20241230.0 2024-12-30

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@emily-shen emily-shen marked this pull request as ready for review January 7, 2025 10:37
Copy link
Contributor

@andyjessop andyjessop left a comment

Choose a reason for hiding this comment

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

Looking good! Just an optimisation comment that might save a fair amount of time if we're doing this a lot.

Comment on lines +32 to +35
for (const kvNamespace of kvNamespacesToDelete) {
console.log("Deleting KV namespace: " + kvNamespace.title);
await deleteKVNamespace(kvNamespace.id);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could potentially save some seconds by doing these deletions in parallel:

const promises = [];
for (const kvNamespace of kvNamespacesToDelete) {
	console.log("Deleting KV namespace: " + kvNamespace.title);
	promises.push(deleteKVNamespace(kvNamespace.id));
}
await Promise.all(promises);

Copy link
Contributor Author

@emily-shen emily-shen Jan 7, 2025

Choose a reason for hiding this comment

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

Would this end up spamming the API too much? I'm not sure what sort of rate limiting there is on there, and while we work through deleting our backlog it might be making a couple hundred calls :') Also this only runs once a day out of EU/US hours, so hopefully CI time shouldn't be a problem. I'm inclined to leave it for now, and if we end up having problems we can revisit it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok. Yeah that makes sense. I thought it was running on each CI run, but if it's out-of-hours then that seems fine 👍

Comment on lines +72 to +75
for (const db of d1DatabasesToDelete) {
console.log("Deleting D1 database: " + db.name);
await deleteDatabase(db.uuid);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

As above. Unless they rely on each other, I presume we can do these in parallel.

Copy link
Contributor

@andyjessop andyjessop left a comment

Choose a reason for hiding this comment

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

Good stuff!!

@emily-shen emily-shen merged commit a7b0488 into main Jan 7, 2025
34 of 37 checks passed
@emily-shen emily-shen deleted the emily/e2e-cleanup branch January 7, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants