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(cli): update CLI to use new deploy endpoint #7244

Merged
merged 14 commits into from
Aug 14, 2024
Merged

feat(cli): update CLI to use new deploy endpoint #7244

merged 14 commits into from
Aug 14, 2024

Conversation

ricokahler
Copy link
Contributor

@ricokahler ricokahler commented Jul 24, 2024

NOTE: This PR cannot be merged until the newer deployment service is in prod.

Description

This PR introduces several key changes to the Sanity CLI:

  1. New Deploy Endpoint: The CLI now uses a new endpoint for deploying Sanity Studios, aligning with the updated deployment infrastructure.
  2. Multiple studioHost Support: Projects can now have multiple studioHost configurations, allowing for multiple deployments under different hostnames. This is facilitated by the new studioHost option in the CLI configuration.
  3. Helper Functions Refactor: Functions such as getOrCreateUserApplication, createDeployment, deleteUserApplication, and others have been refactored and relocated to a separate helpers.ts file for better modularity and testability.
  4. (edit) Use of form-data lib + native fetch API client.request: I added an additional commit that utilizes the form-data library to re-enabling streaming of the tarball to the server instead of buffering all of it into memory.

These changes are part of the larger multi-deploy studio project, aiming to enhance the deployment capabilities and flexibility of the Sanity CLI.

What to review

  1. Configuration Changes: Review the addition of the studioHost configuration option in CliConfig.
  2. Deployment Flow: Ensure the new deploy and undeploy flows work correctly, including handling multiple studioHost values.
  3. Test Coverage: Check the new and updated tests for deployAction, undeployAction, and the functions in helpers.ts for adequate coverage and correctness.
  4. Code Quality: Review the refactoring in deployAction.ts and undeployAction.ts for adherence to best practices and consistency with the existing codebase.

Testing

Extensive unit tests have been added and updated to cover:

  • The new deploy and undeploy workflows, including handling of multiple studioHost configurations.
  • The new helper functions for managing user applications and deployments.
  • Edge cases, such as missing directories and error handling during the deployment process.

These tests ensure that the changes are robust and handle various scenarios correctly. Please refer to the new test files and sections within existing tests for detailed coverage.

Note, the new service is not in prod yet so these changes have not been tested e2e yet.

Notes for release

TBD

Copy link

vercel bot commented Jul 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 6:05pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 6:05pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 6:05pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 6:05pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 14, 2024 6:05pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Aug 14, 2024 6:05pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jul 24, 2024

Component Testing Report Updated Aug 14, 2024 6:11 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 44s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 37s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 2m 33s 1 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 43s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 48s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 15s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 8s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 25s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ❌ Failed (Inspect) 1m 24s 20 0 1
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 1m 47s 30 0 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 19s 3 0 0

Co-authored-by: Carolina Gonzalez <carolina.nicole.gonzalez@gmail.com>
@binoy14 binoy14 added this pull request to the merge queue Aug 14, 2024
Merged via the queue into next with commit 14ae5cb Aug 14, 2024
43 checks passed
@binoy14 binoy14 deleted the sdx-1424 branch August 14, 2024 18:20
cngonzalez added a commit that referenced this pull request Aug 20, 2024
* feat(cli): update CLI to use new deploy endpoint

* feat: restore streaming support

* refactor: use client to stream instead of fetch

* fix: use `urlType` for new API spec

* fix(cli): fixes issues with deploying to new endpoint

* fix(cli): fixes dependency issue

* fix(core): fixes issue with depedency in tests

* feat(cli): handle error statusCode from API

* fix(cli): don't create default apps on deploy

* feat(cli): add list of deployments on deploy

* test: fix and add tests for new changes

* fix: error handling and update copy

* chore(cli): update copy

Co-authored-by: Carolina Gonzalez <carolina.nicole.gonzalez@gmail.com>

* feat(cli): add message about adding studioHost to cliConfig on deploys (#7349)

Co-authored-by: Rune Botten <rbotten@gmail.com>

---------

Co-authored-by: Binoy Patel <me@binoy.io>
Co-authored-by: Carolina Gonzalez <carolina.nicole.gonzalez@gmail.com>
Co-authored-by: Carolina Gonzalez <carolina@sanity.io>
Co-authored-by: Rune Botten <rbotten@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.

3 participants