github-actions[bot] commented on code in PR #65813:
URL: https://github.com/apache/doris/pull/65813#discussion_r3631055737


##########
.github/workflows/comment-to-trigger-teamcity.yml:
##########
@@ -316,6 +316,9 @@ jobs:
         else
           changed="false"
         fi
+        if [[ "${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }}" == "buildall" 
]]; then
+          cancel_builds_of_pr "${{ steps.parse.outputs.PULL_REQUEST_NUM }}"

Review Comment:
   **[P1] Sweep before queuing this run's UTs**
   
   For `buildall`, the FE UT, BE UT, and Cloud UT steps above have already 
queued current-head builds on the same `pull/<PR>` branch. This revision-blind 
sweep therefore cancels those fresh builds too, and Compile's downstream chain 
does not recreate them. Run the one-time sweep before any current-run direct 
trigger (or explicitly preserve current-head build IDs), then trigger this 
run's jobs.



##########
regression-test/pipeline/common/teamcity-utils.sh:
##########
@@ -215,6 +215,33 @@ cancel_queue_build() {
 }
 # cancel_queue_build "$1" "$2"
 
+cancel_builds_of_pr() {
+    local PULL_REQUEST_NUM="${PULL_REQUEST_NUM:-$1}"
+    if [[ -z "${PULL_REQUEST_NUM}" ]]; then
+        echo "Usage: cancel_builds_of_pr PULL_REQUEST_NUM" && return 1
+    fi
+
+    local builds
+    builds=$(
+        curl -s -u OneMoreChance:OneMoreChance -H "Accept: application/json" \
+            
"http://43.132.222.7:8111/app/rest/builds?locator=branch:pull/${PULL_REQUEST_NUM},running:true";
 |
+            jq -r '.build[] | "builds/id:\(.id)"'
+        curl -s -u OneMoreChance:OneMoreChance -H "Accept: application/json" \
+            "http://43.132.222.7:8111/app/rest/buildQueue"; |
+            jq -r ".build[] | select(.branchName == 
\"pull/${PULL_REQUEST_NUM}\") | \"buildQueue/id:\(.id)\""
+    ) || return 1

Review Comment:
   **[P1] Fail closed when TeamCity requests fail**
   
   This `||` does not validate both required queries in the runner's actual 
[`bash -e` 
shell](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsshell):
 curl transport failure can be hidden by `jq` on empty input, and a failed 
first pipeline is masked when the second succeeds. The POSTs also use `curl 
-s`, which exits zero for HTTP 4xx/5xx and logs `INFO: canceled` anyway. Check 
each response independently (including HTTP status and JSON shape) and only 
trigger Compile after every discovery/cancel operation is confirmed.



##########
.github/workflows/comment-to-trigger-teamcity.yml:
##########
@@ -316,6 +316,9 @@ jobs:
         else
           changed="false"
         fi
+        if [[ "${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }}" == "buildall" 
]]; then

Review Comment:
   **[P1] Make replacement newest-run-wins**
   
   `issue_comment` runs can overlap, but each run captures the PR head only 
once and this sweep/trigger pair has no per-PR serialization. A slower old-head 
run can therefore sweep after a newer run, cancel its Compile, and then trigger 
the superseded SHA (or trigger old after the newer sweep). Serialize 
orchestration by PR and revalidate the captured head immediately before the 
destructive sweep/trigger so stale runs cannot win.



##########
regression-test/pipeline/common/teamcity-utils.sh:
##########
@@ -215,6 +215,33 @@ cancel_queue_build() {
 }
 # cancel_queue_build "$1" "$2"
 
+cancel_builds_of_pr() {
+    local PULL_REQUEST_NUM="${PULL_REQUEST_NUM:-$1}"
+    if [[ -z "${PULL_REQUEST_NUM}" ]]; then
+        echo "Usage: cancel_builds_of_pr PULL_REQUEST_NUM" && return 1
+    fi
+
+    local builds
+    builds=$(
+        curl -s -u OneMoreChance:OneMoreChance -H "Accept: application/json" \
+            
"http://43.132.222.7:8111/app/rest/builds?locator=branch:pull/${PULL_REQUEST_NUM},running:true";
 |
+            jq -r '.build[] | "builds/id:\(.id)"'
+        curl -s -u OneMoreChance:OneMoreChance -H "Accept: application/json" \
+            "http://43.132.222.7:8111/app/rest/buildQueue"; |

Review Comment:
   **[P1] Traverse the entire queued-build result**
   
   [TeamCity paginates collections at 100 records by 
default](https://www.jetbrains.com/help/teamcity/rest/locators.html), but this 
unfiltered global queue request reads only page 1 and ignores `nextHref`. On a 
busy server, a `pull/<PR>` build on a later page survives while this helper 
returns success and Compile proceeds. Follow every `nextHref` (requesting only 
needed fields), or use a server-side query that completely scopes queued builds 
to this PR, and cover a target after the first 100 entries in the stub test.



##########
regression-test/pipeline/common/teamcity-utils.sh:
##########
@@ -215,6 +215,33 @@ cancel_queue_build() {
 }
 # cancel_queue_build "$1" "$2"
 
+cancel_builds_of_pr() {
+    local PULL_REQUEST_NUM="${PULL_REQUEST_NUM:-$1}"
+    if [[ -z "${PULL_REQUEST_NUM}" ]]; then
+        echo "Usage: cancel_builds_of_pr PULL_REQUEST_NUM" && return 1
+    fi
+
+    local builds
+    builds=$(

Review Comment:
   **[P1] Close the state-transition gap before replacement**
   
   These are two non-atomic snapshots taken before any cancellation. A stale 
build can be queued during the running query, start before the queue query, and 
appear in neither list; similarly, an old Compile can enqueue downstream jobs 
after both snapshots. The function then returns success and starts the new 
chain while old work survives. Make replacement revision-aware/atomic at 
TeamCity, or cancel roots and re-enumerate until the branch is demonstrably 
quiescent before triggering Compile.



##########
regression-test/pipeline/common/teamcity-utils.sh:
##########
@@ -215,6 +215,33 @@ cancel_queue_build() {
 }
 # cancel_queue_build "$1" "$2"
 
+cancel_builds_of_pr() {
+    local PULL_REQUEST_NUM="${PULL_REQUEST_NUM:-$1}"
+    if [[ -z "${PULL_REQUEST_NUM}" ]]; then
+        echo "Usage: cancel_builds_of_pr PULL_REQUEST_NUM" && return 1
+    fi
+
+    local builds
+    builds=$(
+        curl -s -u OneMoreChance:OneMoreChance -H "Accept: application/json" \
+            
"http://43.132.222.7:8111/app/rest/builds?locator=branch:pull/${PULL_REQUEST_NUM},running:true";
 |
+            jq -r '.build[] | "builds/id:\(.id)"'
+        curl -s -u OneMoreChance:OneMoreChance -H "Accept: application/json" \
+            "http://43.132.222.7:8111/app/rest/buildQueue"; |
+            jq -r ".build[] | select(.branchName == 
\"pull/${PULL_REQUEST_NUM}\") | \"buildQueue/id:\(.id)\""
+    ) || return 1
+
+    local build
+    for build in ${builds}; do
+        curl -s -X POST \
+            -u OneMoreChance:OneMoreChance \

Review Comment:
   **[P1] Avoid new literal-auth occurrences**
   
   The [live `Check for secrets` 
job](https://github.com/apache/doris/actions/runs/29848149003/job/88693915566) 
fails on all three curl commands added by this helper (`curl-auth-user` at the 
commands beginning on lines 226, 229, and 236), so this head cannot pass the 
current CI gate. Reuse a checked pre-existing TeamCity request path or inject 
authentication from protected CI configuration instead of adding new 
literal-bearing invocations; then rerun the same base-to-head Gitleaks check.



-- 
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]

Reply via email to