← Back to Pull requests

[CI] make the Test Python Client operator build retry actually retry #5306

Closed
unknown closed this pull request without merging on Sep 21, 2026 23:10 UTC
View on GitHub
unknown unknown commented on Sep 17, 2026 02:09 UTC
Author

<!-- Thank you for your contribution! -->

<!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. -->

Why are these changes needed?

In https://github.com/ray-project/kuberay/pull/4873, we added a retry mechanism to handle transient CI failures such as 504 Gateway Time-out.

However, in Build #17141, the build failed with a TLS handshake timeout, but the retry was not triggered:

[2026-09-16T17:03:39Z]  => ERROR [builder  5/15] RUN go mod download                                                                                                             15.9s
--
  | [2026-09-16T17:03:39Z] ------
  | [2026-09-16T17:03:39Z]  > [builder  5/15] RUN go mod download:
  | [2026-09-16T17:03:39Z] 11.70 go: sigs.k8s.io/scheduler-plugins@v0.33.5: Get "https://storage.googleapis.com/proxy-golang-org-prod/2e7ffdabb7d37255-sigs.k8s.io:scheduler-plugins-v0.33.5.zip?Expires=1789664605&GoogleAccessId=gcs-urlsigner-prod%40golang-modproxy.iam.gserviceaccount.com&Signature=F7EozsY0pTo2wKqglJ8dQ3TqbPVe1U%2BrQOKmwRVIsY51nZA%2FSHBYi7T4n5O6dfjaS20bgiGEWf7McFjBZi3mOri0mduwgZPZp4PQVRrXa%2FqCQM9WQ1iR6DGDVMCvookD3X5VTt1MTxo0Y7SDXrfltXot6Lx%2FVrSE4I8NvvbBb9KyOnp0EohL70%2BpZ0oZFDjUXdSfg4kJXHZSRw3uY1G%2BSWbOjrCefHkFwkyw1KZ0EgL1DoKld81tilRZ0ocbW0Xwh8989UJj0%2BSJ2VdjEpUZoAYqb%2BkFLmOIK%2FxH1%2B4pXFYfaoT7QgKFxnA5hsZ7GW9FYu3eL5lvSmN3qlnV93bdUA%3D%3D": net/http: TLS handshake timeout
  | [2026-09-16T17:03:39Z] ------
  | [2026-09-16T17:03:39Z] Dockerfile:10
  | [2026-09-16T17:03:39Z] --------------------
  | [2026-09-16T17:03:39Z]    8 \|     # cache deps before building and copying source so that we don't need to re-download as much
  | [2026-09-16T17:03:39Z]    9 \|     # and so that source changes don't invalidate our downloaded layer
  | [2026-09-16T17:03:39Z]   10 \| >>> RUN go mod download
  | [2026-09-16T17:03:39Z]   11 \|
  | [2026-09-16T17:03:39Z]   12 \|     # Copy the go source
  | [2026-09-16T17:03:39Z] --------------------
  | [2026-09-16T17:03:39Z] ERROR: failed to build: failed to solve: process "/bin/sh -c go mod download" did not complete successfully: exit code: 1
  | [2026-09-16T17:03:39Z] make: *** [Makefile:138: docker-image] Error 1
  | [2026-09-16T17:03:39Z] ERROR: image: "kuberay/operator:nightly" not present locally
  | [2026-09-16T17:03:39Z] Deploying operator with test overrides (feature gates via test-overrides overlay)

There are two issues with this:

1. source executes the script in the current shell. Since it is used as an if condition, errexit (set -e) is ignored for commands executed by the sourced script, so the script can continue after make docker-image fails.

-e

> Exit immediately if a pipeline (see Pipelines), which may consist of a single simple command (see Simple Commands), a list (see Lists of Commands), or a compound command (see Compound Commands) returns a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command’s return status is being inverted with !. If a compound command other than a subshell returns a non-zero status because a command failed while -e was being ignored, the shell does not exit. A trap on ERR, if set, is executed before the shell exits.

https://stackoverflow.com/a/76866330

2. source returns the exit status of the last command executed. If a later command succeeds, the earlier build failure is effectively hidden and source returns 0, causing the retry loop to exit successfully.

Fix

Use bash instead of source, this preserves the script's set -e behavior, so a failed command causes the script to exit with a non-zero status and correctly triggers the retry logic.

Also verified in https://buildkite.com/ray-project/ray-ecosystem-ci-kuberay-ci/builds/17152/canvas?jid=01a0ad21-033a-45b8-b5d7-446ef8714d45&tab=output that the retry mechanism works as expected and successfully retries after the initial failure.

Running 20 times in https://buildkite.com/ray-project/ray-ecosystem-ci-kuberay-ci/builds/17185/canvas

Related issue number

Closes #5303

Labels

<!-- Please add the appropriate labels to this PR. -->

  • If this PR has user-facing changes that require documentation updates at release time, I have added the doc-updates-required label.

  • If this PR contains breaking changes, I have added the breaking-change label.
  • Checks

  • I've made sure the tests are passing.

  • Testing Strategy

  • - [x] Unit tests
    - [x] Manual tests
    - [ ] This PR is not tested :(

    <!-- If you selected "Manual tests" above, please fill in the section below. Otherwise you can remove it. -->

    Manual test instructions

    <!--
    Provide step-by-step instructions so reviewers can verify your changes.
    Include any relevant screenshots or logs demonstrating the behavior.
    -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: win5923 Review duration: 7021m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5306"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%