[cli] implements vc deploy --logs and vc inspect --logs#11672
Conversation
🦋 Changeset detectedLatest commit: 3f3b503 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 |
| const eventsRes = await client.fetch(eventsUrl, { | ||
| json: false, | ||
| signal: abortController?.signal, | ||
| }); |
There was a problem hiding this comment.
client.fetch() supports node-retry options, so this code may be refactored and not being wrapped in a retry call.
| client, | ||
| deployment.id, | ||
| { | ||
| mode: 'logs', |
There was a problem hiding this comment.
We don't use 'deploy' mode here (which triggers its own polling), because it's actually not working.
The API does not return the special "events" which are meant to controller polling.
I highly doubt it's working, and I would suggest we remove this mode parameter and the related code.
There was a problem hiding this comment.
Do we use the deploy anywhere?
fbf7f1b to
f2687f4
Compare
f2687f4 to
b778a32
Compare
b778a32 to
b812a90
Compare
b812a90 to
0e6fd6e
Compare
0e6fd6e to
a09198b
Compare
a09198b to
912badb
Compare
| client, | ||
| deployment.id, | ||
| { | ||
| mode: 'logs', |
There was a problem hiding this comment.
Do we use the deploy anywhere?
0621a61 to
222df32
Compare
222df32 to
3f3b503
Compare
| function exitCode(state: Deployment['readyState']) { | ||
| if (state === 'ERROR' || state === 'CANCELED') { | ||
| return 1; | ||
| } | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
Shouldn't this be returning 0 all the time if you don't want to change how status code is returned?
| return chalk.gray('UNKNOWN'); | ||
| function exitCode(state: Deployment['readyState']) { | ||
| if (state === 'ERROR' || state === 'CANCELED') { | ||
| return 1; |
There was a problem hiding this comment.
This is a change, but I think it makes sense.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @vercel/build-utils@8.3.0 ### Minor Changes - Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](#11653)) Implements the diagnostics step in the `next` builder. ### Patch Changes - Add resolved node version range to warning message ([#11742](#11742)) ## vercel@34.3.0 ### Minor Changes - introduce --logs flag for deploy and inspect command to display build logs ([#11672](#11672)) - Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](#11653)) Implements the diagnostics step in the `next` builder. ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5), [`77836e3c3`](77836e3), [`11d0a32d8`](11d0a32)]: - @vercel/build-utils@8.3.0 - @vercel/next@4.3.0 - @vercel/remix-builder@2.1.9 - @vercel/redwood@2.1.0 - @vercel/node@3.2.1 - @vercel/static-build@2.5.12 ## @vercel/next@4.3.0 ### Minor Changes - Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](#11653)) Implements the diagnostics step in the `next` builder. ## @vercel/redwood@2.1.0 ### Minor Changes - Add support for API endpoint configuration via `export const config` syntax ([#11776](#11776)) ## @vercel/client@13.2.10 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 ## @vercel/frameworks@3.0.3 ### Patch Changes - Update SvelteKit v1 devCommand ([#11494](#11494)) ## @vercel/fs-detectors@5.2.5 ### Patch Changes - Updated dependencies \[[`1484df7aa`](1484df7)]: - @vercel/frameworks@3.0.3 ## @vercel/gatsby-plugin-vercel-builder@2.0.34 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 ## @vercel/node@3.2.1 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 ## @vercel/remix-builder@2.1.9 ### Patch Changes - Update `@remix-run/dev` fork to v2.10.0 ([#11771](#11771)) ## @vercel/static-build@2.5.12 ### Patch Changes - Updated dependencies \[]: - @vercel/gatsby-plugin-vercel-builder@2.0.34 ## @vercel-internals/types@1.0.39 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @vercel/build-utils@8.3.0 ### Minor Changes - Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](#11653)) Implements the diagnostics step in the `next` builder. ### Patch Changes - Add resolved node version range to warning message ([#11742](#11742)) ## vercel@34.3.0 ### Minor Changes - introduce --logs flag for deploy and inspect command to display build logs ([#11672](#11672)) - Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](#11653)) Implements the diagnostics step in the `next` builder. ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5), [`77836e3c3`](77836e3), [`11d0a32d8`](11d0a32)]: - @vercel/build-utils@8.3.0 - @vercel/next@4.3.0 - @vercel/remix-builder@2.1.9 - @vercel/redwood@2.1.0 - @vercel/node@3.2.1 - @vercel/static-build@2.5.12 ## @vercel/next@4.3.0 ### Minor Changes - Adds the ability for builders to define a `diagnostics` step that is called after the build operation is done. ([#11653](#11653)) Implements the diagnostics step in the `next` builder. ## @vercel/redwood@2.1.0 ### Minor Changes - Add support for API endpoint configuration via `export const config` syntax ([#11776](#11776)) ## @vercel/client@13.2.10 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 ## @vercel/frameworks@3.0.3 ### Patch Changes - Update SvelteKit v1 devCommand ([#11494](#11494)) ## @vercel/fs-detectors@5.2.5 ### Patch Changes - Updated dependencies \[[`1484df7aa`](1484df7)]: - @vercel/frameworks@3.0.3 ## @vercel/gatsby-plugin-vercel-builder@2.0.34 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 ## @vercel/node@3.2.1 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 ## @vercel/remix-builder@2.1.9 ### Patch Changes - Update `@remix-run/dev` fork to v2.10.0 ([#11771](#11771)) ## @vercel/static-build@2.5.12 ### Patch Changes - Updated dependencies \[]: - @vercel/gatsby-plugin-vercel-builder@2.0.34 ## @vercel-internals/types@1.0.39 ### Patch Changes - Updated dependencies \[[`394eddb2a`](394eddb), [`b9d18c583`](b9d18c5)]: - @vercel/build-utils@8.3.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
🧐 What's in there?
This is the first part of distinguishing build logs from runtime logs.
The proposal is to provide:
vc deploy --logs: in addition to deploying the application, it should tail and display the build logs until the build finishes.vc inspect --logs: instead of retuning a summary of the builds, it reads the build logsvc inspect --logs --wait: when the build is in progress, tails the build logs until the configured timeout (3m by default), or display all available logs when the build is finished.vc logs: read the runtime logs (not part of this PR, breaking change)🧪 How to test?
Given a local application location in
xyzfolder, already linked to a vercel project:pnpm -F vercel dev deploy --cwd xyz --logsto deploy and see build logspnpm -F vercel dev deploy --cwd xyzto deploy and see spinners insteadpnpm -F vercel dev inspect --cwd xyz dpl_ID/url --logsto see build logs of an existing deploymentpnpm -F vercel dev inspect --cwd xyz dpl_ID/urlto see an existing deployment detailspnpm -F vercel dev inspect --cwd xyz dpl_ID/url --logs --waitto see build logs of an existing deployment (better if in progress)pnpm -F vercel dev inspect --cwd xyz dpl_ID/url --logs --wait --timeout 5sto see build logs of an existing deployment (better if in progress) and bail after 5 secondsUnit tests added:
pnpm -F vercel exec vitest run /inspect.testpnpm -F vercel exec vitest run /deploy.test❗ Notes to reviewers
It's better to omit whitespace changes when reviewing
packages/cli/src/util/events.tssince most of the code was enclosed in a try-catch.