blob: 943aec859b73c3a89786ff846d3762def9e58719 [file] [log] [blame]
Serge Bazanski7f5f2092023-10-08 14:01:04 +00001#!/usr/bin/env bash
2set -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
7if [ -z "$FORGEJO_TOKEN" ]; then
8 echo "FORGEJO_TOKEN must be set" > /dev/stderr
9 exit 1
10fi
11
12# The gerrit image has no curl. But where we're going, we don't need curl.
13auth="$(echo -ne "gerrit:$FORGEJO_TOKEN" | base64)"
14openssl s_client -quiet -crlf -connect git.hackerspace.pl:443 <<EOF
15POST /api/v1/repos/hswaw/hscloud/mirror-sync HTTP/1.1
16Host: git.hackerspace.pl
17Authorization: Basic $auth
18Content-length: 0
19Connection: Close
20
21EOF