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

Synapse: Add a step for running Complement tests in worker mode #122

Closed
wants to merge 11 commits into from
Closed
47 changes: 45 additions & 2 deletions synapse/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ steps:
# Build a 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 latest version of Complement, so download it here.
# 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,
Expand All @@ -554,7 +554,7 @@ steps:
# Finally, compile and run the tests.
- "cd complement-master"
- "COMPLEMENT_BASE_IMAGE=complement-synapse:latest go test -v -tags synapse_blacklist ./tests"
label: "\U0001F9EA Complement"
label: "\U0001F9EA Complement | Synapse Monolith"
agents:
queue: "medium"
plugins:
Expand All @@ -570,3 +570,46 @@ steps:
# the hosts Docker.
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"

- command:
# Build a 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"
# Finally, compile and run the tests.
- "cd complement-master"
- "COMPLEMENT_BASE_IMAGE=complement-synapse:latest go test -v -tags synapse_blacklist ./tests"
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
label: "\U0001F9EA Complement | Synapse Workers"
agents:
# Running every worker takes a beefy system
queue: "xlarge"
plugins:
- docker#v3.7.0:
# The dockerfile for this image is at https://github.com/matrix-org/complement/blob/master/dockerfiles/ComplementCIBuildkite.Dockerfile.
image: "matrixdotorg/complement:latest"
mount-buildkite-agent: false
environment:
# Complement needs to know if it is running under CI
- "CI=true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matrix-org/complement#60

I'm planning to change that myself once these PRs are in :)

# Enable debug logging
- "COMPLEMENT_DEBUG=1"
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
# Enabled Complement's certificate authority for authentication of
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
# federation requests
- "COMPLEMENT_CA=true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly not, though existing images expecting to fill the /ca directory with their own files (for example, Synapse Monolith's) will need to be updated if this option is on by default.

I've created an issue for discussion on the Complement repo here: matrix-org/complement#65

# Starting up all the processes in this container can take a little while.
# The default is 200. Let's wait a bit longer to decrease the chance of a
# startup timeout
- "COMPLEMENT_VERSION_CHECK_ITERATIONS=500"
publish: [ "8448:8448" ]
# Complement uses Docker so pass through the docker socket. This means Complement shares
# the hosts Docker.
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to make use of yaml entities so that the bits that are shared between the complement runs (the docker-plugin settings, and some of the commands) don't have to be C&Ped.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to reduce the plugins section quite significantly, but didn't see as clear a path with commands: as there's some differences and commonalities interspersed with one another.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks the same apart from the name of the dockerfile? so have two yaml entities, one which does the bits before that, and one which does the bits after?

or even: stick the name of a dockerfile in an env var and set it somewhere else in the step config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems as though environment variables specified in environment aren't used when launching commands specified in commands. The environment variables that seem to work there are those found in docker-compose-env. But that doesn't really help us much.