This commit is contained in:
Erik Johnston 2023-12-13 16:37:10 +00:00
parent 0455c40085
commit 930dc9e2d3
17 changed files with 50 additions and 52 deletions

View file

@ -151,7 +151,7 @@ is suitable for local testing, but for any practical use, you will either need
to use a reverse proxy, or configure Synapse to expose an HTTPS port. to use a reverse proxy, or configure Synapse to expose an HTTPS port.
For documentation on using a reverse proxy, see For documentation on using a reverse proxy, see
https://github.com/element.-hq/synapse/blob/master/docs/reverse_proxy.md. https://github.com/element-hq/synapse/blob/master/docs/reverse_proxy.md.
For more information on enabling TLS support in synapse itself, see For more information on enabling TLS support in synapse itself, see
https://element-hq.github.io/synapse/latest/setup/installation.html#tls-certificates. Of https://element-hq.github.io/synapse/latest/setup/installation.html#tls-certificates. Of

View file

@ -1,10 +1,10 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
# This dockerfile builds on top of 'docker/Dockerfile-workers' in element.-hq/synapse # This dockerfile builds on top of 'docker/Dockerfile-workers' in element-hq/synapse
# by including a built-in postgres instance, as well as setting up the homeserver so # by including a built-in postgres instance, as well as setting up the homeserver so
# that it is ready for testing via Complement. # that it is ready for testing via Complement.
# #
# Instructions for building this image from those it depends on is detailed in this guide: # Instructions for building this image from those it depends on is detailed in this guide:
# https://github.com/element.-hq/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse # https://github.com/element-hq/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse
ARG SYNAPSE_VERSION=latest ARG SYNAPSE_VERSION=latest
# This is an intermediate image, to be built locally (not pulled from a registry). # This is an intermediate image, to be built locally (not pulled from a registry).

View file

