-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: 'latest' tag is pointing to "v1.46.1-jammy" docker image #32483
Comments
We strongly recommend pinning to a versioned tag, e.g. in your case:
using |
The Docker image is used to run the tests in GitHub CI. I have Dependabot configured to update NPM packages including playwright automatically. While it would be ideal to have the image used by CI match the version from the NPM package, this would currently mean manually edit the image tag every time Dependabot opens a PR to update the playwright packages. |
Having a hardcoded version on one hand means the stability of the executed code and on the other hand, users might miss to update once the new version is released and not being able to use new features w/o additional update of the tags in 2 places |
I agree with the advice to use specific version tags for Docker images. It is true that it does lead to a bit of pain to keep the Docker image version in sync with the Playwright NPM package version - but worth the effort to automate that in some way. FWIW, I posted in Discord a while ago regarding the rough process I follow for this:
I've found this approach to work well for me. |
Since Dependabot is handling the updates... That would mean writing a job in the CI that would read the playwright version from the package.json and update the Workflow YAML with the corresponding version... I have to think about this a bit more and make sure this doesn't create some security issues or other kind of problems 🤔 The main question still remains though, shouldn't the |
Closing as per #32483 (comment). We recommend pinning for having reproducible builds. In your case configuring Dependabot to also update your Dockerfile might work. Alternatively without Docker, you can use our recommended approach which does not require bumping two versions. We updated the release notes to reflect that change https://github.com/microsoft/playwright/releases/tag/v1.47.0.
:latest was not something we officially supported nor documented in the past, so we advise against it. |
Whilst I'm an advocate that people should use a specific tag - especially in pipelines etc., it does seem very odd for the E.g. I'm sure it will be common for someone when first trying out Playwright, to just do something like I think this ought to be reconsidered. If you really don't want to support the |
While I agree with above, removing a tag is unfortunately not an option, since it will also break existing customers and is also against Docker best practises. If we would start again, we'd not publish |
OK, fair enough. In that case, I'd suggest making the documentation a little clearer. Right now it states:
It should perhaps say that Sorry to keep pushing on this one, but I genuinely feel it's going to catch some people out, and hence updating the docs to make it as clear as possible would seem sensible. |
Unfortunately, using the tagged image turns out to be more complicated than expected. So, the ideal solution would require the calling workflow to output the playwright version installed and pass it as an argument to the shared workflow. The shared workflow should then set the container image based on this argument. Our current workaround is simply run |
Hello, I'm also having trouble with this change - as probably more people in this thread, I used the docker container in GitHub actions with dependabot updating playwright automatically for me. That means there is no Dockerfile. If I understand the discussion correctly, I now have these options:
Am I missing something here? Is there some "silver bullet"? |
@marekdedic sorry to hear! I was looking into 3 and found an approach which seems to work quite nicely and which applies the best practises. Would that work for you? name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
read-playwright-version:
name: 'Read Playwright Version'
runs-on: ubuntu-latest
outputs:
playwright-version: ${{ steps.get_playwright_version.outputs.playwright-version }}
steps:
- uses: actions/checkout@v4
- run: |
playwright_version=$(node -e 'console.log(require("./package-lock.json")["packages"]["node_modules/@playwright/test"].version)')
echo "playwright-version=$playwright_version" >> $GITHUB_OUTPUT
id: get_playwright_version
playwright:
name: 'Run Playwright Tests'
runs-on: ubuntu-latest
needs: read-playwright-version
container:
image: mcr.microsoft.com/playwright:v${{ needs.read-playwright-version.outputs.playwright-version }}-noble
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Run your tests
run: npx playwright test
env:
HOME: /root (The reason why I read package-lock.json is to avoid doing "npm ci" which usually takes a few seconds. If you use a different package manager, this step might be different). |
@mxschmitt That looks promising, thanks! It's still one more job than it used to be, but I think that compared to installing the browsers every time it would still be much better. :) |
@mxschmitt I can confirm that your suggestion works nicely, thank you! If anyone stumbles upon this in the future, see e.g. marekdedic/dedic.eu#351 |
Thanks for this example @mxschmitt. I used it to create a GitHub Action to handle this that works with |
Version
1.47.0
Steps to reproduce
docker pull mcr.microsoft.com/playwright:latest
Expected behavior
Pulling "v1.47.0-noble" (sha256:3d41153494e2b12a5a5fa6e26cf1e854c3997d13758754d46e7bf902b5ba09b1)
Actual behavior
Pulling "v1.46.1-jammy" (sha256:02810c978d5396bf382ab6015c25ad6bed9e39f4a41c5b9c829e9fea439274e2)
Additional context
v1.47.0 Release notes => "The mcr.microsoft.com/playwright:v1.47.0 now serves a Playwright image based on Ubuntu 24.04 Noble.
To use the 22.04 jammy-based image, please use mcr.microsoft.com/playwright:v1.47.0-jammy instead."
Environment
The text was updated successfully, but these errors were encountered: