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

.hadolint.yaml config is ignored #775

Closed
2 of 3 tasks
jornfranke opened this issue Feb 22, 2022 · 5 comments · Fixed by #829
Closed
2 of 3 tasks

.hadolint.yaml config is ignored #775

jornfranke opened this issue Feb 22, 2022 · 5 comments · Fixed by #829

Comments

@jornfranke
Copy link

  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

Expected behavior

hadolint reads the file .hadoolint.yaml and applies the options. E.g. in this case it should especially consider output format "format" in it.

Actual behavior

hadolint ignores at least the option "format" in the yaml, but most likely all options. If I provide a non-existing file then it complains that it cannot read the file, so I assume it finds the file and content.
If I provide the format via the -f flag then it is correctly produced.

Steps to reproduce the behavior

hadolint -c ./hadolint.yaml Dockerfile

Use the following file ./hadolint.yaml

failure-threshold: "ignore"
format: "gitlab_codeclimate"
no-color: false
no-fail: true
strict-labels: true
disable-ignore-pragma: false
trustedRegistries:
    - "internal"
    - "internal2"

It will not output the issues in "gitlab_codeclimate" format, but the default tty.

hadolint version: 2.8.0
OS: Linux
Gitlab Runner: 14.7.0

@codezninja
Copy link

codezninja commented Feb 25, 2022

Seems like this broke in 2.8.0. Using version 2.7.0 seems to read the config properly. When I used the -V option I can see that hadolint reads the config file but it doesn't load any of the values. I see some values being loaded like failure threshold

---
failure-threshold: error  # name of threshold level (error | warning | info | style | ignore | none)
trustedRegistries:
  - fail.docker.com
$ hadolint -V -c $(pwd)/.hadolint.yaml Dockerfile
"Configuration file used: /Users/username/Repos/Test/.hadolint.yaml"
Configuration:
  no fail: False
  no color: False
  output format: tty
  failure threshold: error
  override error:
    none
  override warning:
    none
  override info:
    none
  override style:
    none
  override ignore:
    none
  strict labels: False
  label schema:
    none
  allowed registries:
    none

@m-ildefons
Copy link
Collaborator

Hi,
thanks for reporting this bug. I believe this is actually the issue described here and fixed here.

@jornfranke
Copy link
Author

It is not only trustedregistries - it seems everything in the config is ignored

@codezninja
Copy link

@jornfranke it's actually only a few things from what I can tell. failure-threshold worked for me in the above example.

@huornlmj
Copy link

Also reporting failure-threshold not working correctly. The following within .hadolint.yaml...

failure-threshold:
        - info

yields...

"Error parsing your config file in  'REDACTED/.hadolint.yaml':\nIt should contain one of the keys 'override', 'ignored'\nor 'trustedRegistries'. For example:\n\nignored:\n\t- DL3000\n\t- SC1099\n\n\nThe key 'override' should contain only lists with names 'error',\n'warning', 'info' or 'style', which each name rules to override the\nseverity on. For example:\n\noverride:\n\terror:\n\t\t- DL3008\n\n\nThe key 'trustedRegistries' should contain the names of the allowed\ndocker registries:\n\ntrustedRegistries:\n\t- docker.io\n\t- my-company.com\n\nexpected severity instead of tag:yaml.org,2002:seq tagged sequence\n"

Other values in the hadolint.yaml file work fine.

m-ildefons added a commit to m-ildefons/hadolint that referenced this issue Apr 29, 2022
Make Hadolint read the desired output format from the key `format` in
the config file, instead of `output-format`. This is more convenient,
consistent with the command line options and consistent with the
documentation.

fixes: hadolint#775
m-ildefons added a commit to m-ildefons/hadolint that referenced this issue Apr 29, 2022
Make Hadolint read the desired output format from the key `format` in
the config file, instead of `output-format`. This is more convenient,
consistent with the command line options and consistent with the
documentation.

fixes: hadolint#775
lorenzo pushed a commit that referenced this issue Apr 29, 2022
Make Hadolint read the desired output format from the key `format` in
the config file, instead of `output-format`. This is more convenient,
consistent with the command line options and consistent with the
documentation.

fixes: #775
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants