#!/usr/bin/env bash # Post a commit status to Gitea so branch protection sees the Jenkins result. # Usage: gitea_status.sh "" # 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}"