#!/usr/bin/env bash set -euo pipefail state="${1:?usage: report-status.sh }" if [ -z "${VEINSFORGE_CI_TOKEN:-}" ]; then exit 0 fi commit="${VEINSFORGE_COMMIT:-${BUILDKITE_COMMIT:-}}" if [ -z "$commit" ]; then echo "no Veins commit available for CI status" >&2 exit 0 fi base="${VEINSFORGE_BASE_URL:-https://veinsforge.top}" context="${VEINSFORGE_CI_CONTEXT:-buildkite}" body="$(jq -n \ --arg commit "$commit" \ --arg state "$state" \ --arg context "$context" \ --arg url "${BUILDKITE_BUILD_URL:-}" \ '{commit: $commit, state: $state, context: $context, url: $url}')" curl -fsS -X POST "${base%/}/api/v1/ci/status" \ -H "Authorization: Bearer ${VEINSFORGE_CI_TOKEN}" \ -H "Content-Type: application/json" \ -d "$body" >/dev/null