Files
vercel__next.js/scripts/run-e2e-test-project-reset.mjs
Sebastian "Sebbie" Silbermann d470d18941 [ci] Reset the turbopack deploy test project in the weekly cron (#96822)
The weekly `test-e2e-project-reset-cron` workflow never defined
`VERCEL_TURBOPACK_TEST_TEAM` or `VERCEL_TURBOPACK_TEST_TOKEN`, even
though `run-e2e-test-project-reset.mjs` iterates over all three deploy
test teams. Because `resetProject` defaulted `teamId` and `token` to the
base team, and a destructuring default fires on an explicit `undefined`,
the turbopack iteration silently resolved to `vtest314-next-e2e-tests`.

The cron has therefore been deleting and recreating the base team's
project twice per run while never resetting the turbopack team's
project, and reporting success throughout. This dates back to #89458,
which wired the env pair into `build_reusable.yml` and
`test_e2e_deploy_release.yml` but missed the cron.

This drops the defaults in favor of explicitly passing the team.
2026-08-07 11:57:11 +02:00

73 lines
1.9 KiB
JavaScript

import {
resetProject,
TEST_PROJECT_NAME,
TEST_TEAM_NAME,
ADAPTER_TEST_TEAM_NAME,
ADAPTER_TEST_TOKEN,
TURBOPACK_TEST_TEAM_NAME,
TURBOPACK_TEST_TOKEN,
TEST_TOKEN,
} from './reset-project.mjs'
/**
* Every team hosting a `TEST_PROJECT_NAME` project that deploy tests deploy
* into. Each entry records the environment variables it was read from, so that
* a failure can point at the variables to check rather than just reporting that
* some team could not be reset.
*/
const TEST_TEAMS = [
{
teamEnvVar: 'VERCEL_TEST_TEAM',
teamId: TEST_TEAM_NAME,
tokenEnvVar: 'VERCEL_TEST_TOKEN',
token: TEST_TOKEN,
},
{
teamEnvVar: 'VERCEL_ADAPTER_TEST_TEAM',
teamId: ADAPTER_TEST_TEAM_NAME,
tokenEnvVar: 'VERCEL_ADAPTER_TEST_TOKEN',
token: ADAPTER_TEST_TOKEN,
},
{
teamEnvVar: 'VERCEL_TURBOPACK_TEST_TEAM',
teamId: TURBOPACK_TEST_TEAM_NAME,
tokenEnvVar: 'VERCEL_TURBOPACK_TEST_TOKEN',
token: TURBOPACK_TEST_TOKEN,
},
]
async function main() {
let hadFailure = false
// Keep going after a failure so that one misconfigured or unreachable team
// does not stop the others from being reset. `resetProject` rejects an absent
// teamId or token itself, so this only has to say which variables to check.
for (const { teamEnvVar, teamId, tokenEnvVar, token } of TEST_TEAMS) {
try {
await resetProject({
projectName: TEST_PROJECT_NAME,
teamId,
token,
disableDeploymentProtection: true,
})
} catch (err) {
console.error(
new Error(
`Failed to reset the ${TEST_PROJECT_NAME} project for ${teamEnvVar}. Verify that ${teamEnvVar} and ${tokenEnvVar} are set correctly.`,
{ cause: err }
)
)
hadFailure = true
}
}
if (hadFailure) {
throw new Error(`resetting a project failed`)
}
}
main().catch((err) => {
console.error(err)
process.exit(1)
})