Skip to content

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

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

gusui-msft wants to merge 4 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.

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
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 (5e05ae3).
⚠️ Report is 1 commits behind head on main.

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.12-unit-test 71.95% <ø> (ø)

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.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:14

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.

🔵 Needs a closer look

The legacy Ansible engine lacks a Jinja2 upper bound in package metadata, allowing ordinary installs on Python 3.8–3.10 to resolve incompatible Jinja2 versions and fail.

No open issues 🎉

5 previously missed issues

In code that hasn't changed since last review

High severity Add the legacy Jinja2 bound to package metadata

setup.py:171

The legacy engine is selected for ordinary pip install ., but its Jinja2 compatibility bound exists only in the optional constraints file. The documented control-node install (docs/getting-started/installation.mdx:71) does not use that file, so Python 3.8–3.10 can still resolve Jinja2 3.1+, whose removed filter imports break Ansible 2.10. Add the legacy Jinja2 upper bound to package metadata so every supported installation path gets a compatible pair.

Medium severity Validate conflicts, dependencies, paths, and plugin support

Makefile:25

The PR promises conflict, dependency-drift, collection-shadowing and plugin-support checks, but this recipe only selects collection versions and trusts Galaxy's exit code. In an existing environment, make postinstall can therefore succeed without establishing that Ansible loads the selected profile. Add the promised distribution-conflict check before installation and validate installed Python dependencies, effective collection paths and plugin engine support before reporting success.

Medium severity Add a hard-kill deadline for timed-out acquisitions

Makefile:32

timeout 300 sends SIGTERM but has no hard kill deadline, so an acquisition that ignores the signal can block indefinitely and prevent retries or exhaustion failure. Add a finite --kill-after grace period and update the timeout stub and command assertion in tests/runner/test_ansible.py:33,67 to handle the extra option.

Medium severity Add the promised BuildKit cache checks or revise merge gates

docs/​developer-guides/​development.md:46

The PR description claims real cold-build, cache-reuse and invalidation checks, but .github/workflows/build-image.yml:168–185 still performs only one cache-importing build. Add the promised BuildKit checks, with forced cold builds gated on dependency or Dockerfile changes, or revise the stated merge gates to reflect the checks that actually exist.

Medium severity Test Python 3.11 and 3.13+ engine profiles in CI

requirements/​ansible.txt:7

The CPU matrix still runs only Python 3.7, 3.10 and 3.12, leaving the distinct 3.11 and 3.13+ engine profiles untested there. The new tests mock Galaxy or run only the built-in shell module, so they do not verify the pinned collections' production behavior. Add clean-install profile CI for 3.11 and 3.13 with real key-generation, rank-lookup and result-fetch checks.

2 resolved since last review

Review effort: Balanced

gusui-msft and others added 4 commits November 30, 2026 12:34
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 <223556219+Copilot@users.noreply.github.com>
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 <223556219+Copilot@users.noreply.github.com>
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 <223556219+Copilot@users.noreply.github.com>
Replace the duplicate exit-124 case with assertions on the timeout command and its 300-second deadline, while keeping the four retry outcomes and real runner smoke test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gusui-msft
gusui-msft force-pushed the gusui-msft/ansible-dependency-reliability-20261116 branch from 5e05ae3 to 9748b96 Compare November 30, 2026 19:35
Copilot AI balanced review requested due to automatic review settings November 30, 2026 19:36

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

Installation reproducibility and profile compatibility remain unverified due to incomplete dependency pinning, missing install validation, an unupdated CUDA 13.5 variant, and insufficient cache and collection tests.

5 open issues

Review effort: Balanced

Comment thread Makefile
Comment on lines +27 to +29
collections="ansible.posix:1.5.4 ansible.utils:2.12.0 community.crypto:2.16.0"; \
else \
collections="ansible.posix:2.2.2 ansible.utils:6.1.1 community.crypto:3.5.1"; \
Comment thread Makefile
collections="ansible.posix:2.2.2 ansible.utils:6.1.1 community.crypto:3.5.1"; \
fi; \
for attempt in 1 2 3; do \
timeout 300 ansible-galaxy collection install $$collections && exit 0; \
Comment on lines +42 to +43
The main GPU image stage installs these dependencies before copying application
source or building benchmarks; CUDA 13.4's separate STREAM stage is unchanged.
Comment on lines +44 to +46
The images reuse normal Docker layer caching and retain `PIP_CONSTRAINT` for
later pip commands. A cold build still needs the network; the existing Build
Image workflow is unchanged.
Comment thread requirements/ansible.txt
Comment on lines +8 to +12
ansible-runner==2.3.1; python_version < "3.11"
ansible-runner==2.4.3; python_version >= "3.11"
# Ansible 2.10 uses filter imports removed in Jinja2 3.1.
Jinja2==3.0.3; python_version < "3.11"
Jinja2==3.1.6; python_version >= "3.11"

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