chore: have Ubuntu 22 Docker image by default (#22356)

Fixes https://github.com/microsoft/playwright-python/issues/1858
This commit is contained in:
Max Schmitt 2023-04-12 19:40:23 +02:00 коммит произвёл GitHub
Родитель 2977c2b539
Коммит 336d2114c8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 41 добавлений и 40 удалений

Просмотреть файл

@ -176,7 +176,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
@ -194,7 +194,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
steps:
- uses: actions/checkout@v3
- name: Set up Python
@ -218,7 +218,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
@ -239,7 +239,7 @@ jobs:
name: 'Playwright Tests'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
@ -264,7 +264,7 @@ jobs:
name: 'Playwright Tests - ${{ matrix.project }} - Shard ${{ matrix.shardIndex }} of ${{ matrix.shardTotal }}'
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
strategy:
fail-fast: false
matrix:
@ -299,7 +299,7 @@ jobs:
- deployment: Run_E2E_Tests
pool:
vmImage: ubuntu-20.04
container: mcr.microsoft.com/playwright:v1.33.0-focal
container: mcr.microsoft.com/playwright:v1.33.0-jammy
environment: testing
strategy:
runOnce:
@ -325,7 +325,7 @@ jobs:
- deployment: Run_E2E_Tests
pool:
vmImage: ubuntu-20.04
container: mcr.microsoft.com/playwright:v1.33.0-focal
container: mcr.microsoft.com/playwright:v1.33.0-jammy
environment: testing
strategy:
runOnce:
@ -367,9 +367,9 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
```yml
executors:
pw-focal-development:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright:v1.33.0-focal
- image: mcr.microsoft.com/playwright:v1.33.0-jammy
```
Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures.
@ -390,7 +390,7 @@ Sharding in CircleCI is indexed with 0 which means that you will need to overrid
```yml
playwright-job-name:
executor: pw-focal-development
executor: pw-jammy-development
parallelism: 4
steps:
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npx playwright test -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
@ -403,7 +403,7 @@ to run tests on Jenkins.
```groovy
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright:v1.33.0-focal' } }
agent { docker { image 'mcr.microsoft.com/playwright:v1.33.0-jammy' } }
stages {
stage('e2e-tests') {
steps {
@ -421,7 +421,7 @@ pipeline {
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.md)).
```yml
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
```
### GitLab CI
@ -434,7 +434,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
script:
...
```
@ -450,7 +450,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
parallel: 7
script:
- npm ci
@ -465,7 +465,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v1.33.0-focal
image: mcr.microsoft.com/playwright:v1.33.0-jammy
parallel:
matrix:
- PROJECT: ['chromium', 'webkit']

Просмотреть файл

@ -3,7 +3,7 @@ id: docker
title: "Docker"
---
[Dockerfile.focal] can be used to run Playwright scripts in Docker environment. These image includes all the dependencies needed to run browsers in a Docker container, and also include the browsers themselves.
[Dockerfile.jammy] can be used to run Playwright scripts in Docker environment. These image includes all the dependencies needed to run browsers in a Docker container, and also include the browsers themselves.
<!-- TOC -->
@ -18,19 +18,19 @@ This Docker image is intended to be used for testing and development purposes on
### Pull the image
```bash js
docker pull mcr.microsoft.com/playwright:v1.33.0-focal
docker pull mcr.microsoft.com/playwright:v1.33.0-jammy
```
```bash python
docker pull mcr.microsoft.com/playwright/python:v1.33.0-focal
docker pull mcr.microsoft.com/playwright/python:v1.33.0-jammy
```
```bash csharp
docker pull mcr.microsoft.com/playwright/dotnet:v1.33.0-focal
docker pull mcr.microsoft.com/playwright/dotnet:v1.33.0-jammy
```
```bash java
docker pull mcr.microsoft.com/playwright/java:v1.33.0-focal
docker pull mcr.microsoft.com/playwright/java:v1.33.0-jammy
```
### Run the image
@ -42,19 +42,19 @@ By default, the Docker image will use the `root` user to run the browsers. This
On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers.
```bash js
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v1.33.0-jammy /bin/bash
```
```bash python
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v1.33.0-jammy /bin/bash
```
```bash csharp
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.33.0-jammy /bin/bash
```
```bash java
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v1.33.0-jammy /bin/bash
```
#### Crawling and scraping
@ -62,19 +62,19 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v1.33.0-focal /
On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it.
```bash js
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v1.33.0-jammy /bin/bash
```
```bash python
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v1.33.0-jammy /bin/bash
```
```bash csharp
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.33.0-jammy /bin/bash
```
```bash java
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v1.33.0-focal /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v1.33.0-jammy /bin/bash
```
[`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions:
@ -108,11 +108,12 @@ See our [Continuous Integration guides](./ci.md) for sample configs.
See [all available image tags].
Docker images are published automatically by GitHub Actions. We currently publish images with the
following tags (`v1.20.0` in this case is an example:):
- `:next` - tip-of-tree image version based on Ubuntu 20.04 LTS (Focal Fossa).
- `:next-focal` - tip-of-tree image version based on Ubuntu 20.04 LTS (Focal Fossa).
- `:v1.20.0` - Playwright v1.20.0 release docker image based on Ubuntu 20.04 LTS (Focal Fossa).
- `:v1.20.0-focal` - Playwright v1.20.0 release docker image based on Ubuntu 20.04 LTS (Focal Fossa).
following tags (`v1.33.0` in this case is an example:):
- `:next` - tip-of-tree image version based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:next-jammy` - tip-of-tree image version based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v1.33.0` - Playwright v1.33.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v1.33.0-jammy` - Playwright v1.33.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v1.33.0-focal` - Playwright v1.33.0 release docker image based on Ubuntu 20.04 LTS (Focal Fossa).
- `:sha-XXXXXXX` - docker image for every commit that changed
docker files or browsers, marked with a [short sha](https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#Short-SHA-1) (first 7 digits of the SHA commit).
@ -123,7 +124,7 @@ It is recommended to always pin your Docker image to a specific version if possi
### Base images
We currently publish images based on the following [Ubuntu](https://hub.docker.com/_/ubuntu) versions:
- **Ubuntu 22.04 LTS** (Jammy Jellyfish), image tags include `jammy` (not published for Java)
- **Ubuntu 22.04 LTS** (Jammy Jellyfish), image tags include `jammy`
- **Ubuntu 20.04 LTS** (Focal Fossa), image tags include `focal`
#### Alpine
@ -138,10 +139,10 @@ Browser builds for Firefox and WebKit are built for the [glibc](https://en.wikip
Use [`//utils/docker/build.sh`](https://github.com/microsoft/playwright/blob/main/utils/docker/build.sh) to build the image.
```
./utils/docker/build.sh focal playwright:localbuild-focal
./utils/docker/build.sh jammy playwright:localbuild-jammy
```
The image will be tagged as `playwright:localbuild-focal` and could be run as:
The image will be tagged as `playwright:localbuild-jammy` and could be run as:
```
docker run --rm -it playwright:localbuild /bin/bash

Просмотреть файл

@ -43,7 +43,7 @@ The snapshot name `example-test-1-chromium-darwin.png` consists of a few parts:
If you are not on the same operating system as your CI system, you can use Docker to generate/update the screenshots:
```bash
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.33.0-focal /bin/bash
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.33.0-jammy /bin/bash
npm install
npx playwright test --update-snapshots
```

Просмотреть файл

@ -36,21 +36,21 @@ FOCAL_TAGS=(
"sha-${GITHUB_SHA}"
"next-focal"
"v${PW_VERSION}-focal"
"v${PW_VERSION}"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
FOCAL_TAGS+=("latest")
FOCAL_TAGS+=("focal")
fi
JAMMY_TAGS=(
"next-jammy"
"v${PW_VERSION}-jammy"
"v${PW_VERSION}"
)
if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
JAMMY_TAGS+=("jammy")
FOCAL_TAGS+=("latest")
FOCAL_TAGS+=("jammy")
fi
tag_and_push() {