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: ...@@ -752,8 +752,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
...@@ -780,8 +779,7 @@ jobs: ...@@ -780,8 +779,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
...@@ -822,12 +820,11 @@ jobs: ...@@ -822,12 +820,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:
...@@ -856,8 +853,7 @@ jobs: ...@@ -856,8 +853,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
...@@ -888,8 +884,7 @@ jobs: ...@@ -888,8 +884,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
......
...@@ -142,6 +142,7 @@ env: ...@@ -142,6 +142,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 || '' }}
......
...@@ -153,7 +153,6 @@ jobs: ...@@ -153,7 +153,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'
...@@ -203,7 +202,6 @@ jobs: ...@@ -203,7 +202,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 +248,6 @@ jobs: ...@@ -250,7 +248,6 @@ jobs:
NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \ NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \
NEXT_TEST_VERSION="${{ needs.setup.outputs.next-version }}" \ NEXT_TEST_VERSION="${{ needs.setup.outputs.next-version }}" \
VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \ 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 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')
......
...@@ -304,7 +304,6 @@ async function main() { ...@@ -304,7 +304,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' },
}, },
}) })
...@@ -329,7 +328,7 @@ async function main() { ...@@ -329,7 +328,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,
......
...@@ -527,9 +527,15 @@ export class NextDeployInstance extends NextInstance { ...@@ -527,9 +527,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