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.
The GHA tests pull the lock file from main which pointed to an older version.
For older version of lint:
WARNING: ansible-lint 25.5.0 does not provide the extra 'lock'
so the current get used from a previous test which used the lock file in main
GitHub Action Lock File Issue Analysis
Problem Summary
The ansible-lint GitHub Action fails when testing older versions (like v25.5.0) with the error:
Root Cause Analysis
Issue #1: Missing
[lock]Extra in Older VersionsCurrent Action Command:
pip install "ansible-lint[lock] @ git+https://github.com/ansible/[email protected]"Problem: The
[lock]extra was added after v25.5.0 was released.Evidence:
[lock]extra defined in pyproject.tomloptional-dependencies.lock = {file = [".config/requirements-lock.txt"]}Result: When pip encounters a non-existent extra, it:
[lock]extra (shows warning)requirements.inansible-compat>=25.1.5which is 25.8.0 (incompatible)Issue #2: Incompatible Dependency Versions
ansible-lint v25.5.0 dependency specification:
What gets installed:
[lock]extra: Would useansible-compat==25.5.0(compatible)[lock]extra: Installsansible-compat==25.8.0(incompatible)Timeline:
Impact
Who is Affected:
ansible/[email protected][lock]extra was addedWhat Happens:
ansible-compat==25.5.0)ansible-compat==25.8.0AnsibleCollectionFindererrorSolutions
Option 1: Conditional Lock Extra (Recommended)
Modify the GitHub Action to check if the target version supports
[lock]extra:Option 2: Always Use Constraints File
Option 3: Version Detection
Why We Need to Update the Lock File
Current Lock File Status:
ansible-compat==25.8.0(incompatible - needs update to 25.8.1)ansible-compat==25.x.x(version-specific, immutable)The Chain of Events:
mainusing[lock]extra → getsansible-compat==25.8.0v25.5.0with[lock]extra → fails silently, reuses existing 25.8.0AnsibleCollectionFindererrorShort-term Fix:
Update the lock file on
mainbranch fromansible-compat==25.8.0toansible-compat==25.8.1:After update:
ansible-compat==25.8.1Assumption:
This fix assumes
ansible-compat==25.8.1maintains backward compatibility withansible-lint==25.5.0and no breaking changes were introduced between ansible-compat versions 25.5.0 → 25.8.1.Long-term Solution:
The GitHub Action should still be made backward compatible to properly handle versions that don't support the
[lock]extra, ensuring each version uses its intended dependency versions.Immediate Actions Required
Priority 1 (Quick Fix):
ansible-compat==25.8.0toansible-compat==25.8.1Priority 2 (Long-term Fix):
[lock]extra gracefullyTesting Strategy
Test the action with:
v25.5.0(no lock extra)v25.8.0(has lock extra)main(latest)Verify each uses the correct dependency versions from their respective lock files.
Related Issues: #4728, ansible/ansible-compat#519