#!/bin/bash

set -eo pipefail
generate_post_data()
{
  cat <<EOF
  {
    "commit": "HEAD",
    "branch": "$BUILDKITE_BRANCH",
    "message": "Rebuild to update chilli-sauce-netforum-services"
  }
EOF
}

curl -i -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Authorization: Bearer ${BUILDKITE_BUILDS_TOKEN}" -d "$(generate_post_data)" "https://api.buildkite.com/v2/organizations/${BUILDKITE_ORGANIZATION_SLUG}/pipelines/chilli-sauce-backend/builds"
