Skip to content

CI/CD - Freeze Ansible dependencies and reuse build layers - #900

Draft
gusui-msft wants to merge 3 commits into
mainfrom
gusui-msft/ansible-dependency-reliability-20261116
Draft

gusui-msft wants to merge 3 commits into
mainfrom
gusui-msft/ansible-dependency-reliability-20261116

Conversation

@gusui-msft

Copy link
Copy Markdown
Contributor

Summary

Combine dependency profiles and stable installation layers in two commits, keeping bounded Galaxy recovery in the shared installer rather than shipping a separate retry-only change.

  • Freeze the engine, runner and transitive Python dependencies; pin separate legacy and modern collection sets. Use ansible-core instead of the bundled ansible distribution on newer Python versions.
  • Preserve the existing Python <=3.10 engine/runner path. The Ansible 2.10 profile is explicitly an end-of-life compatibility bridge, not a new long-term support commitment. GPU Python and base-image versions are unchanged.
  • Keep make postinstall as the shared entry point. Reject conflicting Ansible distributions before installation, detect Python dependency drift and shadowed collections, and check the effective plugins' declared engine support.
  • Limit Galaxy acquisition to three attempts, 300 seconds each, with 10/20-second waits. Preserve diagnostics and fail on exhaustion; do not retry entire image builds.
  • Add an early ansible-dependencies stage to the six Dockerfiles covering all eight active image variants. Both CUDA 13.4 build branches inherit it. Subsequent pip operations are constrained, and application installation is followed by read-only checks and real local collection tests instead of another online Galaxy installation.
  • Add profile CI and real BuildKit cold/cache checks. Forced cold builds run only for relevant dependency/Dockerfile PR changes, not for ordinary source-only PRs.

Validation completed locally

  • Cold-installed profiles on Linux x86_64 with Python 3.8, 3.10, 3.11, 3.12 and 3.13; real key-generation/idempotency, rank lookup and the production result-fetch playbook passed across these profiles.
  • Installed the actual application under constraints and exercised the Python Ansible client, including nonzero command propagation. Final focused suite: 14 tests + 7 subtests passed on Python 3.10 and 3.12. Python 3.8 passed the 13-test profile/client suite before the cache-probe fixture test was added.
  • Ran the exact make postinstall entry point from a clean Python 3.12 environment and empty collection directory; all 8 dependency tests passed afterward.
  • Ran actual sb run --no-docker orchestration in isolated user/mount/PID namespaces on Python 3.10 and 3.12: environment update, rank/hostfile, result collection, summary creation and CLI exit passed. Benchmark modes were empty; no GPU benchmark commands were executed.
  • Python formatting, flake8, mypy, compileall, Bash syntax, YAML parsing and active-image installation-boundary checks passed. Cache-probe fixtures verify log classification and restoration of modified inputs; they are not evidence of actual Docker cache hits.

Remaining merge gates / limits

  • This machine has no Docker runtime. The new Build Image checks must validate actual cold installs, cache reuse/invalidation, final GPU-framework compatibility and both architectures in CI.
  • Python 3.7 is covered by the new CI matrix but was not executable locally.
  • Local tests do not qualify full remote SSH/Docker deployment or GPU workloads. Keep the existing Ansible integration and image checks as merge gates.
  • Cold installs still require package services. Hash-verified offline artifacts, a new artifact platform and changing GPU Python are outside this PR.

Commits

  1. 3d9e330 — Freeze and validate Ansible dependency profiles.
  2. bb1008b — Cache and verify Ansible dependency layers.

gusui-msft and others added 2 commits November 16, 2026 13:55
Separate legacy and modern collection inputs, freeze the Python dependency closure, and validate effective plugin versions after application installation. Keep Galaxy recovery bounded and cover real collection operations and runner failures.

Co-authored-by: Copilot <[email protected]>
Install validated profiles before source-sensitive and expensive build steps across the active image matrix. Check final application environments without contacting Galaxy, and exercise real dependency-layer cache behavior only on relevant PRs.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 03:22

