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

feat: add provisioning to versions upload and reprovision on bucket jurisdiction changes #7889

Merged
merged 12 commits into from
Jan 29, 2025

Conversation

emily-shen
Copy link
Contributor

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

Allows resource provisioning in versions upload.
Also allow switching jurisdictions (since apparently buckets with the same name can exist in different jurisdictions).


  • 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:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: experimental feature

@emily-shen emily-shen requested a review from a team as a code owner January 23, 2025 22:47
Copy link

changeset-bot bot commented Jan 23, 2025

🦋 Changeset detected

Latest commit: 0e311e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

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

@workers-devprod workers-devprod added the e2e Run wrangler e2e tests on a PR label Jan 23, 2025
Copy link
Contributor

github-actions bot commented Jan 23, 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/13032244342/npm-package-wrangler-7889

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

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

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-wrangler-7889 dev path/to/script.js
Additional artifacts:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-workers-bindings-extension-7889 -O ./cloudflare-workers-bindings-extension.0.0.0-vd11e670fb.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-vd11e670fb.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-create-cloudflare-7889 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-kv-asset-handler-7889

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-miniflare-7889

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-pages-shared-7889

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-unenv-preset-7889

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-vite-plugin-7889

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-vitest-pool-workers-7889

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-workers-editor-shared-7889

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-workers-shared-7889

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13032244342/npm-package-cloudflare-workflows-shared-7889

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.20250124.0
workerd 1.20250124.0 1.20250124.0
workerd --version 1.20250124.0 2025-01-24

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

@emily-shen emily-shen requested a review from a team as a code owner January 24, 2025 01:14
@penalosa penalosa force-pushed the emily/provisioning-versions-upload branch from 21a58b5 to 774721e Compare January 24, 2025 15:21
fixtures/worker-ts/wrangler.toml Outdated Show resolved Hide resolved
@@ -46,7 +46,7 @@ export const getDatabaseByNameOrBinding = async (
return dbFromConfig;
}

const allDBs = await listDatabases(accountId);
const allDBs = await listDatabases(accountId, true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we care that limitCalls = true changes technically breaks existing behaviour a bit? Previously this would (slowly) get all databases, now this only gets 30.
can we pass in a larger page size (it's 10 by default) - i tested it at 100 and it didn't seem to be noticably slower.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit of a hack for now. Once the new API is ready we can switch over to that, which should be today or tomorrow

Copy link
Member

Choose a reason for hiding this comment

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

Is the new API ready yet? Do we wanna wait for it or merge this as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's ready now, so I'll update this PR to use it now

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated

packages/wrangler/src/deployment-bundle/bindings.ts Outdated Show resolved Hide resolved
packages/wrangler/src/deployment-bundle/bindings.ts Outdated Show resolved Hide resolved
packages/wrangler/src/deployment-bundle/bindings.ts Outdated Show resolved Hide resolved
@emily-shen emily-shen changed the title feat: add provisioning to versions upload feat: add provisioning to versions upload and reprovision on bucket jurisdiction changes Jan 27, 2025
},
{ once: true }
}
// { once: true }
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor

Choose a reason for hiding this comment

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

Removed

Copy link
Member

@edmundhung edmundhung left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just two minor comments.

@@ -46,7 +46,7 @@ export const getDatabaseByNameOrBinding = async (
return dbFromConfig;
}

const allDBs = await listDatabases(accountId);
const allDBs = await listDatabases(accountId, true);
Copy link
Member

Choose a reason for hiding this comment

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

Is the new API ready yet? Do we wanna wait for it or merge this as is?

Comment on lines 752 to 760
getFlag("RESOURCES_PROVISION")
? await provisionBindings(
bindings,
accountId,
scriptName,
props.experimentalAutoCreate,
props.config
)
: null;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Just find the syntax a little bit strange 😅

Suggested change
getFlag("RESOURCES_PROVISION")
? await provisionBindings(
bindings,
accountId,
scriptName,
props.experimentalAutoCreate,
props.config
)
: null;
if (getFlag("RESOURCES_PROVISION")) {
await provisionBindings(
bindings,
accountId,
scriptName,
props.experimentalAutoCreate,
props.config
);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed

@penalosa penalosa force-pushed the emily/provisioning-versions-upload branch from 87ed74f to 04f1a47 Compare January 28, 2025 18:17
"wrangler": patch
---

feat: add resource auto-provisioning to versions upload
Copy link
Member

@edmundhung edmundhung Jan 29, 2025

Choose a reason for hiding this comment

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

Should we make it clear that this is still experimental and requires an experimental flag

@penalosa penalosa merged commit 38db4ed into main Jan 29, 2025
28 checks passed
@penalosa penalosa deleted the emily/provisioning-versions-upload branch January 29, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run wrangler e2e tests on a PR
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants