Skip to content

feat: support branches and URLs for --ansible-core-version#409

Merged
cidrblock merged 5 commits intoansible:mainfrom
cidrblock:core_url
Feb 24, 2026
Merged

feat: support branches and URLs for --ansible-core-version#409
cidrblock merged 5 commits intoansible:mainfrom
cidrblock:core_url

Conversation

@cidrblock
Copy link
Copy Markdown
Collaborator

@cidrblock cidrblock commented Feb 24, 2026

Summary

  • Add _resolve_core_package() to handle three formats for --acv: PyPI versions (2.19.0), GitHub branch names (devel, milestone, stable-2.16), and direct URLs
  • Update _install_core() to use the resolver instead of always appending ==version
  • Update --acv help text to document the new accepted formats

This enables tox-ansible to delegate collection installation to ade using branch-based ansible-core builds, removing duplicated collection build/install logic between the two tools and gaining full Python dependency resolution via ansible-builder introspect.

Test plan

  • 10 parametrized unit tests covering PyPI versions, branch names, and URL pass-through
  • All existing installer warning tests pass (23/23)
  • No lint errors
  • Integration test: ade install . --acv devel --no-seed installs ansible-core from devel branch
  • Integration test: ade install . --acv stable-2.16 --no-seed installs ansible-core from stable branch

Made with Cursor

Allow `--acv` to accept GitHub branch names (e.g. `devel`,
`milestone`, `stable-2.16`) and direct URLs in addition to PyPI
version numbers. This enables tox-ansible to delegate collection
installation to ade, using branch-based ansible-core builds from
the ansible GitHub repository.

Co-authored-by: Cursor <[email protected]>

This comment was marked as outdated.

Use packaging.version.Version for PEP 440 detection so pre-release
versions like 2.19.0rc1 are correctly recognized as PyPI versions
instead of being treated as branch names. Fall back to a leading-digit
heuristic when packaging is unavailable.

Quote the resolved package with shlex.quote before interpolating it
into the shell command string to prevent injection or breakage from
metacharacters.

Co-authored-by: Cursor <[email protected]>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Narrow the no-packaging fallback from r"^\d" to r"^\d+\.\d+" so
strings like "2devel" are consistently treated as branch names
regardless of whether the packaging library is available.

Add edge case tests for the fallback path to document this behavior.

Co-authored-by: Cursor <[email protected]>
@cidrblock cidrblock merged commit 6e9d8d6 into ansible:main Feb 24, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants