Skip to content

Commit c05225f

Browse files
authored
cherry-pick(#17896): chore: make local docker build work on branch (#17906)
Branch does not pass `isDevelopmentMode` check because it does not have a version ending with `-next`. Therefore, `env.PWTEST_DOCKER_BASE_IMAGE` is ignored which leads to the pull of non-existent image.
1 parent 3f0af1e commit c05225f

File tree

1 file changed

+6
-7
lines changed
  • packages/playwright-core/src/containers

1 file changed

+6
-7
lines changed

packages/playwright-core/src/containers/docker.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ async function deletePlaywrightImage() {
7575
async function buildPlaywrightImage() {
7676
await checkDockerEngineIsRunningOrDie();
7777

78-
const isDevelopmentMode = getPlaywrightVersion().includes('next');
79-
let baseImageName = `mcr.microsoft.com/playwright:v${getPlaywrightVersion()}-${VRT_IMAGE_DISTRO}`;
8078
// 1. Build or pull base image.
81-
if (isDevelopmentMode) {
82-
// Use our docker build scripts in development mode!
83-
if (!process.env.PWTEST_DOCKER_BASE_IMAGE) {
79+
let baseImageName = process.env.PWTEST_DOCKER_BASE_IMAGE || '';
80+
if (!baseImageName) {
81+
const isDevelopmentMode = getPlaywrightVersion().includes('next');
82+
if (isDevelopmentMode) {
83+
// Use our docker build scripts in development mode!
8484
const arch = process.arch === 'arm64' ? '--arm64' : '--amd64';
8585
throw createStacklessError(utils.wrapInASCIIBox([
8686
`You are in DEVELOPMENT mode!`,
@@ -91,8 +91,7 @@ async function buildPlaywrightImage() {
9191
` PWTEST_DOCKER_BASE_IMAGE=playwright:localbuild npx playwright docker build`,
9292
].join('\n'), 1));
9393
}
94-
baseImageName = process.env.PWTEST_DOCKER_BASE_IMAGE;
95-
} else {
94+
baseImageName = `mcr.microsoft.com/playwright:v${getPlaywrightVersion()}-${VRT_IMAGE_DISTRO}`;
9695
const { code } = await spawnAsync('docker', ['pull', baseImageName], { stdio: 'inherit' });
9796
if (code !== 0)
9897
throw new Error('Failed to pull docker image!');

0 commit comments

Comments
 (0)