summary refs log tree commit diff
path: root/scripts-dev/complement.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts-dev/complement.sh')
-rwxr-xr-xscripts-dev/complement.sh33
1 files changed, 23 insertions, 10 deletions
diff --git a/scripts-dev/complement.sh b/scripts-dev/complement.sh
index 3c472c576e..ffd399c39d 100755
--- a/scripts-dev/complement.sh
+++ b/scripts-dev/complement.sh
@@ -43,17 +43,29 @@ fi
 # Build the base Synapse image from the local checkout
 docker build -t matrixdotorg/synapse -f "docker/Dockerfile" .
 
+# Build the workers docker image (from the base Synapse image we just built).
+docker build -t matrixdotorg/synapse-workers -f "docker/Dockerfile-workers" .
+
+# Build the unified Complement image (from the worker Synapse image we just built).
+docker build -t complement-synapse \
+  -f "docker/complement/Dockerfile" "docker/complement"
+
+export COMPLEMENT_BASE_IMAGE=complement-synapse
+
 extra_test_args=()
 
 test_tags="synapse_blacklist,msc2716,msc3030,msc3787"
 
-# If we're using workers, modify the docker files slightly.
+# All environment variables starting with PASS_ will be shared.
+# (The prefix is stripped off before reaching the container.)
+export COMPLEMENT_SHARE_ENV_PREFIX=PASS_
+
 if [[ -n "$WORKERS" ]]; then
-  # Build the workers docker image (from the base Synapse image).
-  docker build -t matrixdotorg/synapse-workers -f "docker/Dockerfile-workers" .
+  # Use workers.
+  export PASS_SYNAPSE_COMPLEMENT_USE_WORKERS=true
 
-  export COMPLEMENT_BASE_IMAGE=complement-synapse-workers
-  COMPLEMENT_DOCKERFILE=SynapseWorkers.Dockerfile
+  # Workers can only use Postgres as a database.
+  export PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres
 
   # And provide some more configuration to complement.
 
@@ -65,17 +77,18 @@ if [[ -n "$WORKERS" ]]; then
   # ... and it takes longer than 10m to run the whole suite.
   extra_test_args+=("-timeout=60m")
 else
-  export COMPLEMENT_BASE_IMAGE=complement-synapse
-  COMPLEMENT_DOCKERFILE=Dockerfile
+  export PASS_SYNAPSE_COMPLEMENT_USE_WORKERS=
+  if [[ -n "$POSTGRES" ]]; then
+    export PASS_SYNAPSE_COMPLEMENT_DATABASE=postgres
+  else
+    export PASS_SYNAPSE_COMPLEMENT_DATABASE=sqlite
+  fi
 
   # We only test faster room joins on monoliths, because they are purposefully
   # being developed without worker support to start with.
   test_tags="$test_tags,faster_joins"
 fi
 
-# Build the Complement image from the Synapse image we just built.
-docker build -t $COMPLEMENT_BASE_IMAGE -f "docker/complement/$COMPLEMENT_DOCKERFILE" "docker/complement"
-
 # Run the tests!
 echo "Images built; running complement"
 cd "$COMPLEMENT_DIR"