Skip to content

Retry the ArtifactTool release lookup and fall back to cached tooling - #1535

Draft
Bryan Chen (bryanchen-d) wants to merge 2 commits into
Azure:masterfrom
bryanchen-d:artifacttool-release-lookup-retry
Draft

Bryan Chen (bryanchen-d) wants to merge 2 commits into
Azure:masterfrom
bryanchen-d:artifacttool-release-lookup-retry

Conversation

@bryanchen-d

Copy link
Copy Markdown

Please make sure the code is following contribution guidelines in CONTRIBUTING.md

What

az artifacts universal download / publish look up the latest Universal Packages tooling (ArtifactTool) release before every run. That lookup is a single request with no retry, so one transient error (for example Read timed out) fails the whole command with Failed to update Universal Packages tooling, even when a working ArtifactTool is already cached on disk.

This change, scoped to artifacttool_updater.py:

  • Retries the release lookup twice with a short backoff (2s, 5s).
  • If every attempt fails and no AZURE_DEVOPS_EXTENSION_ARTIFACTTOOL_OVERRIDE_VERSION is set, falls back to the newest cached ArtifactTool_* release (compared numerically by version) that contains the artifacttool binary, and logs a warning.
  • Still raises the existing CLIError when nothing usable is cached, or when a specific version was requested.

The --retries option suggested in #1534 is left for a follow-up.

Tests

New azext_devops/tests/latest/common/test_artifacttool_updater.py (unittest + mock.patch, temp tool root, time.sleep patched):

  • lookup succeeds on the third attempt
  • persistent failure falls back to the cached release
  • the newest cached version is picked numerically (0.2.576 over 0.2.99), skipping dirs without the binary
  • persistent failure with nothing cached still raises CLIError
  • no fallback when a version override is set

python -m unittest azext_devops.tests.latest.common.test_artifacttool_updater: 5 passed. flake8 --max-line-length 120 is clean on both files.

Authored with Copilot

Transient failures fetching the latest ArtifactTool release fail universal package downloads even when a usable ArtifactTool is already cached. Retry the lookup twice with short backoff, then fall back to the newest cached release when no version override is set. Refs Azure#1534.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

[Feature Request] Retry transient failures in 'az artifacts universal download' (tooling lookup and download)

1 participant