Skip to content

Add daily CFS feed warm-up and make azpysdk tool pins scannable - #48557

Draft
jenny (JennyPng) wants to merge 1 commit into
Azure:mainfrom
JennyPng:jennypng/cfs-dep-scanner
Draft

Add daily CFS feed warm-up and make azpysdk tool pins scannable#48557
jenny (JennyPng) wants to merge 1 commit into
Azure:mainfrom
JennyPng:jennypng/cfs-dep-scanner

Conversation

@JennyPng

Copy link
Copy Markdown
Member

Add daily CFS feed warm-up and make azpysdk tool pins scannable

Problem

This repo installs everything from the CFS pull-through feed instead of PyPI. CFS only serves versions it has already cached, and unauthenticated pipelines (fork PR CI) cannot trigger an upstream pull-through — they can only read what is already cached.

The static-analysis tools that azpysdk installs at runtime (mypy, pylint, pyright, sphinx, black, bandit, breaking) had their versions hardcoded in Python (e.g. MYPY_VERSION = "1.19.1"), invisible to any dependency scanner. When a tool's unpinned transitive dependency (e.g. one of mypy's deps) publishes a new release, an unauthenticated CI job resolves to that brand-new, uncached version and fails.

Fix

Part A — Make azpysdk tool deps scannable (single source of truth)

  • Move the tool version pins out of the Python check modules into eng/tool_requirements/*.txt (mypy, mypy_next, pylint, pylint_next, pyright, pyright_next, sphinx, sphinx_next, black, bandit, breaking, + README).
  • New loader azpysdk/_tool_reqs.py (load_requirements, pin, pinned_version) reads them from REPO_ROOT/eng/tool_requirements/ — the same pattern Check.py already uses for eng/test_tools.txt/pylintrc, so no packaging changes.
  • Refactored all 8 check modules to install from these files. The module-level *_VERSION constants are kept but derived from the files for backwards compatibility (nothing else imports them). verifytypes now reuses pyright.txt, removing a duplicate pin.

Part B — Daily CFS warm-up

  • eng/scripts/warm_cfs_feed.py: scans every declared dependency in the repo — all dev_requirements.txt, every pyproject.toml (deps + optional-deps), the shared eng/*.txt requirement files, and the new tool-requirement files — then runs pip download with transitive dependencies against the CFS feed. Continue-on-error, JSON report, --dry-run / --index-url / --dest / --fail-on-error.
  • eng/pipelines/warm-cfs-feed.yml: runs the script daily, authenticated (via auth-dev-feed.yml, required for pull-through), and publishes the report artifact.

Because the daily authenticated job downloads each tool's full closure at latest, the unpinned transitive dep gets cached before unauthenticated PR pipelines resolve it.

Validation

  • New tests/test_tool_reqs.py (6 tests) + existing test_pylint.py / test_breaking.py pass.
  • Full azpysdk CLI parser builds; all refactored modules import.
  • Scanner --dry-run confirmed it discovers the tool pins (mypy==1.19.1/2.1.0, pyright==1.1.407/1.1.411, black==24.4.0, sphinx==8.2.0) alongside pyproject.toml deps (275 unique third-party specs; 416 first-party skipped).

Notes / open questions

  • Daily cadence leaves a small window if a transitive dep releases between runs (inherent to pull-through warming). Happy to add a lighter --only-tool-requirements fast path for a more frequent tools-only job if desired.
  • Draft for review — please sanity-check the pipeline schedule/pool and the 1ES artifact output block.

Move the hardcoded static-analysis tool versions (mypy, pylint, pyright,
sphinx, black, bandit, breaking) out of the azpysdk check modules and into
eng/tool_requirements/*.txt as a single, machine-scannable source of truth,
loaded at runtime via azpysdk._tool_reqs.

Add eng/scripts/warm_cfs_feed.py, which scans every declared dependency in the
repo (dev_requirements.txt, pyproject.toml, shared eng/*.txt files, and the new
tool-requirement files) and runs 'pip download' with transitive dependencies
against the CFS feed. Add eng/pipelines/warm-cfs-feed.yml to run it daily,
authenticated, so unpinned transitive deps of tools like mypy are pulled through
and cached before unauthenticated PR pipelines need them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
9 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

1 participant