From e8a73af6e5748bd6be17892dfaf9be8d4672bb15 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 18 Jan 2022 16:09:46 +0100 Subject: [PATCH 1/3] Allow overriding the complement ref Allows you to define COMPLEMENT_REF to use a different branch or commit than master, when running complement and not using a local COMPLEMENT_DIR. Signed-off-by: Nicolas Werner --- changelog.d/11766.misc | 1 + scripts-dev/complement.sh | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 changelog.d/11766.misc diff --git a/changelog.d/11766.misc b/changelog.d/11766.misc new file mode 100644 index 000000000000..3c9e5f95ffcc --- /dev/null +++ b/changelog.d/11766.misc @@ -0,0 +1 @@ +Allow overriding complement commit using `COMPLEMENT_REF`. diff --git a/scripts-dev/complement.sh b/scripts-dev/complement.sh index 67a22d3ed3e7..f237d66a89b3 100755 --- a/scripts-dev/complement.sh +++ b/scripts-dev/complement.sh @@ -8,7 +8,8 @@ # By default the script will fetch the latest Complement master branch and # run tests with that. This can be overridden to use a custom Complement # checkout by setting the COMPLEMENT_DIR environment variable to the -# filepath of a local Complement checkout. +# filepath of a local Complement checkout or by setting the COMPLEMENT_REF +# environment variable to pull a different branch or commit. # # By default Synapse is run in monolith mode. This can be overridden by # setting the WORKERS environment variable. @@ -31,11 +32,12 @@ cd "$(dirname $0)/.." # Check for a user-specified Complement checkout if [[ -z "$COMPLEMENT_DIR" ]]; then + COMPLEMENT_REF=${COMPLEMENT_REF:-master} echo "COMPLEMENT_DIR not set. Fetching the latest Complement checkout..." - wget -Nq https://github.com/matrix-org/complement/archive/master.tar.gz - tar -xzf master.tar.gz - COMPLEMENT_DIR=complement-master - echo "Checkout available at 'complement-master'" + wget -Nq https://github.com/matrix-org/complement/archive/${COMPLEMENT_REF}.tar.gz + tar -xzf ${COMPLEMENT_REF}.tar.gz + COMPLEMENT_DIR=complement-${COMPLEMENT_REF} + echo "Checkout available at 'complement-${COMPLEMENT_REF}'" fi # Build the base Synapse image from the local checkout From cedbecfdf42f46cbaecf247f3a45eeb1aa29adcd Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 18 Jan 2022 22:11:58 +0100 Subject: [PATCH 2/3] Ignore all complement directories at the top level Signed-off-by: Nicolas Werner --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8eb4eda73d71..3bd6b1a08c57 100644 --- a/.gitignore +++ b/.gitignore @@ -52,5 +52,5 @@ __pycache__/ book/ # complement -/complement-master +/complement-* /master.tar.gz From d689efffeca846b6be0135c37907ce2803bd4640 Mon Sep 17 00:00:00 2001 From: Nicolas Werner <89468146+nico-famedly@users.noreply.github.com> Date: Thu, 20 Jan 2022 11:16:28 +0000 Subject: [PATCH 3/3] Apply review suggestion Co-authored-by: Patrick Cloke --- scripts-dev/complement.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts-dev/complement.sh b/scripts-dev/complement.sh index f237d66a89b3..e08ffedaf33a 100755 --- a/scripts-dev/complement.sh +++ b/scripts-dev/complement.sh @@ -33,7 +33,7 @@ cd "$(dirname $0)/.." # Check for a user-specified Complement checkout if [[ -z "$COMPLEMENT_DIR" ]]; then COMPLEMENT_REF=${COMPLEMENT_REF:-master} - echo "COMPLEMENT_DIR not set. Fetching the latest Complement checkout..." + echo "COMPLEMENT_DIR not set. Fetching Complement checkout from ${COMPLEMENT_REF}..." wget -Nq https://github.com/matrix-org/complement/archive/${COMPLEMENT_REF}.tar.gz tar -xzf ${COMPLEMENT_REF}.tar.gz COMPLEMENT_DIR=complement-${COMPLEMENT_REF}