Re-query deploy-test build logs until id markers appear (#95243)
Deploy tests recover the `BUILD_ID`, `DEPLOYMENT_ID` and `NEXT_SUPPORTS_IMMUTABLE_ASSETS` values by scraping them out of the deployment's build logs, where the test fixture's `post-build` script prints them as the final lines of the build. We fetch those logs with `vercel inspect --logs` after `vercel deploy` returns, but a deployment can report `Ready` before its full build-log tail has propagated to the log query API, so a single call sometimes returns a truncated prefix that stops before the markers. When that happens `parseIdsFromCliOuput` throws "Failed to get buildId from logs" and fails the whole suite during setup, which is the intermittent failure we have been seeing across the deploy jobs. This change wraps the log fetch in `fetchBuildLogsUntilComplete`, which re-queries `vercel inspect --logs` until the last-printed marker (`NEXT_SUPPORTS_IMMUTABLE_ASSETS`) appears before parsing, bounded to twenty attempts three seconds apart. Gating on the final marker rather than the first ensures a partial read cannot slip past the loop into the parser. Streaming the logs from `vercel deploy --logs` as part of the deploy itself was considered, but it has the same race: the CLI stops streaming once the deployment reports `Ready`, before the `post-build` tail flushes, and a single stream cannot re-query for the missing lines.
Showing
Please
register
or
sign in
to comment