ansible / ansible-lint-action

❗️Replaced by https://github.com/marketplace/actions/run-ansible-lint
https://github.com/marketplace/actions/run-ansible-lint
MIT License
254 stars 132 forks source link

Linting is not failing #58

Closed polatsinan closed 2 years ago

polatsinan commented 2 years ago

My workflow:

name: Ansible Lint

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Lint Ansible Playbook
      uses: ansible/ansible-lint-action@master
      with:
        targets: tasks/main.yml
        override-deps: |
          ansible==2.10.0
          ansible-lint==4.2.0

        args: ""

Running locally:

# ansible-lint -v --force-color tasks/main.yml
Failed to guess project directory using git: fatal: Not a git repository (or any of the parent directories): .git
WARNING  Listing 4 violation(s) that are fatal
risky-file-permissions: File permissions unset or incorrect
tasks/main.yml:27 Task/Handler: Ensure SSL certificate

risky-file-permissions: File permissions unset or incorrect
tasks/main.yml:36 Task/Handler: Ensure SSL key

yaml: truthy value should be one of [false, true] (truthy)
tasks/main.yml:68

yaml: truthy value should be one of [false, true] (truthy)
tasks/main.yml:82

You can skip specific rules or tags by adding them to your configuration file:
# .ansible-lint
warn_list:  # or 'skip_list' to silence them completely
  - experimental  # all rules tagged as experimental
  - yaml  # Violations reported by yamllint

Finished with 2 failure(s), 2 warning(s) on 1 files.
#

As you can see, warnings are shown (as expected).

But when linting is being run via Github Actions I am not getting these warnings and the checks are succesfull while I expect the same warnings. See (URL):

+ shopt -s globstar
+ ansible-lint -v --force-color tasks/main.yml
Examining tasks/main.yml of type playbook
+ shopt -u globstar
triplepoint commented 2 years ago

Maybe related problem here - for example https://github.com/triplepoint/ansible-dnsmasq/actions/runs/1904469023

Errors show when running manually from the command line, and the text output of the github action shows the errors in the text, but the action evaluates as successful.

Action summary shows parsed out errors like:

Annotations
1 error
test: tasks/main.yml#L14
risky-file-permissions File permissions unset or incorrect

but the action shows a successful pass.

sebix commented 2 years ago

Warnings don't set the exit code to 1 (failure)

konstruktoid commented 2 years ago

Hi all, please retest using the main branch

polatsinan commented 2 years ago

Hi all, please retest using the main branch

Just replaced master with main in my workflow, but it seems it is not longer allowed to use:

        targets: tasks/main.yml
        override-deps: |

Since it is failing with: Unexpected input(s) 'targets', 'override-deps', valid inputs are ['entryPoint', 'args'] I will need to look into it before I can test again.

polatsinan commented 2 years ago

Changing to main branch and removing the targets and override-deps inputs fixed the issue.