Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
Clean up the commands a bit by extracting to a common anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Jan 25, 2021
1 parent 0092756 commit 6998c3e
Showing 1 changed file with 35 additions and 26 deletions.
61 changes: 35 additions & 26 deletions synapse/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ x-yaml-aliases:
apt-get update && apt-get install -y xmlsec1
python -m pip install tox

# Note: We can't place the below steps in a Synapse repo script as this code is
# given access to the host docker socket. We don't want to allow untrusted code
# to be executed with those privileges.
- complement_commands_common: &complement_commands_common
# We use the complement:latest image to provide Complement's dependencies, but want
# to actually run against the master branch of Complement, so download it here.
- "wget https://github.com/matrix-org/complement/archive/master.tar.gz"
- "tar -xzf master.tar.gz"

# Build a second docker image on top of the above image. This one sets up Synapse with a generated config file,
# signing and SSL keys so Synapse can run and federate. The value of the environment
# variable determines which Synapse-flavoured dockerfile to use from Complement repo.
- "docker build -t complement-synapse -f $SYNAPSE_COMPLEMENT_DOCKERFILE complement-master/dockerfiles"

# Finally, compile and run the tests.
- "cd complement-master"
- "go test -v -tags synapse_blacklist ./tests"


plugins:
- docker#v3.7.0: &complement_docker_common
# The dockerfile for this image is at
Expand Down Expand Up @@ -564,50 +583,37 @@ steps:
# given access to the host docker socket. We don't want to allow untrusted code
# to be executed with those privileges.

# Build a docker image from the checked out Synapse source
# Build a base docker image from the checked out Synapse source
- "docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile ."

# We use the complement:latest image to provide Complement's dependencies, but want
# to actually run against the master branch of Complement, so download it here.
- "wget https://github.com/matrix-org/complement/archive/master.tar.gz"
- "tar -xzf master.tar.gz"
# Build a second docker image on top of the above image. This one sets up Synapse with a generated config file,
# signing and SSL keys so Synapse can run and federate
- "docker build -t complement-synapse -f complement-master/dockerfiles/Synapse.Dockerfile complement-master/dockerfiles"
# Build the final dockerfile and run the tests
*complement_commands_common

# Finally, compile and run the tests.
- "cd complement-master"
- "go test -v -tags synapse_blacklist ./tests"
label: "\U0001F9EA Complement | Synapse Monolith"
agents:
queue: "medium"
plugins:
- docker#v3.7.0:
<<: *complement_docker_common
# Override the default plugin settings
environment:
- *complement_docker_environment_common
# Use a Synapse Monolith Dockerfile from Complement. This dockerfile is located at:
# https://github.com/matrix-org/complement/blob/master/dockerfiles/Synapse.Dockerfile
- "SYNAPSE_COMPLEMENT_DOCKERFILE=complement-master/dockerfiles/Synapse.Dockerfile"

- command:
# Build the necessary docker images and start Complement.
# Note: We can't place the below steps in a Synapse repo script as this code is
# given access to the host docker socket. We don't want to allow untrusted code
# to be executed with those privileges.

# Build a docker image from the checked out Synapse source
# Build a base docker image from the checked out Synapse source
- "docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile ."

# Build a second docker image on top of the above image. This one sets up Synapse workers
# as well as everything else it needs to run a federating setup
- "docker build -t matrixdotorg/synapse:workers -f docker/Dockerfile-workers ."

# We use the complement:latest image to provide Complement's dependencies, but want
# to actually run against the master branch of Complement, so download it here.
- "wget https://github.com/matrix-org/complement/archive/master.tar.gz"
- "tar -xzf master.tar.gz"
# Build an image for running the above worker setup in Complement. This involves
# disabling rate-limiting, using Complement's CA etc.
- "docker build -t complement-synapse -f complement-master/dockerfiles/SynapseWorkers.Dockerfile complement-master/dockerfiles"
# Build the final dockerfile and run the tests
*complement_commands_common

# Finally, compile and run the tests.
- "cd complement-master"
- "go test -v -tags synapse_blacklist ./tests"
label: "\U0001F9EA Complement | Synapse Workers"
agents:
# Running every worker takes a beefy system
Expand All @@ -618,6 +624,9 @@ steps:
# Override the default plugin settings
environment:
- *complement_docker_environment_common
# Use the Synapse Worker Dockerfile from Complement. This dockerfile is located at:
# https://github.com/matrix-org/complement/blob/master/dockerfiles/SynapseWorkers.Dockerfile
- "SYNAPSE_COMPLEMENT_DOCKERFILE=complement-master/dockerfiles/SynapseWorkers.Dockerfile"
# Enable Complement's certificate authority for authentication of federation
# requests
- "COMPLEMENT_CA=true"
Expand Down

0 comments on commit 6998c3e

Please sign in to comment.