-
Notifications
You must be signed in to change notification settings - Fork 548
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
[Wrangler] Added sub commands in the deployments
#2607
Conversation
🦋 Changeset detectedLatest commit: d3292dc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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/4438796242/npm-package-wrangler-2607 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/2607/npm-package-wrangler-2607 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4438796242/npm-package-wrangler-2607 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4438796242/npm-package-cloudflare-pages-shared-2607 Note that these links will no longer work once the GitHub Actions artifact expires. |
Codecov Report
@@ Coverage Diff @@
## main #2607 +/- ##
==========================================
+ Coverage 73.95% 74.09% +0.13%
==========================================
Files 167 167
Lines 10299 10418 +119
Branches 2748 2785 +37
==========================================
+ Hits 7617 7719 +102
- Misses 2682 2699 +17
|
}, | ||
};`; | ||
} else { | ||
scriptContent = "DIDN'T GET SCRIPT CONTENT"; |
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.
note to self: Create a test for script retrieval failure.
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.
And failed requests with these scenarios:
"errors": [
{
"code": 100146,
"message": "workers.api.error.deployment_not_found"
}
],
"messages": []
"errors": [
{
"code": 100147,
"message": "workers.api.error.deployment_too_old"
}
],
"messages": []
"errors": [
{
"code": 100140,
"message": "Failed to rollback due to external resources being modified (durable-object:<tag>,r2:<name>)"
}
],
"messages": []
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.
Still TODO?
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.
Now that wrangler deployments
is starting to actually do stuff, (in a separate PR), can we move the handler and options into its own file or folder, like dev
, delete
, publish
, r2
, secret
, etc?
Adding general documentation for rollbacks & view on deployments. Including Rollbacks to deployments platform page. DEVX-285 & DEVX-284 related #cloudflare/workers-sdk#2607
0b33a7f
to
0cfd522
Compare
packages/wrangler/index.js
Outdated
export default { | ||
async fetch(request, env, ctx) { | ||
const { pathname } = new URL(request.url); | ||
if (pathname === "/setup") { | ||
await env.DB.exec( | ||
"CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, value TEXT);" | ||
); | ||
return new Response(null, { status: 204 }); | ||
} else if (pathname === "/query") { | ||
const rows = await env.DB.prepare("SELECT * FROM test;").all(); | ||
return Response.json(rows.results); | ||
} | ||
throw new Error("Not found!"); | ||
}, | ||
async scheduled(controller, env, ctx) { | ||
const stmt = await env.DB.prepare( | ||
"INSERT INTO test (id, value) VALUES (?, ?)" | ||
); | ||
await stmt.bind(1, "one").run(); | ||
}, | ||
}; |
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.
I removed it.
fb54aff
to
e18d0d4
Compare
}, | ||
};`; | ||
} else { | ||
scriptContent = "DIDN'T GET SCRIPT CONTENT"; |
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.
Still TODO?
a40064f
to
ff4a02f
Compare
deployments
deployments
d698ee6
to
5e605ae
Compare
f3dcc66
to
c157001
Compare
ae166d2
to
da6fc75
Compare
Added a positional in the 'Deployments' command <deployment-id>. <deployment-id> will get the details of the deployment, including versioned script, bindings, and usage model information. changeset added snapshot for commands updated removed stray quotes
Created a subcommand on deployments that allows for rolling back a deployment to a previous ID provided. Changed the command structure to have 2 subcommands view and rollback Improved the Changeset messaging and combined rollback Update help messages Added comfirmation prompt to Rollback Implemented --yes flag with tests Updated tests comfirmation handles non-TTY environments automatically fixed tests to reflect that and removed --yes option tests breaking in CI Turn off chalk in tests Update messaging with new copy for confirm prompt matching dashboard & removing the PUT response in output snapshots updated rollback accounts URL
# This is the 1st commit message: Update rollback fetch call and remove deployments request from publish # This is the commit message #2: destructure the one value we want from the result
destructure the one value we want from the result Have script upload msw always return response body Update deployment tests Fixed misc tests Delete index.js Added check for request on rollback tests Fix issue with wrangler version appearing after prompt
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
… specified (#2841) Co-authored-by: jjohnson <jjohnson@cloudflare.com>
* Add suggested changes and update wrangler docs * Separate content into option on view command --------- Co-authored-by: jjohnson <jjohnson@cloudflare.com>
* Add rollback reason * fixup: Cleanup hanging prompt mocks in deployments tests * Change structure for rollback commands --------- Co-authored-by: jjohnson <jjohnson@cloudflare.com> Co-authored-by: Samuel Macleod <smacleod@cloudflare.com>
da6fc75
to
d3292dc
Compare
Adding general documentation for rollbacks & view on deployments. Including Rollbacks to deployments platform page. DEVX-285 & DEVX-284 related #cloudflare/workers-sdk#2607
* Add general documentation for deployment rollbacks & view. Related to cloudflare/workers-sdk#2607 Co-authored-by: jjohnson <jjohnson@cloudflare.com> Co-authored-by: Adam Murray <admah@users.noreply.github.com> Co-authored-by: Kate Tungusova <70746074+deadlypants1973@users.noreply.github.com> Co-authored-by: lrapoport-cf <lrapoport@cloudflare.com>
view <deployment-id>
will get the details of a deployment, including versioned script, bindings, and usage model information.This information can be used to help debug bad deployments or get insights on changes between deployments.
rollback <deployment-id>
will rollback to a specific deployment in the runtime. This will be useful in situations like recovering from a baddeployment quickly while resolving issues. This rollback only changes the code in the runtime and doesn't affect any code or configurations
in a developer's local setup.
example of
view <deployment-id>
output:Reviewer has performed the following, where applicable:
Ticket: Internal