-
Notifications
You must be signed in to change notification settings - Fork 831
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
Implement triggers deploy
command
#5426
Conversation
🦋 Changeset detectedLatest commit: 638387e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
a868cc2
to
9ae60ad
Compare
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/8472555798/npm-package-wrangler-5426 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5426/npm-package-wrangler-5426 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8472555798/npm-package-wrangler-5426 dev path/to/script.js Additional artifacts:npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8472555798/npm-package-create-cloudflare-5426 --no-auto-update npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8472555798/npm-package-cloudflare-kv-asset-handler-5426 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8472555798/npm-package-miniflare-5426 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8472555798/npm-package-cloudflare-pages-shared-5426 npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8472555798/npm-package-cloudflare-vitest-pool-workers-5426 Note that these links will no longer work once the GitHub Actions artifact expires.
Please ensure constraints are pinned, and |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5426 +/- ##
=========================================
+ Coverage 0 72.29% +72.29%
=========================================
Files 0 325 +325
Lines 0 16765 +16765
Branches 0 4290 +4290
=========================================
+ Hits 0 12120 +12120
- Misses 0 4645 +4645
|
f5f793d
to
44c2f27
Compare
… `wrangler deploy` but different in `wrangler triggers deploy`
|
||
This command extracts the trigger deployment logic from `wrangler deploy` and allows users to update their currently deployed Worker's triggers without doing another deployment. This is primarily useful for users of `wrangler versions upload` and `wrangler versions deploy` who can then run `wrangler triggers deploy` to apply trigger changes to their currently deployed Worker Versions. | ||
|
||
The command can also be used even if not using the `wrangler versions ...` commands. And, in fact, are already using it implicitly when running `wrangler deploy`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing a word. Maybe "developers are already using it implicitly when running wrangler deploy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #5436
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These snapshots should not be changed, but I assume this has been fixed in a followup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as for deploy.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.option("dispatch-namespace", { | ||
describe: | ||
"Name of a dispatch namespace to deploy the Worker to (Workers for Platforms)", | ||
type: "string", | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise these options are copied from deploy
, but this argument doesn't make sense for triggers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #5436
const configPath = args.config || findWranglerToml(); | ||
const config = readConfig(configPath, args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to resolve the config path outside of readConfig()
. The first argument should be undefined
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #5436
for (const route of routes) { | ||
if (typeof route !== "string" && route.custom_domain) { | ||
if (route.pattern.includes("*")) { | ||
throw new UserError( | ||
`Cannot use "${route.pattern}" as a Custom Domain; wildcard operators (*) are not allowed` | ||
); | ||
} | ||
if (route.pattern.includes("/")) { | ||
throw new UserError( | ||
`Cannot use "${route.pattern}" as a Custom Domain; paths are not allowed` | ||
); | ||
} | ||
customDomainsOnly.push(route); | ||
} else { | ||
routesOnly.push(route); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've added logic for publishing routes here, but haven't removed it from wrangler deploy
. Are you sure this won't cause duplicate deploys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely not causing duplicate deploys. This was left for the validation. The arrays are dead code which have been removed in #5436
for posterity, i am approving this PR -- the concerns raised are addressed in the linked PRs/commits, which themselves have been approved |
What this PR solves / how to test
This PR implements the
wrangler triggers deploy
command behind the--experimental-versions
flag.I extracted the logic from
wrangler deploy
which I've now made call into the extracted function. The test coverage forwrangler deploy
should coverwrangler triggers deploy
.The only difference this makes to
wrangler deploy
is:the log lineno longer different"Published <worker-name> (<timing>)"
is now"Deployed <worker-name> triggers (<timing>)"
available_on_subdomain
from the response of the PUT script call, it now makes an additional GET call to ".../subdomain" to get the valueIt is possible to mitigate these two differences but I don't think the log line change or minimal added latency necessitates it. But I'm open to others' opinions :)The only difference is the latencyCR: https://jira.cfdata.org/browse/CR-850334
Author has addressed the following