Allow the docker tag for the sliding sync proxy to be specified in env (#9496)
This commit is contained in:
parent
66c20a0798
commit
fed759ec0e
2 changed files with 12 additions and 5 deletions
|
@ -30,6 +30,10 @@ export default defineConfig({
|
||||||
experimentalSessionAndOrigin: true,
|
experimentalSessionAndOrigin: true,
|
||||||
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
|
||||||
},
|
},
|
||||||
|
env: {
|
||||||
|
// Docker tag to use for `ghcr.io/matrix-org/sliding-sync-proxy` image.
|
||||||
|
SLIDING_SYNC_PROXY_TAG: "v0.6.0",
|
||||||
|
},
|
||||||
retries: {
|
retries: {
|
||||||
runMode: 4,
|
runMode: 4,
|
||||||
openMode: 0,
|
openMode: 0,
|
||||||
|
|
|
@ -22,7 +22,8 @@ import { dockerExec, dockerIp, dockerRun, dockerStop } from "../docker";
|
||||||
import { getFreePort } from "../utils/port";
|
import { getFreePort } from "../utils/port";
|
||||||
import { SynapseInstance } from "../synapsedocker";
|
import { SynapseInstance } from "../synapsedocker";
|
||||||
|
|
||||||
// A cypress plugins to add command to start & stop https://github.com/matrix-org/sliding-sync
|
// A cypress plugin to add command to start & stop https://github.com/matrix-org/sliding-sync
|
||||||
|
// SLIDING_SYNC_PROXY_TAG env used as the docker tag to use for `ghcr.io/matrix-org/sliding-sync-proxy` image.
|
||||||
|
|
||||||
export interface ProxyInstance {
|
export interface ProxyInstance {
|
||||||
containerId: string;
|
containerId: string;
|
||||||
|
@ -34,7 +35,7 @@ const instances = new Map<string, ProxyInstance>();
|
||||||
|
|
||||||
const PG_PASSWORD = "p4S5w0rD";
|
const PG_PASSWORD = "p4S5w0rD";
|
||||||
|
|
||||||
async function proxyStart(synapse: SynapseInstance): Promise<ProxyInstance> {
|
async function proxyStart(dockerTag: string, synapse: SynapseInstance): Promise<ProxyInstance> {
|
||||||
console.log(new Date(), "Starting sliding sync proxy...");
|
console.log(new Date(), "Starting sliding sync proxy...");
|
||||||
|
|
||||||
const postgresId = await dockerRun({
|
const postgresId = await dockerRun({
|
||||||
|
@ -75,9 +76,9 @@ async function proxyStart(synapse: SynapseInstance): Promise<ProxyInstance> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const port = await getFreePort();
|
const port = await getFreePort();
|
||||||
console.log(new Date(), "starting proxy container...");
|
console.log(new Date(), "starting proxy container...", dockerTag);
|
||||||
const containerId = await dockerRun({
|
const containerId = await dockerRun({
|
||||||
image: "ghcr.io/matrix-org/sliding-sync-proxy:v0.6.0",
|
image: "ghcr.io/matrix-org/sliding-sync-proxy:" + dockerTag,
|
||||||
containerName: "react-sdk-cypress-sliding-sync-proxy",
|
containerName: "react-sdk-cypress-sliding-sync-proxy",
|
||||||
params: [
|
params: [
|
||||||
"--rm",
|
"--rm",
|
||||||
|
@ -114,8 +115,10 @@ async function proxyStop(instance: ProxyInstance): Promise<void> {
|
||||||
* @type {Cypress.PluginConfig}
|
* @type {Cypress.PluginConfig}
|
||||||
*/
|
*/
|
||||||
export function slidingSyncProxyDocker(on: PluginEvents, config: PluginConfigOptions) {
|
export function slidingSyncProxyDocker(on: PluginEvents, config: PluginConfigOptions) {
|
||||||
|
const dockerTag = config.env["SLIDING_SYNC_PROXY_TAG"];
|
||||||
|
|
||||||
on("task", {
|
on("task", {
|
||||||
proxyStart,
|
proxyStart: proxyStart.bind(null, dockerTag),
|
||||||
proxyStop,
|
proxyStop,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue