system-config/playbooks/roles/matrix-gerritbot
Tristan Cacqueray 990b9c1905 Update the gerritbot-matrix image to support arbitrary uid with docker
This change pulls in https://softwarefactory-project.io/r/c/software-factory/gerritbot-matrix/+/23348 to achieve abritary uid with docker.

Change-Id: I43198af4feebd7f175ffdede376e2e4d19928d62
2021-12-06 20:36:11 +00:00
..
defaults Update the gerritbot-matrix image to support arbitrary uid with docker 2021-12-06 20:36:11 +00:00
files Move #zuul from OFTC to Matrix 2021-08-20 14:44:44 -07:00
tasks Run matrix-gerritbot with gerritbot user 2021-11-05 11:24:10 -07:00
templates Update the gerritbot-matrix image to support arbitrary uid with docker 2021-12-06 20:36:11 +00:00
README.rst Add matrix term accept instruction 2021-08-20 18:06:15 +00:00

README.rst

Run the gerritbot-matrix bot.

Create the gerritbot_matrix_access_token with this command:

HOMESERVER_URL="https://opendev.ems.host"
USER="@gerritbot:opendev.org"
PASS="supersecret"

export MATRIX_TOKEN=$(curl -XPOST ${HOMESERVER_URL}/_matrix/client/r0/login -d '{"user": "'${USER}'", "password": "'${PASS}'", "type": "m.login.password"}' | jq -r ".access_token")
echo "gerritbot_matrix_access_token: ${MATRIX_TOKEN}"

Verify the token:

curl -H "Authorization: Bearer ${MATRIX_TOKEN}" ${HOMESERVER_URL}/_matrix/client/r0/account/whoami

Delete the token:

curl -H "Authorization: Bearer ${MATRIX_TOKEN}" -X POST ${HOMESERVER_URL}/_matrix/client/r0/logout -d{}

Create the gerritbot_matrix_identity_token with this command:

MATRIX_OPENID=$(curl -XPOST ${HOMESERVER_URL}/_matrix/client/r0/user/${USER}/openid/request_token -H "Authorization: Bearer ${MATRIX_TOKEN}" -d '{}')
IDENTITY_URL="https://matrix.org"

export MATRIX_IDENTITY_TOKEN=$(curl -XPOST ${IDENTITY_URL}/_matrix/identity/v2/account/register -d "${MATRIX_OPENID}" | jq -r '.access_token')
echo "gerritbot_matrix_identity_token: ${MATRIX_IDENTITY_TOKEN}"

You might need to accept matrix terms:

curl -H "Authorization: Bearer ${MATRIX_IDENTITY_TOKEN}" ${IDENTITY_URL}/_matrix/identity/v2/terms
curl -XPOST ${IDENTITY_URL}/_matrix/identity/v2/terms -H "Authorization: Bearer ${MATRIX_IDENTITY_TOKEN}" -d \
  '{"user_accepts": ["https://matrix.org/legal/identity-server-privacy-notice-1"]}'