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

How do I ignore certain problems? #8

Closed
tschm opened this issue Aug 25, 2020 · 2 comments · Fixed by #32
Closed

How do I ignore certain problems? #8

tschm opened this issue Aug 25, 2020 · 2 comments · Fixed by #32
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@tschm
Copy link

tschm commented Aug 25, 2020

e.g. i would love to do something along these lines

name: Lint Dockerfile

on: push

jobs:
  linter:
    runs-on: ubuntu-latest
    steps:

      - uses: actions/checkout@v2

      - name: Lint Dockerfile
        uses: brpaz/hadolint-action@master
        with:
          dockerfile: "Dockerfile"
          ignore: "DL3013"

Who can I achieve that?

@brpaz
Copy link
Collaborator

brpaz commented Aug 28, 2020

Right now it´s not possible to pass ignore rules as arguments. You can create an .hadolint.yaml file in the root of your repository and configure your rules that way.

See: https:/hadolint/hadolint#configure

@brpaz brpaz added good first issue Good for newcomers enhancement New feature or request help wanted Extra attention is needed labels Nov 14, 2020
@dennzo
Copy link

dennzo commented Feb 13, 2021

+1
This would make it a lot more easier and flexible, particularly in the event that you validate more than one Dockerfile and you need a different rule set for each validation. Unfortunately the yaml config file can only be used globally or needs to be passed explicitly.

This is my use case here. I use two validation stages. One for the main Dockerfile and one for a "dev" release containing additional developing and debug tools which should not be in the final production image.

      -
        name: Validate root Dockerfile
        uses: brpaz/[email protected]
        with:
          dockerfile: Dockerfile
      -
        name: Validate dev Dockerfile
        uses: brpaz/[email protected]
        with:
          dockerfile: with-xdebug/Dockerfile

And here in the dev image with-xdebug/Dockerfile I refer to the latest version of the root dockerfile.

FROM ghcr.io/made/alpine-nginx-php8:latest

So linter runs over this line and of course fails because I get the latest version instead of explicitly requiring.
But the same rule should NOT apply to the main 'Dockerfile` so I cannot deactivate this globally.

I would love to see the configuration here for example like this.

      -
        name: Validate root Dockerfile
        uses: brpaz/[email protected]
        with:
          dockerfile: Dockerfile
      -
        name: Validate dev Dockerfile
        uses: brpaz/[email protected]
        with:
          dockerfile: with-xdebug/Dockerfile
          ignore: 
            - DL3000
            - SC1010

m-ildefons added a commit to m-ildefons/hadolint-action that referenced this issue May 8, 2021
- bump Hadolint version to 2.4.0
- change to debian based image
- add common config options
- expand integration tests for new options

fixes: hadolint#5
fixes: hadolint#8
fixes: hadolint#17
fixes: hadolint#18
fixes: hadolint#31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants