github-actions[bot] commented on code in PR #66194:
URL: https://github.com/apache/doris/pull/66194#discussion_r3709414257
##########
regression-test/pipeline/common/teamcity-utils.sh:
##########
@@ -159,6 +159,51 @@ get_queue_build_of_pr() {
}
# get_queue_build_of_pr "$1" "$2"
+get_active_builds_of_revision() {
+ # Return active build IDs for the same PR, pipeline, and revision.
+ # Return 0 when a duplicate exists, 1 when none exists, and 2 when lookup
fails.
+ local PULL_REQUEST_NUM="${PULL_REQUEST_NUM:-$1}"
+ local COMMENT_TRIGGER_TYPE="${COMMENT_TRIGGER_TYPE:-$2}"
+ local COMMIT_ID_FROM_TRIGGER="${COMMIT_ID_FROM_TRIGGER:-$3}"
+ if [[ -z "${PULL_REQUEST_NUM}" ||
+ -z "${COMMENT_TRIGGER_TYPE}" ||
+ -z "${COMMIT_ID_FROM_TRIGGER}" ]]; then
+ echo "Usage: get_active_builds_of_revision PULL_REQUEST_NUM
COMMENT_TRIGGER_TYPE COMMIT_ID_FROM_TRIGGER" >&2
+ return 2
+ fi
+
+ local queue_build_ids
+ local running_build_ids
+ if ! queue_build_ids=$(get_queue_build_of_pr "${PULL_REQUEST_NUM}"
"${COMMENT_TRIGGER_TYPE}"); then
Review Comment:
[P2] Propagate REST and JSON failures into lookup status
This function promises status 2 when the lookup fails, but the helpers it
calls use `curl -s` without failing on non-2xx responses and do not propagate
their `jq` failures. For example, when both list requests return
`{"message":"Internal Server Error"}`, each helper prints a `jq` error but
returns 0 with no IDs, so this function returns 1 (clean no-match) and line 359
never emits the intended fail-open warning. Build-detail errors or missing
revisions similarly become a successful `null` revision. Please make the REST
calls fail on non-2xx responses, validate the JSON/revision fields, and
propagate status 2 so an unavailable duplicate check is not silently reported
as a proven no-match.
##########
regression-test/pipeline/common/teamcity-utils.sh:
##########
@@ -300,6 +345,21 @@ trigger_or_skip_build() {
fi
if [[ "${FILE_CHANGED:-"true"}" == "true" ]]; then
+ local duplicate_build_ids
+ local duplicate_lookup_status=0
+ duplicate_build_ids=$(
+ get_active_builds_of_revision \
+ "${PULL_REQUEST_NUM}" \
+ "${COMMENT_TRIGGER_TYPE}" \
+ "${COMMIT_ID_FROM_TRIGGER}"
+ ) || duplicate_lookup_status=$?
+ if [[ ${duplicate_lookup_status} -eq 0 ]]; then
+ echo "INFO: active build(s) ${duplicate_build_ids//$'\n'/,}
already exist for PR ${PULL_REQUEST_NUM}, pipeline ${COMMENT_TRIGGER_TYPE},
revision ${COMMIT_ID_FROM_TRIGGER}; skip duplicate trigger"
+ return 0
+ elif [[ ${duplicate_lookup_status} -ne 1 ]]; then
+ echo "WARNING: duplicate lookup failed for PR ${PULL_REQUEST_NUM},
pipeline ${COMMENT_TRIGGER_TYPE}; continue with the existing trigger flow"
Review Comment:
[P1] Actually fail open after this lookup warning
These workflow steps use GitHub's default Linux `bash -e`, so saying
“continue” here does not guarantee that the trigger is attempted. When the
duplicate lookup returns 2 because TeamCity is unreachable, line 363
immediately repeats a listing request inside `cancel_running_build`; if that
request also fails, the helper returns 1 and errexit terminates the step before
`cancel_queue_build` or `trigger_build`. I reproduced this with curl status 7:
this warning printed, the wrapper exited 1, and no trigger marker was reached.
Please make the cancellation calls explicitly best-effort in the status-2
fallback (capture and warn on each failure) while still attempting
`trigger_build`, and cover the path with an errexit-enabled fixture.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]