fix: Jenkins desktop trigger when CSRF crumb is absent (bash set -u)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,6 +52,7 @@ if [[ -n "$CRUMB_JSON" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ((${#CRUMB_HDR[@]})); then
|
||||||
if curl_post "${CRUMB_HDR[@]}" -H "Content-Type: application/x-www-form-urlencoded" \
|
if curl_post "${CRUMB_HDR[@]}" -H "Content-Type: application/x-www-form-urlencoded" \
|
||||||
"${JOB_API}/build?token=${JENKINS_TRIGGER_TOKEN}"; then
|
"${JOB_API}/build?token=${JENKINS_TRIGGER_TOKEN}"; then
|
||||||
log "빌드 큐 등록 완료 (token)"
|
log "빌드 큐 등록 완료 (token)"
|
||||||
@@ -62,6 +63,18 @@ if curl_post "${CRUMB_HDR[@]}" -H "Content-Type: application/x-www-form-urlencod
|
|||||||
log "빌드 큐 등록 완료"
|
log "빌드 큐 등록 완료"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if curl_post -H "Content-Type: application/x-www-form-urlencoded" \
|
||||||
|
"${JOB_API}/build?token=${JENKINS_TRIGGER_TOKEN}"; then
|
||||||
|
log "빌드 큐 등록 완료 (token)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if curl_post -H "Content-Type: application/x-www-form-urlencoded" "${JOB_API}/build"; then
|
||||||
|
log "빌드 큐 등록 완료"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
log "[ERROR] Jenkins build trigger failed"
|
log "[ERROR] Jenkins build trigger failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user