You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make Ansible dependency installation predictable and cache-friendly while reusing the existing Makefile, Dockerfiles, and CI workflows.
Two-profile Python and collection pins:requirements/ansible.txt pins one legacy profile for Python <3.11 (ansible-base==2.10.17, ansible-runner==2.3.1) and one modern profile for Python >=3.11 (ansible-core==2.19.15, ansible-runner==2.4.3), with Jinja2==3.1.6 across all supported runtimes, aligned with setup.py (ansible-core>=2.19,<2.23 on Python >=3.11). Both profiles are exercised directly by the existing CI matrix (Python 3.7/3.10 and Python 3.12). Shared transitive dependencies (cryptography, PyYAML, packaging, resolvelib) remain pip-managed so constraints do not conflict with preinstalled packages in NGC PyTorch and ROCm base images.
Bounded collection acquisition (make postinstall): derives the legacy (ansible.posix:1.5.4, ansible.utils:2.12.0, community.crypto:2.16.0) or modern (ansible.posix:2.2.2, ansible.utils:6.1.1, community.crypto:3.5.1) collection set directly from ansible-galaxy --version (preventing mixed-PATH interpreter mismatches) and bounds ansible-galaxy collection install to at most three attempts (timeout -k 30 300, 10s/20s backoff), without introducing a custom installer or post-install checker script.
Source-independent Docker layer across all seven active Dockerfiles (nine image variants):cuda11.1.1, cuda12.9, cuda13.0, cuda13.4, cuda13.5, rocm6.3.x, and rocm6.4.x install requirements/ansible.txt and make postinstall immediately before ADD . . and pass -c requirements/ansible.txt to subsequent pip install commands. Source-only edits reuse standard BuildKit layer caching in .github/workflows/build-image.yml without invalidating earlier toolchain/library layers or adding extra cold-build CI jobs.
CI, devcontainer, and local collection tests: apply -c requirements/ansible.txt and make postinstall across CPU, CUDA, Ansible CI pipelines, and .devcontainer/post-create-command.sh, and cover bounded retries/timeouts, mixed-PATHansible-galaxy profile selection, runner failure propagation, community.crypto.openssh_keypair key generation and idempotency, ansible.utils.index_of, and the production fetch_results.yaml playbook in tests/runner/test_ansible.py.
Validation
Validated at a21dba79 on Linux x86_64 across isolated legacy and modern Python environments:
Legacy profile — Python 3.8.20 and 3.10.22 (ansible-base==2.10.17, ansible-runner==2.3.1, Jinja2==3.1.6) and Modern profile — Python 3.11.18, 3.12.3, and 3.13.18 (ansible-core==2.19.15, ansible-runner==2.4.3, Jinja2==3.1.6): clean constrained install, pip check, fresh make postinstall, and python3 -m pytest -q tests/runner/test_ansible.py (9 passed, 6 subtests passed, including mixed-PATH Galaxy runtime selection, unactivated-venv symlink PATH handling, system rsync, and the fallback rsync path for minimal containers).
Negative controls & static checks: verified test failure when removing timeout, dropping -k 30, changing the 300s deadline, or reducing retries to two attempts; full-repo yapf==0.31.0 --diff (Python 3.10), flake8, mypy, bash -n, workflow YAML parsing, and git diff --check passed.
Scope and limits
Python 3.7-3.10 retain ansible-base 2.10.17 as an end-of-life compatibility bridge; GPU Python and base-image versions are unchanged.
Cold builds still require PyPI and Ansible Galaxy. Multi-arch image builds and multi-node SSH/Docker deployment remain gated by the PR image and integration checks when marked ready for review.
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.
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.
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.
✅ 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.
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
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.
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.
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.
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.
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.
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.
gusui-msft
changed the title
CI/CD - Freeze Ansible dependencies and reuse build layers
CI/CD - Pin Ansible dependencies and reuse build layers
Dec 2, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The devcontainer bootstrap omits required Ansible collections, and collection profile selection can choose versions incompatible with the Galaxy runtime in mixed-PATH environments.
Pin two direct Ansible profiles (legacy Python <3.11 on ansible-base 2.10.17 / ansible-runner 2.3.1, modern Python >=3.11 on ansible-core 2.19.15 / ansible-runner 2.4.3, with Jinja2 3.1.6 across all runtimes) in requirements/ansible.txt, and select matching legacy/modern collection pins from ansible-galaxy --version with bounded 3x 300s retries in Makefile.
Install the Ansible layer immediately before copying repository source across all seven active Dockerfiles (nine image variants, including CUDA 13.5), constrain subsequent pip installs, and align CI and devcontainer setup scripts.
Add offline retry/timeout/mixed-PATH tests and real local collection smoke tests (SSH key generation idempotency, ansible.utils.index_of, and fetch_results.yaml) in tests/runner/test_ansible.py.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make Ansible dependency installation predictable and cache-friendly while reusing the existing Makefile, Dockerfiles, and CI workflows.
requirements/ansible.txtpins one legacy profile for Python <3.11 (ansible-base==2.10.17,ansible-runner==2.3.1) and one modern profile for Python >=3.11 (ansible-core==2.19.15,ansible-runner==2.4.3), withJinja2==3.1.6across all supported runtimes, aligned withsetup.py(ansible-core>=2.19,<2.23on Python >=3.11). Both profiles are exercised directly by the existing CI matrix (Python 3.7/3.10 and Python 3.12). Shared transitive dependencies (cryptography,PyYAML,packaging,resolvelib) remain pip-managed so constraints do not conflict with preinstalled packages in NGC PyTorch and ROCm base images.make postinstall): derives the legacy (ansible.posix:1.5.4,ansible.utils:2.12.0,community.crypto:2.16.0) or modern (ansible.posix:2.2.2,ansible.utils:6.1.1,community.crypto:3.5.1) collection set directly fromansible-galaxy --version(preventing mixed-PATHinterpreter mismatches) and boundsansible-galaxy collection installto at most three attempts (timeout -k 30 300, 10s/20s backoff), without introducing a custom installer or post-install checker script.cuda11.1.1,cuda12.9,cuda13.0,cuda13.4,cuda13.5,rocm6.3.x, androcm6.4.xinstallrequirements/ansible.txtandmake postinstallimmediately beforeADD . .and pass-c requirements/ansible.txtto subsequentpip installcommands. Source-only edits reuse standard BuildKit layer caching in.github/workflows/build-image.ymlwithout invalidating earlier toolchain/library layers or adding extra cold-build CI jobs.-c requirements/ansible.txtandmake postinstallacross CPU, CUDA, Ansible CI pipelines, and.devcontainer/post-create-command.sh, and cover bounded retries/timeouts, mixed-PATHansible-galaxyprofile selection, runner failure propagation,community.crypto.openssh_keypairkey generation and idempotency,ansible.utils.index_of, and the productionfetch_results.yamlplaybook intests/runner/test_ansible.py.Validation
Validated at
a21dba79on Linux x86_64 across isolated legacy and modern Python environments:ansible-base==2.10.17,ansible-runner==2.3.1,Jinja2==3.1.6) and Modern profile — Python 3.11.18, 3.12.3, and 3.13.18 (ansible-core==2.19.15,ansible-runner==2.4.3,Jinja2==3.1.6): clean constrained install,pip check, freshmake postinstall, andpython3 -m pytest -q tests/runner/test_ansible.py(9 passed, 6 subtests passed, including mixed-PATHGalaxy runtime selection, unactivated-venv symlinkPATHhandling, systemrsync, and the fallbackrsyncpath for minimal containers).timeout, dropping-k 30, changing the 300s deadline, or reducing retries to two attempts; full-repoyapf==0.31.0 --diff(Python 3.10),flake8,mypy,bash -n, workflow YAML parsing, andgit diff --checkpassed.Scope and limits
ansible-base 2.10.17as an end-of-life compatibility bridge; GPU Python and base-image versions are unchanged.