Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github action: the role ansible-lint is supposed to test was not found #4245

Open
JensTimmerman opened this issue Jul 6, 2024 · 2 comments
Labels

Comments

@JensTimmerman
Copy link
Contributor

Summary

I have repository containing an ansible role.
When I enable ansible-lint github action, using the documented ansible-lint file, this results in an error: the role was not found.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint version: 6.17.2

This is run on github ci, using github workflows

name: ansible-lint
on: [push, pull_request]

jobs:
  build:
    name: Ansible Lint # Naming the build is important to use it as a status check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run ansible-lint
        uses: ansible/ansible-lint@v6
STEPS TO REPRODUCE

create a github action, following the documentation here:
https://ansible.readthedocs.io/projects/lint/installing/#installing-from-source-code

name: ansible-lint
on: [push, pull_request]

jobs:
  build:
    name: Ansible Lint # Naming the build is important to use it as a status check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run ansible-lint
        uses: ansible/ansible-lint@v6
Desired Behavior

The ansible lint action as document should just work.

Actual Behavior
WARNING  Listing 1 violation(s) that are fatal
syntax-check[specific]: the role 'ansible-role-vaultwarden' was not found in /home/runner/work/ansible-role-vaultwarden/ansible-role-vaultwarden/tests/roles:/home/runner/.cache/ansible-compat/d4577d/roles:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/runner/work/ansible-role-vaultwarden/ansible-role-vaultwarden/tests
tests/test.yml:8:7
Error: the role 'ansible-role-vaultwarden' was not found in /home/runner/work/ansible-role-vaultwarden/ansible-role-vaultwarden/tests/roles:/home/runner/.cache/ansible-compat/d4577d/roles:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/runner/work/ansible-role-vaultwarden/ansible-role-vaultwarden/tests


                  Rule Violation Summary                   
 count tag                    profile rule associated tags 
     1 syntax-check[specific] min     core, unskippable    

Failed: 1 failure(s), 0 warning(s) o
@JensTimmerman JensTimmerman added bug new Triage required labels Jul 6, 2024
@JensTimmerman
Copy link
Contributor Author

JensTimmerman commented Jul 6, 2024

I thought this could be fixed by changing the @v6 to @main, but that doens't seem to fix it

example of the failing pull request: JensTimmerman/ansible-role-vaultwarden#32


  ansible-lint 
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.11.9/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.9/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.9/x64/lib
WARNING  Listing 4 violation(s) that are fatal
yaml[trailing-spaces]: Trailing spaces
.github/workflows/molecule.yml:1

yaml[indentation]: Wrong indentation: expected at least 3
molecule/default/verify.yml:8

name[casing]: All names should start with an uppercase letter.
tasks/version.yml:38 Task/Handler: print latest vaultwarden webvault release

syntax-check[specific]: the role 'ansible-role-vaultwarden' was not found in /home/runner/work/ansible-role-vaultwarden/ansible-role-vaultwarden/tests/roles:/home/runner/.cache/ansible-compat/d4577d/roles:/home/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/runner/work/ansible-role-vaultwarden/ansible-role-vaultwarden/tests

@JensTimmerman JensTimmerman changed the title the role ansible-lint is supposed to test was not found github action: the role ansible-lint is supposed to test was not found Jul 6, 2024
@audgirka audgirka removed the new Triage required label Jul 17, 2024
@cavcrosby
Copy link
Contributor

One fix could be to use the role's fully qualified role name (FQRN) instead of the role's name within the tests/test.yml playbook. Underneath the covers, ansible-compat (which ansible-lint has as a dependency) will learn to associate that role with the local repository's path. You can see how this would look here, and the respective action run here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

3 participants