Skip to content

25.7.0+ Linting for specific directories has reversed behavior #4790

@marcelmamula

Description

@marcelmamula
Summary

Using ansible-lint targeted against directory was changed in 25.7.0 version as it was not happening before.

Do we need to start using ansible-lint differently and update Github Action?
How does it work with GA since using working_directory will now go into failure state, because it will never show errors?

Before: Executed ansible-lint in different scenarios.

# Inside collection root
# Result: Shows all errors across collection.
ansible-lint
Failed: 111 failure(s), 0 warning(s) in 593 files processed of 634 encountered.

# Inside collection root targeting specific role
# Result: Shows NO errors
ansible-lint roles/rolename
Passed: 0 failure(s), 0 warning(s) in 20 files processed of 23 encountered.

# Inside role directory
# Result: Shows role errors
cd roles/rolename; ansible-lint
Failed: 76 failure(s), 0 warning(s) in 22 files processed of 24 encountered.

Now after 25.7.0

# Inside collection root
# Result: Shows all errors across collection.
ansible-lint
Failed: 111 failure(s), 0 warning(s) in 593 files processed of 634 encountered.

# Inside collection root targeting specific role
# Result: Shows role errors
ansible-lint roles/rolename
Failed: 76 failure(s), 0 warning(s) in 22 files processed of 24 encountered.

# Inside role directory
# Result: Shows NO errors
cd roles/rolename; ansible-lint
Passed: 0 failure(s), 0 warning(s) in 20 files processed of 23 encountered.
Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 25.9.0 using ansible-core:2.19.2 ansible-compat:25.8.1 ruamel-yaml:0.18.14 ruamel-yaml-clib:0.2.12

# Tested with ansible-core 2.18 and 2.19, ansible-lint 25.6.1 (OK), 25.7.0, 25.9.0
  • ansible installation method: pip3 inside of Python 3.13 VENV, Github Action using latest version
  • ansible-lint installation method: pip3 inside of Python 3.13 VENV, Github Action using latest version
STEPS TO REPRODUCE
# Bash commands are in summary.

# Section of github action that is also affected
      - uses: ansible/ansible-lint@v25
        with:
          working_directory: ./roles/sap_install_media_detect
          requirements_file: ../../requirements.yml
Desired Behavior

Possible security bugs should be reported via email to [email protected]

Actual Behavior

Please give some details of what is happening. Include a minimum complete
verifiable example
with:

  • minimized playbook to reproduce the error
  • the output of running ansible-lint including the command line used
  • if you're getting a stack trace, also the output of
    ansible-playbook --syntax-check playbook

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions