Pin playwright synapse docker image to 2 days ago (#12571)
* Pin playwright synapse docker image to 2 days ago Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Automatically update Synapse docker image using GHA PRs Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/28217/head
parent
679b170bc5
commit
aec15a6ac1
|
@ -0,0 +1,45 @@
|
||||||
|
name: Update Playwright docker images
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
schedule:
|
||||||
|
- cron: "0 6 * * *" # Every day at 6am UTC
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Update matrixdotorg/synapse image
|
||||||
|
run: |
|
||||||
|
docker pull "$IMAGE"
|
||||||
|
INSPECT=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE")
|
||||||
|
DIGEST=${INSPECT#*@}
|
||||||
|
sed -i "s/const DOCKER_TAG.*/const DOCKER_TAG = \"develop@$DIGEST\";/" playwright/plugins/homeserver/synapse/index.ts
|
||||||
|
env:
|
||||||
|
IMAGE: matrixdotorg/synapse:develop
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
id: cpr
|
||||||
|
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||||
|
branch: actions/playwright-image-updates
|
||||||
|
delete-branch: true
|
||||||
|
title: Playwright Docker image updates
|
||||||
|
labels: |
|
||||||
|
T-Task
|
||||||
|
|
||||||
|
- name: Enable automerge
|
||||||
|
run: gh pr merge --merge --auto "$PR_NUMBER"
|
||||||
|
if: steps.cpr.outputs.pull-request-operation == 'created'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
|
||||||
|
|
||||||
|
- name: Enable autoapprove
|
||||||
|
run: |
|
||||||
|
gh pr review --approve "$PR_NUMBER"
|
||||||
|
if: steps.cpr.outputs.pull-request-operation == 'created'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
|
|
@ -25,6 +25,11 @@ import { Docker } from "../../docker";
|
||||||
import { HomeserverConfig, HomeserverInstance, Homeserver, StartHomeserverOpts, Credentials } from "..";
|
import { HomeserverConfig, HomeserverInstance, Homeserver, StartHomeserverOpts, Credentials } from "..";
|
||||||
import { randB64Bytes } from "../../utils/rand";
|
import { randB64Bytes } from "../../utils/rand";
|
||||||
|
|
||||||
|
// Docker tag to use for `matrixdotorg/synapse` image.
|
||||||
|
// We target a specific digest as every now and then a Synapse update will break our CI.
|
||||||
|
// This digest is updated by the playwright-image-updates.yaml workflow periodically.
|
||||||
|
const DOCKER_TAG = "develop@sha256:b41149e8bacb8c3b22b06bba186402a64b1810c92e70ed5518735f0e57ed8f06";
|
||||||
|
|
||||||
async function cfgDirFromTemplate(opts: StartHomeserverOpts): Promise<Omit<HomeserverConfig, "dockerUrl">> {
|
async function cfgDirFromTemplate(opts: StartHomeserverOpts): Promise<Omit<HomeserverConfig, "dockerUrl">> {
|
||||||
const templateDir = path.join(__dirname, "templates", opts.template);
|
const templateDir = path.join(__dirname, "templates", opts.template);
|
||||||
|
|
||||||
|
@ -103,7 +108,7 @@ export class Synapse implements Homeserver, HomeserverInstance {
|
||||||
console.log(`Starting synapse with config dir ${synCfg.configDir}...`);
|
console.log(`Starting synapse with config dir ${synCfg.configDir}...`);
|
||||||
const dockerSynapseParams = ["-v", `${synCfg.configDir}:/data`, "-p", `${synCfg.port}:8008/tcp`];
|
const dockerSynapseParams = ["-v", `${synCfg.configDir}:/data`, "-p", `${synCfg.port}:8008/tcp`];
|
||||||
const synapseId = await this.docker.run({
|
const synapseId = await this.docker.run({
|
||||||
image: "matrixdotorg/synapse:develop",
|
image: `matrixdotorg/synapse:${DOCKER_TAG}`,
|
||||||
containerName: `react-sdk-playwright-synapse`,
|
containerName: `react-sdk-playwright-synapse`,
|
||||||
params: dockerSynapseParams,
|
params: dockerSynapseParams,
|
||||||
cmd: ["run"],
|
cmd: ["run"],
|
||||||
|
|
Loading…
Reference in New Issue