Update feishu_notify.sh

This commit is contained in:
2026-02-08 20:27:06 +08:00
parent c2b86acd09
commit b00b386c21

View File

@@ -3,14 +3,13 @@ set -e
# ===== 参数校验 ===== # ===== 参数校验 =====
: "${FEISHU_WEBHOOK:?FEISHU_WEBHOOK not set}" : "${FEISHU_WEBHOOK:?FEISHU_WEBHOOK not set}"
: "${JENKINS_USER:?JENKINS_USER not set}" : "${JENKINS_API_CREDENTIAL:?JENKINS_API_CREDENTIAL not set}"
: "${JENKINS_TOKEN:?JENKINS_TOKEN not set}"
# ===== 获取构建状态 ===== # ===== 获取构建状态 =====
getBuildState() { getBuildState() {
local buildNr=$1 local buildNr=$1
curl -s -u "${JENKINS_USER}:${JENKINS_TOKEN}" \ curl -s -u "${JENKINS_API_CREDENTIAL}" \
"${JOB_URL}/${buildNr}/api/json" \ "${BUILD_URL}api/json" \
| grep -Po '"result":\s*"\K\w+' | grep -Po '"result":\s*"\K\w+'
} }