-
- Summary
`test_packages` fails sporadically with:
```
RuntimeError: Could not find 'Packages' artifact for task ...rhel8_package... (package)
```
even though the `package` task succeeded and attached its `Packages` artifact (BF-45409). The Evergreen API serves artifact lists from a secondary node (DEVPROD-32223), so artifacts attached by a recently-finished task can be missing from the API response for minutes due to replication lag — the same root cause as BF-45377.
-
- Changes
- Add `find_task_artifact_url_with_retry(task, artifact_name, refetch_task)` to `buildscripts/package_test/package_test_provenance.py`. It retries the artifact URL lookup with exponential backoff (15s → 120s cap, 8 attempts, ~10 min total), calling `refetch_task` to obtain a fresh task (and fresh artifact list) before each retry. `task` is used for the first attempt.
- Use it in `download_packages_from_build` (`buildscripts/package_test/package_test.py`), refetching the package task via `evg_api.tasks_by_build(build_id)` on each retry.
- Add unit tests covering: returns immediately when the artifact is present; refetches until the artifact appears; raises after exhausting retries.
This mirrors the fix in #60731 for BF-45377 (retry `Mapper.setup_urls` against the same secondary lag), applied to the package-test artifact lookup.
BF-45409
-
- Backport
The failing project is `mongodb-mongo-v9.0-staging`; a backport to v9.0-staging will follow once this lands on master.