Files
Strartup-product/pricing/ci/gitea_status.sh
T

12 lines
696 B
Bash

#!/usr/bin/env bash
# Post a commit status to Gitea so branch protection sees the Jenkins result.
# Usage: gitea_status.sh <pending|success|failure|error> "<description>"
# Needs GITEA_TOKEN (Jenkins credential), COMMIT and BUILD_URL in the environment.
set -euo pipefail
state="$1"; desc="$2"
curl -fsS --max-time 15 -o /dev/null -X POST \
-H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/json" \
-d "{\"state\":\"${state}\",\"context\":\"continuous-integration/jenkins\",\"description\":\"${desc}\",\"target_url\":\"${BUILD_URL}\"}" \
"https://git.ssw590.abrdns.com/api/v1/repos/StartupTeam/Strartup-product/statuses/${COMMIT}"
echo "Gitea status ${state}: ${desc}"