Skip to content

CHEF-27761: Add download URL validation with retry logic#426

Open
tpowell-progress wants to merge 2 commits into
mainfrom
chef-27761-url-validation
Open

CHEF-27761: Add download URL validation with retry logic#426
tpowell-progress wants to merge 2 commits into
mainfrom
chef-27761-url-validation

Conversation

@tpowell-progress

Copy link
Copy Markdown
Contributor

Addresses CHEF-27761 by adding download URL validation to prevent CDN propagation race conditions.

Problem: Chef client upgrades fail when mixlib-install returns package metadata before packages are available on the CDN. This leaves Windows systems in a broken state.

Solution:

  • Added validate_download_url_with_retry() method to PackageRouter
  • Validates URL accessibility before returning artifact info
  • Implements exponential backoff retry logic (1s, 2s, 4s)
  • Uses HEAD requests for lightweight validation
  • Configurable via MIXLIB_INSTALL_VALIDATE_URLS environment variable
  • Disabled by default for backward compatibility

Testing:

  • All 575 existing unit tests pass
  • Backward compatible
  • No API changes

Fixes: CHEF-27761

@tpowell-progress tpowell-progress requested review from a team and jaymzh as code owners June 15, 2026 18:45
@tpowell-progress tpowell-progress force-pushed the chef-27761-url-validation branch from 4e4a722 to 08e2c0a Compare June 15, 2026 19:19

@sean-sype-simmons sean-sype-simmons 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.

update branch and then this looks good.

tpowell-progress and others added 2 commits June 18, 2026 12:37
…on race conditions

This change addresses CHEF-27761 by adding validation of download URLs before
returning artifact information. This prevents the race condition where mixlib-install
returns metadata for packages that aren't yet available on the CDN.

Features:
- Added validate_download_url_with_retry() method with exponential backoff
- Implements 3 retries with configurable wait times (default: 1s, 2s, 4s)
- Uses HTTP HEAD requests for lightweight validation (no full download)
- Configurable via MIXLIB_INSTALL_VALIDATE_URLS environment variable
- Disabled by default for backward compatibility
- Clear error messages indicating CDN propagation delays

This ensures all mixlib-install consumers (test-kitchen, knife bootstrap, etc.)
benefit from the validation without requiring code changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
Resolve RuboCop violations reported in CI:
- remove redundant begin/rescue wrapper
- avoid shadowed exception rescue list
- use self-assignment shorthand for backoff multiplier

No behavior change; this is lint-only cleanup for CHEF-27761 changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Powell <104777878+tpowell-progress@users.noreply.github.com>
@tpowell-progress tpowell-progress force-pushed the chef-27761-url-validation branch from 5e42474 to a6f8324 Compare June 18, 2026 16:37
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.

3 participants