mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
complement.sh: Permit skipping docker build (#13143)
Add a `-f` argument to `complement.sh` to skip the docker build
This commit is contained in:
parent
5296c09473
commit
fe910fb10e
1
changelog.d/13143.misc
Normal file
1
changelog.d/13143.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add support to `complement.sh` for skipping the docker build.
|
@ -14,9 +14,12 @@
|
|||||||
# By default Synapse is run in monolith mode. This can be overridden by
|
# By default Synapse is run in monolith mode. This can be overridden by
|
||||||
# setting the WORKERS environment variable.
|
# setting the WORKERS environment variable.
|
||||||
#
|
#
|
||||||
# A regular expression of test method names can be supplied as the first
|
# You can optionally give a "-f" argument (for "fast") before any to skip
|
||||||
# argument to the script. Complement will then only run those tests. If
|
# rebuilding the docker images, if you just want to rerun the tests.
|
||||||
# no regex is supplied, all tests are run. For example;
|
#
|
||||||
|
# Remaining commandline arguments are passed through to `go test`. For example,
|
||||||
|
# you can supply a regular expression of test method names via the "-run"
|
||||||
|
# argument:
|
||||||
#
|
#
|
||||||
# ./complement.sh -run "TestOutboundFederation(Profile|Send)"
|
# ./complement.sh -run "TestOutboundFederation(Profile|Send)"
|
||||||
#
|
#
|
||||||
@ -32,6 +35,37 @@ echo_if_github() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Helper to print out the usage instructions
|
||||||
|
usage() {
|
||||||
|
cat >&2 <<EOF
|
||||||
|
Usage: $0 [-f] <go test arguments>...
|
||||||
|
Run the complement test suite on Synapse.
|
||||||
|
|
||||||
|
-f Skip rebuilding the docker images, and just use the most recent
|
||||||
|
'complement-synapse:latest' image
|
||||||
|
|
||||||
|
For help on arguments to 'go test', run 'go help testflag'.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# parse our arguments
|
||||||
|
skip_docker_build=""
|
||||||
|
while [ $# -ge 1 ]; do
|
||||||
|
arg=$1
|
||||||
|
case "$arg" in
|
||||||
|
"-h")
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
"-f")
|
||||||
|
skip_docker_build=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# unknown arg: presumably an argument to gotest. break the loop.
|
||||||
|
break
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
# enable buildkit for the docker builds
|
# enable buildkit for the docker builds
|
||||||
export DOCKER_BUILDKIT=1
|
export DOCKER_BUILDKIT=1
|
||||||
@ -49,21 +83,23 @@ if [[ -z "$COMPLEMENT_DIR" ]]; then
|
|||||||
echo "Checkout available at 'complement-${COMPLEMENT_REF}'"
|
echo "Checkout available at 'complement-${COMPLEMENT_REF}'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the base Synapse image from the local checkout
|
if [ -z "$skip_docker_build" ]; then
|
||||||
echo_if_github "::group::Build Docker image: matrixdotorg/synapse"
|
# Build the base Synapse image from the local checkout
|
||||||
docker build -t matrixdotorg/synapse -f "docker/Dockerfile" .
|
echo_if_github "::group::Build Docker image: matrixdotorg/synapse"
|
||||||
echo_if_github "::endgroup::"
|
docker build -t matrixdotorg/synapse -f "docker/Dockerfile" .
|
||||||
|
echo_if_github "::endgroup::"
|
||||||
|
|
||||||
# Build the workers docker image (from the base Synapse image we just built).
|
# Build the workers docker image (from the base Synapse image we just built).
|
||||||
echo_if_github "::group::Build Docker image: matrixdotorg/synapse-workers"
|
echo_if_github "::group::Build Docker image: matrixdotorg/synapse-workers"
|
||||||
docker build -t matrixdotorg/synapse-workers -f "docker/Dockerfile-workers" .
|
docker build -t matrixdotorg/synapse-workers -f "docker/Dockerfile-workers" .
|
||||||
echo_if_github "::endgroup::"
|
echo_if_github "::endgroup::"
|
||||||
|
|
||||||
# Build the unified Complement image (from the worker Synapse image we just built).
|
# Build the unified Complement image (from the worker Synapse image we just built).
|
||||||
echo_if_github "::group::Build Docker image: complement/Dockerfile"
|
echo_if_github "::group::Build Docker image: complement/Dockerfile"
|
||||||
docker build -t complement-synapse \
|
docker build -t complement-synapse \
|
||||||
-f "docker/complement/Dockerfile" "docker/complement"
|
-f "docker/complement/Dockerfile" "docker/complement"
|
||||||
echo_if_github "::endgroup::"
|
echo_if_github "::endgroup::"
|
||||||
|
fi
|
||||||
|
|
||||||
export COMPLEMENT_BASE_IMAGE=complement-synapse
|
export COMPLEMENT_BASE_IMAGE=complement-synapse
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user