Serge Bazanski | 7f5f209 | 2023-10-08 14:01:04 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
| 4 | # This will be ran by Gerrit any time a new Git commit is pushed, and will make |
| 5 | # Forgejo pull our changes. |
| 6 | |
| 7 | if [ -z "$FORGEJO_TOKEN" ]; then |
| 8 | echo "FORGEJO_TOKEN must be set" > /dev/stderr |
| 9 | exit 1 |
| 10 | fi |
| 11 | |
| 12 | # The gerrit image has no curl. But where we're going, we don't need curl. |
| 13 | auth="$(echo -ne "gerrit:$FORGEJO_TOKEN" | base64)" |
| 14 | openssl s_client -quiet -crlf -connect git.hackerspace.pl:443 <<EOF |
| 15 | POST /api/v1/repos/hswaw/hscloud/mirror-sync HTTP/1.1 |
| 16 | Host: git.hackerspace.pl |
| 17 | Authorization: Basic $auth |
| 18 | Content-length: 0 |
| 19 | Connection: Close |
| 20 | |
| 21 | EOF |