Skip to content

ci: stop third-party artifact downloads reddening unrelated PRs - #1060

Open
jiwenc-nv wants to merge 1 commit into
mainfrom
jiwenc-nv/ci-stability
Open

ci: stop third-party artifact downloads reddening unrelated PRs#1060
jiwenc-nv wants to merge 1 commit into
mainfrom
jiwenc-nv/ci-stability

Conversation

@jiwenc-nv

@jiwenc-nv jiwenc-nv commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

CI reddens on things unrelated to the change under test: every build-ubuntu matrix entry fetches the DepthAI device firmware and the CloudXR SDKs over the network, so one transient failure at artifacts.luxonis.com or NGC fails the job. Measured over one afternoon on a 14-PR stack: 22 failed Build Ubuntu runs, 48 failed jobs. main is hit too.

Cache both artifacts, and retry the one download that curl's --retry can't cover.

  • DepthAI — restore _deps/depthai-build/resources before Configure, keyed on the DEPTHAI_COMMIT pin. Upstream's DownloadAndChecksum skips any file already on disk, so a hit makes the fetch a no-op.
  • CloudXR — cache deps/cloudxr/*.tar.gz|*.tgz inside setup-cloudxr-sdk, which both build-ubuntu and test-teleop-ros2 use. Both scripts already prefer a local tarball over NGC.
  • Restore/save are split rather than the combined actions/cache: that one saves on failed jobs too, and file(DOWNLOAD) leaves a truncated file behind on error — a half-written .fwp would satisfy the "already downloaded" check forever.
  • download_cloudxr_runtime_sdk.sh retries the whole listed→unlisted sweep, not each request. A 404 on an individual remote name is how the script discovers the published name, so per-request retry would add delay to every successful run.

fail-fast is left alone: it amplifies flakes but doesn't cause them, and disabling it burns runner minutes on genuine compile errors.

Closes #1049

Testing

  • Stubbed curl: all-404 → 3 sweeps, 12 requests, exit 1; first-candidate hit → 1 request, 0 s added.
  • Cold- and warm-cache CI runs on this PR are the real check — the cache keys can only be verified against the Actions cache service.

Summary by CodeRabbit

  • Performance

    • Faster, more reliable builds by caching CloudXR SDK and DepthAI firmware downloads.
  • Bug Fixes

    • Improved CloudXR SDK retrieval with fallback resources and automatic retries.
    • Partial downloads are cleared between attempts to prevent failed installations.
    • Enhanced failure reporting after repeated download attempts.

Every build-ubuntu matrix entry fetched the DepthAI device firmware and the
CloudXR SDKs from the network, so a transient failure at artifacts.luxonis.com
or NGC failed a job that had nothing to do with the change under test — 22 red
Build Ubuntu runs in one afternoon, and main was hit too.

Cache both. depthai-core's DownloadAndChecksum skips any file already on disk,
so restoring its resources/ makes the fetch a no-op; the CloudXR scripts
already prefer a local tarball in deps/cloudxr/ over NGC. Restore and save are
split rather than using the combined cache action, because that one also saves
on a failed job and CMake's file(DOWNLOAD) leaves a truncated file behind on
error — a half-written .fwp would then satisfy the "already downloaded" check
forever.

The runtime SDK script also retries the NGC sweep, since curl's --retry never
covers the 404 actually observed. The retry wraps the whole listed/unlisted
sweep, not each request: a 404 on an individual remote name is how the script
discovers which name was published, so per-request retry would cost a delay on
every successful run.

Refs #1049

Signed-off-by: Jiwen Cai <jiwenc@nvidia.com>
@coderabbitai

coderabbitai Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8b0d5b7c-d6fb-4273-bbdb-026c2ef6aad9

📥 Commits

Reviewing files that changed from the base of the PR and between e3bf792 and 214c014.

📒 Files selected for processing (3)
  • .github/actions/setup-cloudxr-sdk/action.yml
  • .github/workflows/build-ubuntu.yml
  • scripts/download_cloudxr_runtime_sdk.sh

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

The CI workflows now restore CloudXR SDK and DepthAI firmware artifacts from keyed caches and save them after successful completion. The CloudXR download script now selects NGC resources by release type, falls back from the listed resource when needed, removes partial files, and retries the complete download sweep up to three times with five-second delays.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 214c0

The change caches third-party CI artifacts and retries failed downloads to reduce unrelated build failures; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant CI Workflow
  participant Cache
  participant Download Step
  participant Artifact Source
  CI Workflow->>Cache: Restore keyed artifact cache
  Cache-->>CI Workflow: Cache hit or miss
  CI Workflow->>Download Step: Download missing artifacts
  Download Step->>Artifact Source: Request CloudXR or DepthAI resources
  Artifact Source-->>Download Step: Return resources or failure
  CI Workflow->>Cache: Save artifacts after successful completion
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reducing unrelated CI failures caused by third-party artifact downloads.
Linked Issues check ✅ Passed The changes address issue #1049 by caching DepthAI and CloudXR artifacts, restoring caches before downloads or configuration, avoiding saves after failed downloads, and retrying the complete CloudXR c…
Out of Scope Changes check ✅ Passed All changes are within scope for issue #1049. The workflow cache changes and CloudXR retry and fallback logic directly reduce failures from third-party artifact downloads.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 …
Full details: Linked Issues check

Explanation

The changes address issue #1049 by caching DepthAI and CloudXR artifacts, restoring caches before downloads or configuration, avoiding saves after failed downloads, and retrying the complete CloudXR candidate sweep to handle transient failures and HTTP 404 responses.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jiwenc-nv/ci-stability

Comment @coderabbitai help to get the list of available commands.

@ivany-nv ivany-nv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The reasoning holds up — I verified the two load-bearing claims against depthai-core at the pinned commit 8d32a1f rather than taking them on trust:

  • Cache path is right. depthai-core's root CMakeLists.txt sets DEPTHAI_RESOURCES_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/resources", and src/plugins/oak/CMakeLists.txt adds it via add_subdirectory(${depthai_SOURCE_DIR} ${depthai_BINARY_DIR}), so that resolves to build/_deps/depthai-build/resources.
  • The truncation worry is real, not theoretical. DownloadAndChecksum opens with if(EXISTS "${output}") ... return() and never re-verifies the checksum, so the split restore/save is justified. Firmware download failure ends in message(FATAL_ERROR "Aborting."), so Configure fails and the save is correctly skipped.

I also ran download_cloudxr_runtime_sdk.sh locally under bash 3.2 with a stubbed curl and reproduced your numbers: all-404 gives exit 1, 3 sweeps, 12 requests, 10s; the realistic happy path (-external 404s, plain name serves) is 4 requests and 0s added; no leftover files in deps/cloudxr on any failure path.

Two things worth a follow-up, neither blocking:

1. resources/ holds one file the "Configure succeeded ⇒ everything checksummed cleanly" comment doesn't cover. depthai also writes depthai-shared-commit-hash-<id>.txt there, and it sets DEPTHAI_SHARED_COMMIT_HASH_ENFORCE OFF under $ENV{CI} — only the bootloader one is ON. So a failed device-side hash download is non-fatal, DownloadAndChecksum leaves the partial ${output} on disk, Configure still succeeds, and the truncated .txt gets saved. From then on the EXISTS skip means it's never re-fetched and the host/device shared-commit check silently degrades to a spurious WARNING for the life of that key. That's the failure mode this PR set out to prevent, one file over. Narrowing the cached path to .../resources/*.tar.xz would close it.

2. The cross-PR benefit only arrives after this merges — worth a line in the description. Caches are branch-scoped: one written on jiwenc-nv/ci-stability is readable by that branch and its descendants, not by other PRs. Only default-branch caches are visible everywhere, so the 14-PR-stack scenario stays red until this lands on main and a main push run populates the keys. Otherwise someone may see the next PR still miss and conclude this didn't work.

Minor notes:

  • The body says "keyed on the DEPTHAI_COMMIT pin"; the key is hashFiles('cmake/DepthAIVcpkgManifest.cmake'). Conservative in the safe direction and consistent with the existing Cache vcpkg key — just the wording.
  • Expect five "Unable to reserve cache" lines per arch on the first run, since the depthai key deliberately omits build_type/python_version and all six matrix entries race for it. actions/cache/save treats that as informational, so it's harmless — just don't let it get read as a failure.
  • Cache budget is a non-issue: I measured CloudXR at 11.8 + 12.1 + 0.3 ≈ 24 MB/arch and the depthai firmware at ~6 MB/arch, so ~60 MB against the 10 GB repo limit. No risk of evicting the ccache/vcpkg entries.
  • For the pinned 6.3.0 the listed cloudxr-runtime resource 404s on all four names and the unlisted one serves, so "3 attempts" is effectively three attempts at the unlisted resource. Free, since curl doesn't retry 4xx.

Nice touch that deps/cloudxr/.gitignore already ignores exactly *.tar.gz and *.tgz, matching the cached globs, and that nothing in the tree globs those tarballs version-agnostically — a stale cached tarball stays inert.

@yanziz-nvidia

Copy link
Copy Markdown
Collaborator

reviewed by yanziz-review-bot

Summary
This PR adds version/architecture-scoped artifact caches and retries the complete CloudXR NGC fallback sweep. CI is green, and focused testing confirmed the expected 12-request, three-sweep failure path. Other than the existing findings in previous comments, one cache-integrity risk remains.

Legend: 🚫 BLOCKER = merge-blocking | 💡 SUGGESTION = meaningful improvement | 🧹 NIT = precise small correction

Severity Finding
🚫 BLOCKER none
💡 SUGGESTION .github/actions/setup-cloudxr-sdk/action.yml:62 - The cache is saved immediately after download, while the downloaders only require nonempty files and the runtime archives are not extracted until the later build. If NGC returns a nonempty malformed payload with a successful HTTP status, this creates a poisoned cache before the current job detects the problem; subsequent jobs restore it and skip downloading. Validate every matched archive using published digests, or at least archive and required-member checks, before saving it.
🧹 NIT none

Actionables (copy-paste-ready for implementation agents)

Validate these suggestions in context before applying them. Skip anything already addressed, incorrect, or not worth the churn.

  • .github/actions/setup-cloudxr-sdk/action.yml:62 - Before saving the CloudXR cache, validate each runtime, experimental runtime, and Web SDK archive and remove/fail on invalid files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: third-party artifact downloads fail intermittently, reddening unrelated PRs

3 participants