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

Add message to rollback and restructre rollback commands #2888

Merged

Conversation

jspspike
Copy link
Contributor

@jspspike jspspike commented Mar 9, 2023

Author has included the following, where applicable:

  • Tests
  • Changeset

Reviewer has performed the following, where applicable:

  • Checked for inclusion of relevant tests
  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

Fixes # [insert issue number].

@jspspike jspspike requested a review from a team as a code owner March 9, 2023 23:55
@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2023

⚠️ No Changeset found

Latest commit: 5e723ad

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 changesets to release 1 package
Name Type
wrangler Minor

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

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/4408441889/npm-package-wrangler-2888

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

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

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4408441889/npm-package-wrangler-2888 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/4408441889/npm-package-cloudflare-pages-shared-2888

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

@codecov
Copy link

codecov bot commented Mar 10, 2023

Codecov Report

❗ No coverage uploaded for pull request base (jacobmgevans/deployment-view-rollback@302dcf3). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@                           Coverage Diff                            @@
##             jacobmgevans/deployment-view-rollback    #2888   +/-   ##
========================================================================
  Coverage                                         ?   74.22%           
========================================================================
  Files                                            ?      166           
  Lines                                            ?    10346           
  Branches                                         ?     2776           
========================================================================
  Hits                                             ?     7679           
  Misses                                           ?     2667           
  Partials                                         ?        0           

@lrapoport-cf
Copy link
Contributor

lrapoport-cf commented Mar 10, 2023

hey @jspspike , a couple things to address from a functionality perspective:

  • supplying the --message to wrangler rollback should cause a bypass of the interactive prompts. currently this doesn't seem to happen.

  • where do we actually enforce character limit for the message? i am able to provide a message longer than 280 chars, which is currently specified as the limit. i made notes where we need to change to say the limit is 120, but we also need to update the actual functionality to limit to 120

  • wrangler deployments view should show metadata for most recent deployment, but it looks like there's an indexing issue because it's showing data for not the most recent (see example image below)
    image

  • similarly to the point above, wrangler rollback should cause a roll back to the last deployment, but the rollback is instead happening for some other deployment (see example image below)
    image

  • the output from wrangler deployments list should include the contents of the message annotation (i know this may currently be missing because changes aren't merged in the backend yet to support, but i'm noting this here to make sure to double check)

@jspspike
Copy link
Contributor Author

@lrapoport-cf

supplying the --message to wrangler rollback should cause a bypass of the interactive prompts. currently this doesn't seem to happen.

This is a bug, will fix this

where do we actually enforce character limit for the message? i am able to provide a message longer than 280 chars, which is currently specified as the limit. i made notes where we need to change to say the limit is 120, but we also need to update the actual functionality to limit to 120

he output from wrangler deployments list should include the contents of the message annotation (i know this may currently be missing because changes aren't merged in the backend yet to support, but i'm noting this here to make sure to double check)

Both of these are done in the backend, I will change the limit to 120 and check once the backend changes are in

wrangler deployments view should show metadata for most recent deployment, but it looks like there's an indexing issue because it's showing data for not the most recent (see example image below)

Looking into this there's a bug in the backend logic for choosing the latest, I will put up a PR for this

similarly to the point above, wrangler rollback should cause a roll back to the last deployment, but the rollback is instead happening for some other deployment (see example image below)

This is working as intended, if you're rolling back you wouldn't want to rollback to the latest deployment (this would do nothing since it's already the active deployment). You would want to rollback to the previous deployment, or the second latest deployment

@JacobMGEvans
Copy link
Contributor

This is working as intended, if you're rolling back you wouldn't want to rollback to the latest deployment (this would do nothing since it's already the active deployment). You would want to rollback to the previous deployment, or the second latest deployment

This I agree with, the view is definitely "latest" but the default for rollback would be "previous" to the "latest"

@lrapoport-cf
Copy link
Contributor

This is working as intended, if you're rolling back you wouldn't want to rollback to the latest deployment (this would do nothing since it's already the active deployment). You would want to rollback to the previous deployment, or the second latest deployment

This I agree with, the view is definitely "latest" but the default for rollback would be "previous" to the "latest"

@jspspike @JacobMGEvans oh yes you're totally right, my bad!

@lrapoport-cf
Copy link
Contributor

supplying the --message to wrangler rollback should cause a bypass of the interactive prompts. currently this doesn't seem to happen.

This is a bug, will fix this

@jspspike thanks for fixing this! one more small adjustment: if you do wrangler rollback --message " " you can bypass the prompt but empty string i.e. wrangler rollback --message "" still asks for a prompt. can you change so that this also causes the bypass?

Copy link
Contributor

@JacobMGEvans JacobMGEvans left a comment

Choose a reason for hiding this comment

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

Tentatively approved, based on @lrapoport-cf comments and functionality is resolved.

@lrapoport-cf
Copy link
Contributor

@jspspike this is looking great, thank you for addressing all the items! one last thing i noticed: on wrangler deployments view, the message field content isn't properly left-aligned with the other fields (see image below). can we fix the alignment? other than that, lgtm!

image

@lrapoport-cf
Copy link
Contributor

@jspspike sorry, just noticed this as well:
image

there's a mismatch between the command and the warning. can you please update to say "wrangler rollback is a beta command"?

@lrapoport-cf lrapoport-cf self-requested a review March 13, 2023 18:27
@jspspike jspspike merged commit 5a4f664 into jacobmgevans/deployment-view-rollback Mar 13, 2023
@jspspike jspspike deleted the jspspike/rollback-reason branch March 13, 2023 18:58
jspspike added a commit that referenced this pull request Mar 13, 2023
* 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>
jspspike added a commit that referenced this pull request Mar 15, 2023
* 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>
jspspike added a commit that referenced this pull request Mar 16, 2023
* 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>
jspspike added a commit that referenced this pull request Mar 16, 2023
* Deployment Details
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

* Deployment Rollbacks
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 a combination of 2 commits.
# 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

* Update rollback fetch call and remove deployments request from publish

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

* Fix `next(param)` in Pages Plugins (#2789)

* Add duplex to r2 put (#2793)

* Add changeset (#2795)

* Version Packages (#2791)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Add hyphens to all deployment ids

* Merge

* Automatically rollback to previous deployment if deployment id is not specified (#2841)

Co-authored-by: jjohnson <jjohnson@cloudflare.com>

* Have deployment view output in table (#2844)

* Add suggested changes and update wrangler docs

* Separate content into option on view command

---------

Co-authored-by: jjohnson <jjohnson@cloudflare.com>

* Add message to rollback and restructre rollback commands (#2888)

* 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>

* Remove showing script content in deployment view

---------

Co-authored-by: jjohnson <jjohnson@cloudflare.com>
Co-authored-by: Greg Brimble <gbrimble@cloudflare.com>
Co-authored-by: Somhairle MacLeòid <smacleod@cloudflare.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joshua Johnson <jspspike@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants