Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit fed759e

Browse files
authored
Allow the docker tag for the sliding sync proxy to be specified in env (#9496)
1 parent 66c20a0 commit fed759e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

cypress.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export default defineConfig({
3030
experimentalSessionAndOrigin: true,
3131
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
3232
},
33+
env: {
34+
// Docker tag to use for `ghcr.io/matrix-org/sliding-sync-proxy` image.
35+
SLIDING_SYNC_PROXY_TAG: "v0.6.0",
36+
},
3337
retries: {
3438
runMode: 4,
3539
openMode: 0,

cypress/plugins/sliding-sync/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import { dockerExec, dockerIp, dockerRun, dockerStop } from "../docker";
2222
import { getFreePort } from "../utils/port";
2323
import { SynapseInstance } from "../synapsedocker";
2424

25-
// A cypress plugins to add command to start & stop https://github.com/matrix-org/sliding-sync
25+
// A cypress plugin to add command to start & stop https://github.com/matrix-org/sliding-sync
26+
// SLIDING_SYNC_PROXY_TAG env used as the docker tag to use for `ghcr.io/matrix-org/sliding-sync-proxy` image.
2627

2728
export interface ProxyInstance {
2829
containerId: string;
@@ -34,7 +35,7 @@ const instances = new Map<string, ProxyInstance>();
3435

3536
const PG_PASSWORD = "p4S5w0rD";
3637

37-
async function proxyStart(synapse: SynapseInstance): Promise<ProxyInstance> {
38+
async function proxyStart(dockerTag: string, synapse: SynapseInstance): Promise<ProxyInstance> {
3839
console.log(new Date(), "Starting sliding sync proxy...");
3940

4041
const postgresId = await dockerRun({
@@ -75,9 +76,9 @@ async function proxyStart(synapse: SynapseInstance): Promise<ProxyInstance> {
7576
}
7677

7778
const port = await getFreePort();
78-
console.log(new Date(), "starting proxy container...");
79+
console.log(new Date(), "starting proxy container...", dockerTag);
7980
const containerId = await dockerRun({
80-
image: "ghcr.io/matrix-org/sliding-sync-proxy:v0.6.0",
81+
image: "ghcr.io/matrix-org/sliding-sync-proxy:" + dockerTag,
8182
containerName: "react-sdk-cypress-sliding-sync-proxy",
8283
params: [
8384
"--rm",
@@ -114,8 +115,10 @@ async function proxyStop(instance: ProxyInstance): Promise<void> {
114115
* @type {Cypress.PluginConfig}
115116
*/
116117
export function slidingSyncProxyDocker(on: PluginEvents, config: PluginConfigOptions) {
118+
const dockerTag = config.env["SLIDING_SYNC_PROXY_TAG"];
119+
117120
on("task", {
118-
proxyStart,
121+
proxyStart: proxyStart.bind(null, dockerTag),
119122
proxyStop,
120123
});
121124

0 commit comments

Comments
 (0)