@ -24,7 +24,7 @@ To enable this, first create templates for the policy and success pages.
These should be stored on the local filesystem. These should be stored on the local filesystem.
These templates use the [Jinja2](http://jinja.pocoo.org) templating language, These templates use the [Jinja2](http://jinja.pocoo.org) templating language,
and [docs/privacy_policy_templates](https://github.com/element.-hq/synapse/tree/develop/docs/privacy_policy_templates/) and [docs/privacy_policy_templates](https://github.com/element-hq/synapse/tree/develop/docs/privacy_policy_templates/)
gives examples of the sort of thing that can be done. gives examples of the sort of thing that can be done.
Note that the templates must be stored under a name giving the language of the Note that the templates must be stored under a name giving the language of the

View file

@ -14,11 +14,11 @@ b2dba0607`:
Note how the commit comment explains clearly what is changing and why. Also Note how the commit comment explains clearly what is changing and why. Also
note the *absence* of merge commits, as well as the absence of commits called note the *absence* of merge commits, as well as the absence of commits called
things like (to pick a few culprits): things like (to pick a few culprits):
[“pep8”](https://github.com/element.-hq/synapse/commit/84691da6c), [“fix broken [“pep8”](https://github.com/element-hq/synapse/commit/84691da6c), [“fix broken
test”](https://github.com/element.-hq/synapse/commit/474810d9d), test”](https://github.com/element-hq/synapse/commit/474810d9d),
[“oops”](https://github.com/element.-hq/synapse/commit/c9d72e457), [“oops”](https://github.com/element-hq/synapse/commit/c9d72e457),
[“typo”](https://github.com/element.-hq/synapse/commit/836358823), or [“Who's [“typo”](https://github.com/element-hq/synapse/commit/836358823), or [“Who's
the president?”](https://github.com/element.-hq/synapse/commit/707374d5d). the president?”](https://github.com/element-hq/synapse/commit/707374d5d).
There are a number of reasons why keeping a clean commit history is a good There are a number of reasons why keeping a clean commit history is a good
thing: thing:

View file

@ -1,7 +1,7 @@
## Streams ## Streams
Synapse has a concept of "streams", which are roughly described in [`id_generators.py`]( Synapse has a concept of "streams", which are roughly described in [`id_generators.py`](
https://github.com/element.-hq/synapse/blob/develop/synapse/storage/util/id_generators.py https://github.com/element-hq/synapse/blob/develop/synapse/storage/util/id_generators.py
). ).
Generally speaking, streams are a series of notifications that something in Synapse's database has changed that the application might need to respond to. Generally speaking, streams are a series of notifications that something in Synapse's database has changed that the application might need to respond to.
For example: For example:
@ -11,12 +11,12 @@ For example:
- The to-device stream reports when a device has a new [to-device message](https://spec.matrix.org/v1.7/client-server-api/#send-to-device-messaging). - The to-device stream reports when a device has a new [to-device message](https://spec.matrix.org/v1.7/client-server-api/#send-to-device-messaging).
See [`synapse.replication.tcp.streams`]( See [`synapse.replication.tcp.streams`](
https://github.com/element.-hq/synapse/blob/develop/synapse/replication/tcp/streams/__init__.py https://github.com/element-hq/synapse/blob/develop/synapse/replication/tcp/streams/__init__.py
) for the full list of streams. ) for the full list of streams.
It is very helpful to understand the streams mechanism when working on any part of Synapse that needs to respond to changes—especially if those changes are made by different workers. It is very helpful to understand the streams mechanism when working on any part of Synapse that needs to respond to changes—especially if those changes are made by different workers.
To that end, let's describe streams formally, paraphrasing from the docstring of [`AbstractStreamIdGenerator`]( To that end, let's describe streams formally, paraphrasing from the docstring of [`AbstractStreamIdGenerator`](
https://github.com/element.-hq/synapse/blob/a719b703d9bd0dade2565ddcad0e2f3a7a9d4c37/synapse/storage/util/id_generators.py#L96 https://github.com/element-hq/synapse/blob/a719b703d9bd0dade2565ddcad0e2f3a7a9d4c37/synapse/storage/util/id_generators.py#L96
). ).
### Definition ### Definition

View file

@ -87,8 +87,8 @@
1. Restart Prometheus. 1. Restart Prometheus.
1. Consider using the [grafana dashboard](https://github.com/element.-hq/synapse/tree/master/contrib/grafana/) 1. Consider using the [grafana dashboard](https://github.com/element-hq/synapse/tree/master/contrib/grafana/)
and required [recording rules](https://github.com/element.-hq/synapse/tree/master/contrib/prometheus/) and required [recording rules](https://github.com/element-hq/synapse/tree/master/contrib/prometheus/)
## Monitoring workers ## Monitoring workers

View file

@ -10,7 +10,7 @@ either the output of the module's `parse_config` static method (see below), or t
configuration associated with the module in Synapse's configuration file. configuration associated with the module in Synapse's configuration file.
See the documentation for the `ModuleApi` class See the documentation for the `ModuleApi` class
[here](https://github.com/element.-hq/synapse/blob/master/synapse/module_api/__init__.py). [here](https://github.com/element-hq/synapse/blob/master/synapse/module_api/__init__.py).
## When Synapse runs with several modules configured ## When Synapse runs with several modules configured

View file

@ -115,7 +115,7 @@ A custom mapping provider must specify the following methods:
Synapse has a built-in OpenID mapping provider if a custom provider isn't Synapse has a built-in OpenID mapping provider if a custom provider isn't
specified in the config. It is located at specified in the config. It is located at
[`synapse.handlers.oidc.JinjaOidcMappingProvider`](https://github.com/element.-hq/synapse/blob/develop/synapse/handlers/oidc.py). [`synapse.handlers.oidc.JinjaOidcMappingProvider`](https://github.com/element-hq/synapse/blob/develop/synapse/handlers/oidc.py).
## SAML Mapping Providers ## SAML Mapping Providers
@ -202,4 +202,4 @@ A custom mapping provider must specify the following methods:
Synapse has a built-in SAML mapping provider if a custom provider isn't Synapse has a built-in SAML mapping provider if a custom provider isn't
specified in the config. It is located at specified in the config. It is located at
[`synapse.handlers.saml.DefaultSamlMappingProvider`](https://github.com/element.-hq/synapse/blob/develop/synapse/handlers/saml.py). [`synapse.handlers.saml.DefaultSamlMappingProvider`](https://github.com/element-hq/synapse/blob/develop/synapse/handlers/saml.py).

View file

@ -6,10 +6,10 @@ well as a `matrix-synapse-worker@` service template for any workers you
require. Additionally, to group the required services, it sets up a require. Additionally, to group the required services, it sets up a
`matrix-synapse.target`. `matrix-synapse.target`.
See the folder [system](https://github.com/element.-hq/synapse/tree/develop/docs/systemd-with-workers/system/) See the folder [system](https://github.com/element-hq/synapse/tree/develop/docs/systemd-with-workers/system/)
for the systemd unit files. for the systemd unit files.
The folder [workers](https://github.com/element.-hq/synapse/tree/develop/docs/systemd-with-workers/workers/) The folder [workers](https://github.com/element-hq/synapse/tree/develop/docs/systemd-with-workers/workers/)
contains an example configuration for the `generic_worker` worker. contains an example configuration for the `generic_worker` worker.
## Synapse configuration files ## Synapse configuration files
@ -33,7 +33,7 @@ There is no need for a separate configuration file for the master process.
## Set up ## Set up
1. Adjust synapse configuration files as above. 1. Adjust synapse configuration files as above.
1. Copy the `*.service` and `*.target` files in [system](https://github.com/element.-hq/synapse/tree/develop/docs/systemd-with-workers/system/) 1. Copy the `*.service` and `*.target` files in [system](https://github.com/element-hq/synapse/tree/develop/docs/systemd-with-workers/system/)
to `/etc/systemd/system`. to `/etc/systemd/system`.
1. Run `systemctl daemon-reload` to tell systemd to load the new unit files. 1. Run `systemctl daemon-reload` to tell systemd to load the new unit files.
1. Run `systemctl enable matrix-synapse.service`. This will configure the 1. Run `systemctl enable matrix-synapse.service`. This will configure the
@ -74,7 +74,7 @@ systemctl restart matrix-synapse.target
**Optional:** If further hardening is desired, the file **Optional:** If further hardening is desired, the file
`override-hardened.conf` may be copied from `override-hardened.conf` may be copied from
[contrib/systemd/override-hardened.conf](https://github.com/element.-hq/synapse/tree/develop/contrib/systemd/) [contrib/systemd/override-hardened.conf](https://github.com/element-hq/synapse/tree/develop/contrib/systemd/)
in this repository to the location in this repository to the location
`/etc/systemd/system/matrix-synapse.service.d/override-hardened.conf` (the `/etc/systemd/system/matrix-synapse.service.d/override-hardened.conf` (the
directory may have to be created). It enables certain sandboxing features in directory may have to be created). It enables certain sandboxing features in

View file

@ -3,7 +3,7 @@
Synapse uses parametrised templates to generate the content of emails it sends and Synapse uses parametrised templates to generate the content of emails it sends and
webpages it shows to users. webpages it shows to users.
By default, Synapse will use the templates listed [here](https://github.com/element.-hq/synapse/tree/master/synapse/res/templates). By default, Synapse will use the templates listed [here](https://github.com/element-hq/synapse/tree/master/synapse/res/templates).
Server admins can configure an additional directory for Synapse to look for templates Server admins can configure an additional directory for Synapse to look for templates
in, allowing them to specify custom templates: in, allowing them to specify custom templates:

View file

@ -1068,7 +1068,7 @@ As announced with the release of [Synapse 1.47.0](#deprecation-of-the-user_may_c
the deprecated `user_may_create_room_with_invites` module callback has been removed. the deprecated `user_may_create_room_with_invites` module callback has been removed.
Modules relying on it can instead implement [`user_may_invite`](https://element-hq.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite) Modules relying on it can instead implement [`user_may_invite`](https://element-hq.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite)
and use the [`get_room_state`](https://github.com/element.-hq/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876) and use the [`get_room_state`](https://github.com/element-hq/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876)
module API to infer whether the invite is happening while creating a room (see [this function](https://github.com/matrix-org/synapse-domain-rule-checker/blob/e7d092dd9f2a7f844928771dbfd9fd24c2332e48/synapse_domain_rule_checker/__init__.py#L56-L89) module API to infer whether the invite is happening while creating a room (see [this function](https://github.com/matrix-org/synapse-domain-rule-checker/blob/e7d092dd9f2a7f844928771dbfd9fd24c2332e48/synapse_domain_rule_checker/__init__.py#L56-L89)
as an example). Alternately, modules can also implement [`on_create_room`](https://element-hq.github.io/synapse/latest/modules/third_party_rules_callbacks.html#on_create_room). as an example). Alternately, modules can also implement [`on_create_room`](https://element-hq.github.io/synapse/latest/modules/third_party_rules_callbacks.html#on_create_room).
@ -1124,7 +1124,7 @@ Any scripts still using the above APIs should be converted to use the
The `user_may_create_room_with_invites` is deprecated and will be removed in a future The `user_may_create_room_with_invites` is deprecated and will be removed in a future
version of Synapse. Modules implementing this callback can instead implement version of Synapse. Modules implementing this callback can instead implement
[`user_may_invite`](https://element-hq.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite) [`user_may_invite`](https://element-hq.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite)
and use the [`get_room_state`](https://github.com/element.-hq/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876) and use the [`get_room_state`](https://github.com/element-hq/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876)
module API method to infer whether the invite is happening in the context of creating a module API method to infer whether the invite is happening in the context of creating a
room. room.
@ -1171,8 +1171,8 @@ Any scripts still using the above APIs should be converted to use the
## User-interactive authentication fallback templates can now display errors ## User-interactive authentication fallback templates can now display errors
This may affect you if you make use of custom HTML templates for the This may affect you if you make use of custom HTML templates for the
[reCAPTCHA (`synapse/res/templates/recaptcha.html`)](https://github.com/element.-hq/synapse/tree/develop/synapse/res/templates/recaptcha.html) or [reCAPTCHA (`synapse/res/templates/recaptcha.html`)](https://github.com/element-hq/synapse/tree/develop/synapse/res/templates/recaptcha.html) or
[terms (`synapse/res/templates/terms.html`)](https://github.com/element.-hq/synapse/tree/develop/synapse/res/templates/terms.html) fallback pages. [terms (`synapse/res/templates/terms.html`)](https://github.com/element-hq/synapse/tree/develop/synapse/res/templates/terms.html) fallback pages.
The template is now provided an `error` variable if the authentication The template is now provided an `error` variable if the authentication
process failed. See the default templates linked above for an example. process failed. See the default templates linked above for an example.
@ -1671,7 +1671,7 @@ update your reverse proxy configuration to reflect this change.
## New HTML templates ## New HTML templates
A new HTML template, A new HTML template,
[password_reset_confirmation.html](https://github.com/element.-hq/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html), [password_reset_confirmation.html](https://github.com/element-hq/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html),
has been added to the `synapse/res/templates` directory. If you are has been added to the `synapse/res/templates` directory. If you are
using a custom template directory, you may want to copy the template using a custom template directory, you may want to copy the template
over and modify it. over and modify it.
@ -1770,7 +1770,7 @@ New templates (`sso_auth_confirm.html`, `sso_auth_success.html`, and
is configured to use SSO and a custom is configured to use SSO and a custom
`sso_redirect_confirm_template_dir` configuration then these templates `sso_redirect_confirm_template_dir` configuration then these templates
will need to be copied from will need to be copied from
[`synapse/res/templates`](https://github.com/element.-hq/synapse/tree/develop/synapse/res/templates) into that directory. [`synapse/res/templates`](https://github.com/element-hq/synapse/tree/develop/synapse/res/templates) into that directory.
## Synapse SSO Plugins Method Deprecation ## Synapse SSO Plugins Method Deprecation
@ -1923,7 +1923,7 @@ included.
Synapse will expect these files to exist inside the configured template Synapse will expect these files to exist inside the configured template
directory, and **will fail to start** if they are absent. To view the directory, and **will fail to start** if they are absent. To view the
default templates, see default templates, see
[synapse/res/templates](https://github.com/element.-hq/synapse/tree/master/synapse/res/templates). [synapse/res/templates](https://github.com/element-hq/synapse/tree/master/synapse/res/templates).
## 3pid verification changes ## 3pid verification changes

View file

@ -1,6 +1,6 @@
# Request log format # Request log format
HTTP request logs are written by synapse (see [`synapse/http/site.py`](https://github.com/element.-hq/synapse/tree/develop/synapse/http/site.py) for details). HTTP request logs are written by synapse (see [`synapse/http/site.py`](https://github.com/element-hq/synapse/tree/develop/synapse/http/site.py) for details).
See the following for how to decode the dense data available from the default logging configuration. See the following for how to decode the dense data available from the default logging configuration.

View file

@ -3,12 +3,12 @@
It is possible to monitor much of the internal state of Synapse using [Prometheus](https://prometheus.io) It is possible to monitor much of the internal state of Synapse using [Prometheus](https://prometheus.io)
metrics and [Grafana](https://grafana.com/). metrics and [Grafana](https://grafana.com/).
A guide for configuring Synapse to provide metrics is available [here](../../metrics-howto.md) A guide for configuring Synapse to provide metrics is available [here](../../metrics-howto.md)
and information on setting up Grafana is [here](https://github.com/element.-hq/synapse/tree/master/contrib/grafana). and information on setting up Grafana is [here](https://github.com/element-hq/synapse/tree/master/contrib/grafana).
In this setup, Prometheus will periodically scrape the information Synapse provides and In this setup, Prometheus will periodically scrape the information Synapse provides and
store a record of it over time. Grafana is then used as an interface to query and store a record of it over time. Grafana is then used as an interface to query and
present this information through a series of pretty graphs. present this information through a series of pretty graphs.
Once you have grafana set up, and assuming you're using [our grafana dashboard template](https://github.com/element.-hq/synapse/blob/master/contrib/grafana/synapse.json), look for the following graphs when debugging a slow/overloaded Synapse: Once you have grafana set up, and assuming you're using [our grafana dashboard template](https://github.com/element-hq/synapse/blob/master/contrib/grafana/synapse.json), look for the following graphs when debugging a slow/overloaded Synapse:
## Message Event Send Time ## Message Event Send Time
@ -57,7 +57,7 @@ Cross-referencing this with the Eviction Rate graph, which shows that entries ar
![image](https://user-images.githubusercontent.com/1342360/82240766-de95df80-9932-11ea-8c15-5acfc57c48da.png) ![image](https://user-images.githubusercontent.com/1342360/82240766-de95df80-9932-11ea-8c15-5acfc57c48da.png)
we should probably consider raising the size of that cache by raising its cache factor (a multiplier value for the size of an individual cache). Information on doing so is available [here](https://github.com/element.-hq/synapse/blob/ee421e524478c1ad8d43741c27379499c2f6135c/docs/sample_config.yaml#L608-L642) (note that the configuration of individual cache factors through the configuration file is available in Synapse v1.14.0+, whereas doing so through environment variables has been supported for a very long time). Note that this will increase Synapse's overall memory usage. we should probably consider raising the size of that cache by raising its cache factor (a multiplier value for the size of an individual cache). Information on doing so is available [here](https://github.com/element-hq/synapse/blob/ee421e524478c1ad8d43741c27379499c2f6135c/docs/sample_config.yaml#L608-L642) (note that the configuration of individual cache factors through the configuration file is available in Synapse v1.14.0+, whereas doing so through environment variables has been supported for a very long time). Note that this will increase Synapse's overall memory usage.
## Forward Extremities ## Forward Extremities

View file

@ -1416,7 +1416,7 @@ kill -HUP [PID_OF_SYNAPSE_PROCESS]
If you are running multiple workers, you must individually update the worker If you are running multiple workers, you must individually update the worker
config file and send this signal to each worker process. config file and send this signal to each worker process.
If you're using the [example systemd service](https://github.com/element.-hq/synapse/blob/develop/contrib/systemd/matrix-synapse.service) If you're using the [example systemd service](https://github.com/element-hq/synapse/blob/develop/contrib/systemd/matrix-synapse.service)
file in Synapse's `contrib` directory, you can send a `SIGHUP` signal by using file in Synapse's `contrib` directory, you can send a `SIGHUP` signal by using
`systemctl reload matrix-synapse`. `systemctl reload matrix-synapse`.

View file

@ -36,17 +36,17 @@ following documentation:
* Read the [Contributing Guide](development/contributing_guide.md). It is meant * Read the [Contributing Guide](development/contributing_guide.md). It is meant
to walk new contributors through the process of developing and submitting a to walk new contributors through the process of developing and submitting a
change to the Synapse codebase (which is [hosted on change to the Synapse codebase (which is [hosted on
GitHub](https://github.com/element.-hq/synapse)). GitHub](https://github.com/element-hq/synapse)).
* Set up your [development * Set up your [development
environment](development/contributing_guide.md#2-what-do-i-need), then learn environment](development/contributing_guide.md#2-what-do-i-need), then learn
how to [lint](development/contributing_guide.md#run-the-linters) and how to [lint](development/contributing_guide.md#run-the-linters) and
[test](development/contributing_guide.md#8-test-test-test) your code. [test](development/contributing_guide.md#8-test-test-test) your code.
* Look at [the issue tracker](https://github.com/element.-hq/synapse/issues) for * Look at [the issue tracker](https://github.com/element-hq/synapse/issues) for
bugs to fix or features to add. If you're new, it may be best to start with bugs to fix or features to add. If you're new, it may be best to start with
those labeled [good first those labeled [good first
issue](https://github.com/element.-hq/synapse/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). issue](https://github.com/element-hq/synapse/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).
* Understand [how Synapse is * Understand [how Synapse is
built](development/internal_documentation/index.html), how to [migrate built](development/internal_documentation/index.html), how to [migrate
@ -58,7 +58,7 @@ following documentation:
do so! do so!
* And finally, contribute to this documentation! The source for which is * And finally, contribute to this documentation! The source for which is
[located here](https://github.com/element.-hq/synapse/tree/develop/docs). [located here](https://github.com/element-hq/synapse/tree/develop/docs).
## Reporting a security vulnerability ## Reporting a security vulnerability

View file

@ -4,6 +4,6 @@ set -e
# Fetch the current GitHub issue number, add one to it -- presto! The likely # Fetch the current GitHub issue number, add one to it -- presto! The likely
# next PR number. # next PR number.
CURRENT_NUMBER=$(curl -s "https://api.github.com/repos/element.-hq/synapse/issues?state=all&per_page=1" | jq -r ".[0].number") CURRENT_NUMBER=$(curl -s "https://api.github.com/repos/element-hq/synapse/issues?state=all&per_page=1" | jq -r ".[0].number")
CURRENT_NUMBER=$((CURRENT_NUMBER+1)) CURRENT_NUMBER=$((CURRENT_NUMBER+1))
echo $CURRENT_NUMBER echo $CURRENT_NUMBER

View file

@ -293,7 +293,7 @@ def _prepare() -> None:
print("Opening the changelog in your browser...") print("Opening the changelog in your browser...")
print("Please ask #synapse-dev to give it a check.") print("Please ask #synapse-dev to give it a check.")
click.launch( click.launch(
f"https://github.com/element.-hq/synapse/blob/{synapse_repo.active_branch.name}/CHANGES.md" f"https://github.com/element-hq/synapse/blob/{synapse_repo.active_branch.name}/CHANGES.md"
) )
@ -361,18 +361,18 @@ def _tag(gh_token: Optional[str]) -> None:
print("As this is an RC, remember to mark it as a pre-release!") print("As this is an RC, remember to mark it as a pre-release!")
print("(by the way, this step can be automated by passing --gh-token,") print("(by the way, this step can be automated by passing --gh-token,")
print("or one of the GH_TOKEN or GITHUB_TOKEN env vars.)") print("or one of the GH_TOKEN or GITHUB_TOKEN env vars.)")
click.launch(f"https://github.com/element.-hq/synapse/releases/edit/{tag_name}") click.launch(f"https://github.com/element-hq/synapse/releases/edit/{tag_name}")
print("Once done, you need to wait for the release assets to build.") print("Once done, you need to wait for the release assets to build.")
if click.confirm("Launch the release assets actions page?", default=True): if click.confirm("Launch the release assets actions page?", default=True):
click.launch( click.launch(
f"https://github.com/element.-hq/synapse/actions?query=branch%3A{tag_name}" f"https://github.com/element-hq/synapse/actions?query=branch%3A{tag_name}"
) )
return return
# Create a new draft release # Create a new draft release
gh = Github(gh_token) gh = Github(gh_token)
gh_repo = gh.get_repo("element.-hq/synapse") gh_repo = gh.get_repo("element-hq/synapse")
release = gh_repo.create_git_release( release = gh_repo.create_git_release(
tag=tag_name, tag=tag_name,
name=tag_name, name=tag_name,
@ -385,7 +385,7 @@ def _tag(gh_token: Optional[str]) -> None:
print("Launching the release page and the actions page.") print("Launching the release page and the actions page.")
click.launch(release.html_url) click.launch(release.html_url)
click.launch( click.launch(
f"https://github.com/element.-hq/synapse/actions?query=branch%3A{tag_name}" f"https://github.com/element-hq/synapse/actions?query=branch%3A{tag_name}"
) )
click.echo("Wait for release assets to be built") click.echo("Wait for release assets to be built")
@ -411,7 +411,7 @@ def _publish(gh_token: str) -> None:
# Publish the draft release # Publish the draft release
gh = Github(gh_token) gh = Github(gh_token)
gh_repo = gh.get_repo("element.-hq/synapse") gh_repo = gh.get_repo("element-hq/synapse")
for release in gh_repo.get_releases(): for release in gh_repo.get_releases():
if release.title == tag_name: if release.title == tag_name:
break break
@ -454,7 +454,7 @@ def _upload(gh_token: Optional[str]) -> None:
# Query all the assets corresponding to this release. # Query all the assets corresponding to this release.
gh = Github(gh_token) gh = Github(gh_token)
gh_repo = gh.get_repo("element.-hq/synapse") gh_repo = gh.get_repo("element-hq/synapse")
gh_release = gh_repo.get_release(tag_name) gh_release = gh_repo.get_release(tag_name)
all_assets = set(gh_release.get_assets()) all_assets = set(gh_release.get_assets())
@ -543,9 +543,7 @@ def _wait_for_actions(gh_token: Optional[str]) -> None:
# Authentication is optional on this endpoint, # Authentication is optional on this endpoint,
# but use a token if we have one to reduce the chance of being rate-limited. # but use a token if we have one to reduce the chance of being rate-limited.
url = ( url = f"https://api.github.com/repos/element-hq/synapse/actions/runs?branch={tag_name}"
f"https://api.github.com/repos/element.-hq/synapse/actions/runs?branch={tag_name}"
)
headers = {"Accept": "application/vnd.github+json"} headers = {"Accept": "application/vnd.github+json"}
if gh_token is not None: if gh_token is not None:
headers["authorization"] = f"token {gh_token}" headers["authorization"] = f"token {gh_token}"
@ -660,7 +658,7 @@ def _announce() -> None:
f""" f"""
Hi everyone. Synapse {current_version} has just been released. Hi everyone. Synapse {current_version} has just been released.
[notes](https://github.com/element.-hq/synapse/releases/tag/{tag_name}) | \ [notes](https://github.com/element-hq/synapse/releases/tag/{tag_name}) | \
[docker](https://hub.docker.com/r/vectorim/synapse/tags?name={tag_name}) | \ [docker](https://hub.docker.com/r/vectorim/synapse/tags?name={tag_name}) | \
[debs](https://packages.matrix.org/debian/) | \ [debs](https://packages.matrix.org/debian/) | \
[pypi](https://pypi.org/project/matrix-synapse/{current_version}/)""" [pypi](https://pypi.org/project/matrix-synapse/{current_version}/)"""
@ -691,7 +689,7 @@ Ask the designated people to do the blog and tweets."""
def full(gh_token: str) -> None: def full(gh_token: str) -> None:
click.echo("1. If this is a security release, read the security wiki page.") click.echo("1. If this is a security release, read the security wiki page.")
click.echo("2. Check for any release blockers before proceeding.") click.echo("2. Check for any release blockers before proceeding.")
click.echo(" https://github.com/element.-hq/synapse/labels/X-Release-Blocker") click.echo(" https://github.com/element-hq/synapse/labels/X-Release-Blocker")
click.echo( click.echo(
"3. Check for any other special release notes, including announcements to add to the changelog or special deployment instructions." "3. Check for any other special release notes, including announcements to add to the changelog or special deployment instructions."
) )
@ -895,7 +893,7 @@ def build_dependabot_changelog(repo: Repo, current_version: version.Version) ->
def replacer(match: Match[str]) -> str: def replacer(match: Match[str]) -> str:
desc = match.group(1) desc = match.group(1)
number = match.group(2) number = match.group(2)
return f"* {desc}. ([\\#{number}](https://github.com/element.-hq/synapse/issues/{number}))" return f"* {desc}. ([\\#{number}](https://github.com/element-hq/synapse/issues/{number}))"
for i, message in enumerate(messages): for i, message in enumerate(messages):
messages[i] = re.sub(r"(.*) \(#(\d+)\)$", replacer, message) messages[i] = re.sub(r"(.*) \(#(\d+)\)$", replacer, message)