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

[lts-active][ci] Wire preview builds variables consistently (#99324)

Backports https://github.com/vercel/next.js/pull/99323

## test plan

- [x] [test_e2e_deploy_release
run](https://github.com/vercel/next.js/actions/runs/36347196988)
Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
parent b0fad0d4
......@@ -752,8 +752,7 @@ jobs:
node scripts/test-new-tests.mjs \
--flake-detection \
--mode dev \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ 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
......@@ -780,8 +779,7 @@ jobs:
node scripts/test-new-tests.mjs \
--flake-detection \
--mode start \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ 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
secrets: inherit
......@@ -822,12 +820,11 @@ jobs:
- name: Wait for preview tarball
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 }}
run: |
set -euo pipefail
node scripts/wait-for-preview-tarball.mjs \
--preview-builds-base-url "$PREVIEW_BUILDS_BASE_URL" \
--timeout-minutes 30
test-new-tests-deploy:
......@@ -856,8 +853,7 @@ jobs:
export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ matrix.group }}
stepName: 'test-new-tests-deploy-${{matrix.group}}'
secrets: inherit
......@@ -888,8 +884,7 @@ jobs:
export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ matrix.group }}
stepName: 'test-new-tests-deploy-cache-components-${{matrix.group}}'
secrets: inherit
......
......@@ -142,6 +142,7 @@ env:
VERCEL_TURBOPACK_TEST_TOKEN: ${{ secrets.VERCEL_TURBOPACK_TEST_TOKEN }}
VERCEL_TURBOPACK_TEST_TEAM: vtest314-next-turbo-e2e-tests
PREVIEW_BUILDS_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }}
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: ${{ vars.PREVIEW_BUILDS_BASE_URL }}
NEXT_TEST_PREFER_OFFLINE: 1
NEXT_CI_RUNNER: ${{ inputs.runs_on_labels }}
NEXT_TEST_PROXY_ADDRESS: ${{ inputs.overrideProxyAddress || '' }}
......
......@@ -153,7 +153,6 @@ jobs:
NEXT_TEST_DEPLOY_SCRIPT_PATH="${{ github.event.inputs.deployScriptPath || '' }}" \
NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH="${{ github.event.inputs.deployLogsScriptPath || '' }}" \
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
testTimingsArtifact: 'test-timings'
skipNativeBuild: 'yes'
......@@ -203,7 +202,6 @@ jobs:
NEXT_TEST_DEPLOY_SCRIPT_PATH="${{ github.event.inputs.deployScriptPath || '' }}" \
NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH="${{ github.event.inputs.deployLogsScriptPath || '' }}" \
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
testTimingsArtifact: 'test-timings'
skipNativeBuild: 'yes'
......@@ -250,7 +248,6 @@ jobs:
NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \
NEXT_TEST_VERSION="${{ needs.setup.outputs.next-version }}" \
VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \
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
testTimingsArtifact: 'test-timings'
skipNativeBuild: 'yes'
......
......@@ -19,15 +19,14 @@ async function main() {
const argv = await yargs(process.argv.slice(2))
.string('mode')
.string('group')
.string('preview-builds-base-url')
.boolean('flake-detection').argv
const testMode = argv.mode
const isFlakeDetectionMode = argv['flake-detection']
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.
const previewBuildsBaseUrl = argv['preview-builds-base-url']
const previewBuildsBaseUrl = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL
if (testMode && !['dev', 'deploy', 'start'].includes(testMode)) {
throw new Error(
......@@ -142,7 +141,6 @@ async function main() {
...process.env,
NEXT_TEST_MODE: testMode,
NEXT_TEST_VERSION: nextTestVersion,
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: previewBuildsBaseUrl,
NEXT_EXTERNAL_TESTS_FILTERS,
NEXT_FLAKE_DETECTION: '1',
IS_TURBOPACK_TEST: '1',
......@@ -163,7 +161,6 @@ async function main() {
NEXT_EXTERNAL_TESTS_FILTERS,
NEXT_TEST_MODE: testMode,
NEXT_TEST_VERSION: nextTestVersion,
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: previewBuildsBaseUrl,
TURBOPACK_BUILD:
process.env.IS_TURBOPACK_TEST &&
(testMode === 'start' || testMode === 'deploy')
......
......@@ -304,7 +304,6 @@ async function main() {
const { values } = parseArgs({
options: {
'commit-sha': { type: 'string' },
'preview-builds-base-url': { type: 'string' },
'timeout-minutes': { type: 'string' },
},
})
......@@ -329,7 +328,7 @@ async function main() {
await waitForPreviewTarball({
commitSha,
previewBuildsBaseUrl: values['preview-builds-base-url'],
previewBuildsBaseUrl: process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL,
timeoutMs: timeoutMinutes * 60_000,
getReadToken: createPreviewBuildsReadTokenGetter(),
})
......
import { nextTestSetup } from 'e2e-utils'
// increment to trigger deploy tests: v1
describe('hello-world', () => {
const { next } = nextTestSetup({
files: __dirname,
......
......@@ -527,9 +527,15 @@ export class NextDeployInstance extends NextInstance {
const baseUrlRaw = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL
const access = process.env.PREVIEW_BUILDS_ACCESS
if (!baseUrlRaw || access !== 'private') {
if (access !== 'private') {
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
}
......
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