Unverified Commit 5e097685 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[ci] Wire preview builds variables consistently (#99323)

`build_reusable.yml` now defines `NEXT_TEST_PREVIEW_BUILDS_BASE_URL`
next to `PREVIEW_BUILDS_ACCESS`, so every test job inherits both via
`process.env` instead of relying on per-call-site threading. The same
class of gap on next-15-5 broke private-preview deploy tests in the
mirror with an E401 ([failing
run](https://github.com/vercel/next-js-mirror/actions/runs/36334147525/job/108664261165)).

## test plan

- [x] [test_e2e_deploy_release
run](https://github.com/vercel/next.js/actions/runs/36347194442)
Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
parent 5baba818
...@@ -814,8 +814,7 @@ jobs: ...@@ -814,8 +814,7 @@ jobs:
node scripts/test-new-tests.mjs \ node scripts/test-new-tests.mjs \
--flake-detection \ --flake-detection \
--mode dev \ --mode dev \
--group ${{ matrix.group }} \ --group ${{ matrix.group }}
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-dev-${{matrix.group}}' stepName: 'test-new-tests-dev-${{matrix.group}}'
timeout_minutes: 120 # Increase the default timeout as tests are intentionally run multiple times to detect flakes timeout_minutes: 120 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
...@@ -841,8 +840,7 @@ jobs: ...@@ -841,8 +840,7 @@ jobs:
node scripts/test-new-tests.mjs \ node scripts/test-new-tests.mjs \
--flake-detection \ --flake-detection \
--mode start \ --mode start \
--group ${{ matrix.group }} \ --group ${{ matrix.group }}
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-start-${{matrix.group}}' stepName: 'test-new-tests-start-${{matrix.group}}'
timeout_minutes: 120 # Increase the default timeout as tests are intentionally run multiple times to detect flakes timeout_minutes: 120 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
secrets: inherit secrets: inherit
...@@ -883,12 +881,11 @@ jobs: ...@@ -883,12 +881,11 @@ jobs:
- name: Wait for preview tarball - name: Wait for preview tarball
env: env:
PREVIEW_BUILDS_BASE_URL: ${{ vars.PREVIEW_BUILDS_BASE_URL }} NEXT_TEST_PREVIEW_BUILDS_BASE_URL: ${{ vars.PREVIEW_BUILDS_BASE_URL }}
PREVIEW_BUILDS_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }} PREVIEW_BUILDS_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }}
run: | run: |
set -euo pipefail set -euo pipefail
node scripts/wait-for-preview-tarball.mjs \ node scripts/wait-for-preview-tarball.mjs \
--preview-builds-base-url "$PREVIEW_BUILDS_BASE_URL" \
--timeout-minutes 30 --timeout-minutes 30
test-new-tests-deploy: test-new-tests-deploy:
...@@ -916,8 +913,7 @@ jobs: ...@@ -916,8 +913,7 @@ jobs:
export IS_TURBOPACK_TEST=1 export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \ node scripts/test-new-tests.mjs \
--mode deploy \ --mode deploy \
--group ${{ matrix.group }} \ --group ${{ matrix.group }}
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-deploy-${{matrix.group}}' stepName: 'test-new-tests-deploy-${{matrix.group}}'
secrets: inherit secrets: inherit
...@@ -948,8 +944,7 @@ jobs: ...@@ -948,8 +944,7 @@ jobs:
export IS_TURBOPACK_TEST=1 export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \ node scripts/test-new-tests.mjs \
--mode deploy \ --mode deploy \
--group ${{ matrix.group }} \ --group ${{ matrix.group }}
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-deploy-cache-components-${{matrix.group}}' stepName: 'test-new-tests-deploy-cache-components-${{matrix.group}}'
secrets: inherit secrets: inherit
......
...@@ -151,6 +151,7 @@ env: ...@@ -151,6 +151,7 @@ env:
VERCEL_TURBOPACK_TEST_TOKEN: ${{ secrets.VERCEL_TURBOPACK_TEST_TOKEN }} VERCEL_TURBOPACK_TEST_TOKEN: ${{ secrets.VERCEL_TURBOPACK_TEST_TOKEN }}
VERCEL_TURBOPACK_TEST_TEAM: vtest314-next-turbo-e2e-tests VERCEL_TURBOPACK_TEST_TEAM: vtest314-next-turbo-e2e-tests
PREVIEW_BUILDS_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }} PREVIEW_BUILDS_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }}
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: ${{ vars.PREVIEW_BUILDS_BASE_URL }}
NEXT_TEST_PREFER_OFFLINE: 1 NEXT_TEST_PREFER_OFFLINE: 1
NEXT_CI_RUNNER: ${{ inputs.runs_on_labels }} NEXT_CI_RUNNER: ${{ inputs.runs_on_labels }}
NEXT_TEST_PROXY_ADDRESS: ${{ inputs.overrideProxyAddress || '' }} NEXT_TEST_PROXY_ADDRESS: ${{ inputs.overrideProxyAddress || '' }}
......
...@@ -198,7 +198,6 @@ jobs: ...@@ -198,7 +198,6 @@ jobs:
NEXT_TEST_DEPLOY_SCRIPT_PATH="${{ github.event.inputs.deployScriptPath || '' }}" \ NEXT_TEST_DEPLOY_SCRIPT_PATH="${{ github.event.inputs.deployScriptPath || '' }}" \
NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH="${{ github.event.inputs.deployLogsScriptPath || '' }}" \ NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH="${{ github.event.inputs.deployLogsScriptPath || '' }}" \
NEXT_TEST_CLEANUP_SCRIPT_PATH="${{ github.event.inputs.cleanupScriptPath || '' }}" \ NEXT_TEST_CLEANUP_SCRIPT_PATH="${{ github.event.inputs.cleanupScriptPath || '' }}" \
NEXT_TEST_PREVIEW_BUILDS_BASE_URL="${{ vars.PREVIEW_BUILDS_BASE_URL }}" \
node run-tests.js --timings --require-timings -g ${{ matrix.group }} -c 2 --type e2e node run-tests.js --timings --require-timings -g ${{ matrix.group }} -c 2 --type e2e
testTimingsArtifact: 'test-timings' testTimingsArtifact: 'test-timings'
skipNativeBuild: 'yes' skipNativeBuild: 'yes'
...@@ -250,7 +249,6 @@ jobs: ...@@ -250,7 +249,6 @@ jobs:
NEXT_TEST_DEPLOY_SCRIPT_PATH="${{ github.event.inputs.deployScriptPath || '' }}" \ NEXT_TEST_DEPLOY_SCRIPT_PATH="${{ github.event.inputs.deployScriptPath || '' }}" \
NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH="${{ github.event.inputs.deployLogsScriptPath || '' }}" \ NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH="${{ github.event.inputs.deployLogsScriptPath || '' }}" \
NEXT_TEST_CLEANUP_SCRIPT_PATH="${{ github.event.inputs.cleanupScriptPath || '' }}" \ NEXT_TEST_CLEANUP_SCRIPT_PATH="${{ github.event.inputs.cleanupScriptPath || '' }}" \
NEXT_TEST_PREVIEW_BUILDS_BASE_URL="${{ vars.PREVIEW_BUILDS_BASE_URL }}" \
node run-tests.js --timings --require-timings -g ${{ matrix.group }} -c 2 --type e2e node run-tests.js --timings --require-timings -g ${{ matrix.group }} -c 2 --type e2e
testTimingsArtifact: 'test-timings' testTimingsArtifact: 'test-timings'
skipNativeBuild: 'yes' skipNativeBuild: 'yes'
...@@ -299,7 +297,6 @@ jobs: ...@@ -299,7 +297,6 @@ jobs:
VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \ VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \
VERCEL_FORCE_BUILD_IN_HIVE="${{ github.event.inputs.forceBuildInHive || '' }}" \ VERCEL_FORCE_BUILD_IN_HIVE="${{ github.event.inputs.forceBuildInHive || '' }}" \
VERCEL_BUILD_CONTAINER_VERSION="${{ github.event.inputs.buildContainerVersion || '' }}" \ VERCEL_BUILD_CONTAINER_VERSION="${{ github.event.inputs.buildContainerVersion || '' }}" \
NEXT_TEST_PREVIEW_BUILDS_BASE_URL="${{ vars.PREVIEW_BUILDS_BASE_URL }}" \
node run-tests.js --timings --require-timings -g ${{ matrix.group }} -c 2 --type e2e node run-tests.js --timings --require-timings -g ${{ matrix.group }} -c 2 --type e2e
testTimingsArtifact: 'test-timings' testTimingsArtifact: 'test-timings'
skipNativeBuild: 'yes' skipNativeBuild: 'yes'
......
...@@ -19,15 +19,14 @@ async function main() { ...@@ -19,15 +19,14 @@ async function main() {
const argv = await yargs(process.argv.slice(2)) const argv = await yargs(process.argv.slice(2))
.string('mode') .string('mode')
.string('group') .string('group')
.string('preview-builds-base-url')
.boolean('flake-detection').argv .boolean('flake-detection').argv
const testMode = argv.mode const testMode = argv.mode
const isFlakeDetectionMode = argv['flake-detection'] const isFlakeDetectionMode = argv['flake-detection']
const attempts = isFlakeDetectionMode ? 3 : 1 const attempts = isFlakeDetectionMode ? 3 : 1
// Left unset when the workflow passes an empty value, so that // Left unset when the env var is not set, so that
// wait-for-preview-tarball.mjs owns the default. // wait-for-preview-tarball.mjs owns the default.
const previewBuildsBaseUrl = argv['preview-builds-base-url'] const previewBuildsBaseUrl = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL
if (testMode && !['dev', 'deploy', 'start'].includes(testMode)) { if (testMode && !['dev', 'deploy', 'start'].includes(testMode)) {
throw new Error( throw new Error(
...@@ -142,7 +141,6 @@ async function main() { ...@@ -142,7 +141,6 @@ async function main() {
...process.env, ...process.env,
NEXT_TEST_MODE: testMode, NEXT_TEST_MODE: testMode,
NEXT_TEST_VERSION: nextTestVersion, NEXT_TEST_VERSION: nextTestVersion,
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: previewBuildsBaseUrl,
NEXT_EXTERNAL_TESTS_FILTERS, NEXT_EXTERNAL_TESTS_FILTERS,
NEXT_FLAKE_DETECTION: '1', NEXT_FLAKE_DETECTION: '1',
IS_TURBOPACK_TEST: '1', IS_TURBOPACK_TEST: '1',
...@@ -163,7 +161,6 @@ async function main() { ...@@ -163,7 +161,6 @@ async function main() {
NEXT_EXTERNAL_TESTS_FILTERS, NEXT_EXTERNAL_TESTS_FILTERS,
NEXT_TEST_MODE: testMode, NEXT_TEST_MODE: testMode,
NEXT_TEST_VERSION: nextTestVersion, NEXT_TEST_VERSION: nextTestVersion,
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: previewBuildsBaseUrl,
TURBOPACK_BUILD: TURBOPACK_BUILD:
process.env.IS_TURBOPACK_TEST && process.env.IS_TURBOPACK_TEST &&
(testMode === 'start' || testMode === 'deploy') (testMode === 'start' || testMode === 'deploy')
......
...@@ -328,7 +328,6 @@ async function main() { ...@@ -328,7 +328,6 @@ async function main() {
const { values } = parseArgs({ const { values } = parseArgs({
options: { options: {
'commit-sha': { type: 'string' }, 'commit-sha': { type: 'string' },
'preview-builds-base-url': { type: 'string' },
'timeout-minutes': { type: 'string' }, 'timeout-minutes': { type: 'string' },
}, },
}) })
...@@ -353,7 +352,7 @@ async function main() { ...@@ -353,7 +352,7 @@ async function main() {
await waitForPreviewTarball({ await waitForPreviewTarball({
commitSha, commitSha,
previewBuildsBaseUrl: values['preview-builds-base-url'], previewBuildsBaseUrl: process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL,
timeoutMs: timeoutMinutes * 60_000, timeoutMs: timeoutMinutes * 60_000,
getReadToken: createPreviewBuildsReadTokenGetter(), getReadToken: createPreviewBuildsReadTokenGetter(),
}) })
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
// increment to trigger deploy tests: v1
describe('hello-world', () => { describe('hello-world', () => {
const { next } = nextTestSetup({ const { next } = nextTestSetup({
files: __dirname, files: __dirname,
......
...@@ -860,9 +860,15 @@ export class NextDeployInstance extends NextInstance { ...@@ -860,9 +860,15 @@ export class NextDeployInstance extends NextInstance {
const baseUrlRaw = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL const baseUrlRaw = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL
const access = process.env.PREVIEW_BUILDS_ACCESS const access = process.env.PREVIEW_BUILDS_ACCESS
if (!baseUrlRaw || access !== 'private') { if (access !== 'private') {
require('console').log( require('console').log(
`Skipping .npmrc write for preview-builds mirror: missing base URL or preview builds are public` `Skipping .npmrc write for preview-builds mirror: preview builds are public`
)
return
}
if (!baseUrlRaw) {
require('console').warn(
`Skipping .npmrc write for preview-builds mirror: PREVIEW_BUILDS_ACCESS=private but NEXT_TEST_PREVIEW_BUILDS_BASE_URL is not set, so the remote build cannot authenticate to the mirror`
) )
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment