From bdf08e146108272d43a21ae72dd6ab16cefc449d Mon Sep 17 00:00:00 2001 From: Daniel Bennett Date: Thu, 25 Sep 2025 13:02:49 -0400 Subject: [PATCH] e2e: ui: fix playwright tag once and for all (#26840) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I don't ever want to see this error again: ``` Error: browserType.launch: Executable doesn't exist at /ms-playwright/chromium_headless_shell-1193/chrome-linux/headless_shell ╔══════════════════════════════════════════════════════════════════════╗ ║ Looks like Playwright Test or Playwright was just updated to 1.55.1. ║ ║ Please update docker image as well. ║ ║ - current: mcr.microsoft.com/playwright:v1.55.0-jammy ║ ║ - required: mcr.microsoft.com/playwright:v1.55.1-jammy ║ ║ ║ ║ <3 Playwright Team ║ ╚══════════════════════════════════════════════════════════════════════╝ at global-setup.js:20 18 | } 19 | > 20 | const browser = await chromium.launch(); | ^ 21 | const context = await browser.newContext({ ignoreHTTPSErrors: true }); 22 | const page = await context.newPage(); 23 | await page.goto(NOMAD_ADDR+'/ui/settings/tokens'); at module.exports (/src/global-setup.js:20:34) ``` I'm sure this will be the end of it! --- e2e/ui/run.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/e2e/ui/run.sh b/e2e/ui/run.sh index 04f8ffe75..8ab00f921 100755 --- a/e2e/ui/run.sh +++ b/e2e/ui/run.sh @@ -33,9 +33,22 @@ EOF } -IMAGE="mcr.microsoft.com/playwright:v1.55.0-jammy" pushd $(dirname "${BASH_SOURCE[0]}") > /dev/null +IMAGE="mcr.microsoft.com/playwright" +# since playwright looks for latest browser(s), +# it will throw an error in non-latest containers. +# so, instead of constantly changing the image +# tag manually, pull it from the registry API. +get_image_tag() { + 1>&2 echo 'detecting playwright image tag' + local os='noble' + curl -sS 'https://mcr.microsoft.com/api/v1/catalog/playwright/tags?reg=mar' \ + | jq -r '[ .[].name | select(match("^v.*-jammy$")) ] | last ' + # '[ ..query.. ] | last' gets the bottom one in the api response + # that matches the regex. the api returns them sorted oldest to newest. +} + run_tests() { run bash script.sh $@ } @@ -47,6 +60,12 @@ run_shell() { run() { local tty_args='' [ -t 1 ] && tty_args='-it' + local tag="$(get_image_tag)" + if [ -z "$tag" ]; then + echo 'failed to detect docker image tag' + return 1 + fi + echo "got playwright tag '$tag'" docker run $tty_args --rm \ -v $(pwd):/src \ -w /src \ @@ -54,8 +73,8 @@ run() { -e NOMAD_TOKEN=$NOMAD_TOKEN \ --ipc=host \ --net=host \ - "$IMAGE" \ - $@ + "$IMAGE:$tag" \ + "$@" } run_proxy() {