Copilot AI 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.

🟡 Changes recommended

Legacy Ansible collections become hidden after deployment, and the frozen cryptography versions cannot install on Python 3.9.0–3.9.1 despite those interpreters remaining supported.

3 open issues
What changed in this PR

This PR separates SuperBench’s Ansible dependencies from application builds, freezing supported profiles and enabling GPU images to reuse dependency layers after source-only changes.

Changes:

  • Adds pinned Python and collection profiles, with shared installation, bounded Galaxy retries, and dependency validation.
  • Introduces reusable dependency stages across six GPU Dockerfiles and constrains subsequent Python installations.
  • Adds profile, collection, runner, and build-cache checks, and documents the installation workflow.
File Description
tests/​runner/​test_ansible.py Tests real local execution and failure propagation.
tests/​ansible/​test_dependencies.yaml Exercises collection operations and production result fetching.
tests/​ansible/​test_dependencies.py Tests retries, validation, collections, and cache-probe behavior.
tests/​ansible/​check_build_cache.sh Checks cold builds, cache reuse, and dependency invalidation.
setup.py Selects engine and runner ranges by Python version.
scripts/​install_ansible.py Installs and validates frozen dependency profiles.
requirements/​ansible.txt Freezes Python dependencies with version markers.
requirements/​ansible.in Defines inputs for generating the Python freeze.
requirements/​ansible-modern.yml Pins modern Ansible collections.
requirements/​ansible-legacy.yml Pins legacy-compatible Ansible collections.
Makefile Routes postinstall through the shared installer.
docs/​developer-guides/​development.md Documents profiles, validation, and dependency caching.
dockerfile/​rocm6.4.x.dockerfile Adds a dependency stage and post-install checks.
dockerfile/​rocm6.3.x.dockerfile Adds a dependency stage and constrained installation.
dockerfile/​cuda13.4.dockerfile Shares the dependency stage across both build branches.
dockerfile/​cuda13.0.dockerfile Adds cached dependencies and application validation.
dockerfile/​cuda12.9.dockerfile Adds cached dependencies and application validation.
dockerfile/​cuda11.1.1.dockerfile Adds legacy-profile caching, validation, and rsync.
.github/​workflows/​build-image.yml Runs cache checks for relevant pull-request changes.
.github/​workflows/​ansible-dependencies.yml Adds a Python-version matrix for profile validation.
.azure-pipelines/​cuda-unit-test.yml Constrains installation and adds collection-test tools.
.azure-pipelines/​cpu-unit-test.yml Constrains installation and stops on setup failures.
.azure-pipelines/​ansible-integration-test.yml Constrains integration dependencies and stops on setup failures.

Review effort: Balanced

Comment thread dockerfile/cuda11.1.1.dockerfile Resolved
Comment thread requirements/ansible.txt Resolved
Keep direct Python pins in one requirements file and collection pins with bounded retries in the existing Makefile. Reuse normal early Docker layers and existing CI instead of a custom installer, profile workflow and cache-probe framework.

Validated cold installation, focused runner/retry tests and real collection operations on Python 3.8 and 3.12. Other transitive Python dependencies remain pip-managed; full GPU image qualification remains pending.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 03:46

Copilot AI 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.

🟡 Changes recommended

Both affected Dockerfiles use a collection-path variable ignored by Ansible 2.10, causing plugins to install under /root where the workspace mount hides them from control-node use.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread dockerfile/rocm6.3.x.dockerfile Resolved
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.36%. Comparing base (c548e79) to head (e596fa8).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #900   +/-   ##
=======================================
  Coverage   86.36%   86.36%           
=======================================
  Files         107      107           
  Lines        8258     8258           
=======================================
  Hits         7132     7132           
  Misses       1126     1126           
Flag Coverage Δ
cpu-python3.10-unit-test 71.95% <ø> (ø)
cpu-python3.12-unit-test 71.95% <ø> (ø)
cpu-python3.7-unit-test 71.41% <ø> (ø)
cuda-unit-test 84.37% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

2 participants