#!/usr/bin/env bash # set -euo pipefail IFS=$'\n\t' DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" function main() { local payload sha256signature sha1signature WEBHOOK_BRIDGE_HMAC_SECRET payload=$(cat local_payload.json) WEBHOOK_BRIDGE_HMAC_SECRET="$(decrypt_k8s_secret -n webhook-bridge webhook-bridge | jq -r '.HMAC_TOKEN')" sha256signature=$(openssl sha256 -hmac "$WEBHOOK_BRIDGE_HMAC_SECRET" <<<"$payload" | awk '{print $2}') sha1signature=$(openssl sha1 -hmac "$WEBHOOK_BRIDGE_HMAC_SECRET" <<<"$payload" | awk '{print $2}') curl -v \ --http2-prior-knowledge \ -X POST \ -H 'Content-Type: application/json' \ -H 'X-GitHub-Delivery: 90c4c994-dd31-4a21-8902-92aa76a10e53' \ -H 'X-GitHub-Event: push' \ -H 'X-GitHub-Event-Type: push' \ -H 'X-Gitea-Delivery: 90c4c994-dd31-4a21-8902-92aa76a10e53' \ -H 'X-Gitea-Event: push' \ -H 'X-Gitea-Event-Type: push' \ -H "X-Gitea-Signature: $sha256signature" \ -H 'X-Gogs-Delivery: 90c4c994-dd31-4a21-8902-92aa76a10e53' \ -H 'X-Gogs-Event: push' \ -H 'X-Gogs-Event-Type: push' \ -H "X-Gogs-Signature: $sha256signature" \ -H "X-Hub-Signature: sha1=$sha1signature" \ -H "X-Hub-Signature-256: sha256=$sha256signature" \ -d @- \ 'http://127.0.0.1:9988/hook' <<<"$payload" } main "${@}"