-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Support Using .mega-linter.yml
Config File and Inline Command-Line Parameters Together
#1154
Comments
That's strange, MegaLinter is supposed to concatenate parameters from ENV and .mega-linter.yml , with priority to ENV vars (if there is a common variable on both side, it overwrites, not append values) Please can you add Note: it's probably not related, but you should add the image version in your docker run command :) megalinter/megalinter :v5 |
Hey @nvuillam, I do now see the following, which would indicate that it's finding the config file and the command-line variables being passed through. [config] /tmp/lint/.mega-linter.yml + Environment variables However, from some additional testing, it appears that it does not give priority to the ENV vars. I tested this by including Further, even though it sees/identifies my terraform files (in this example), for some unknown reason it doesn't keep any of them to scan. When I check a previous run, I notice that the filter is different (where it lists file extensions and file names). This time, though, it just shows: Listing all files in directory [/tmp/lint], then filter with:
<NO FILTERS ARE SHOWN HERE>
`Kept [0] files on [19] found files` My interpretation is that it's completely ignoring any ENV variables, because when I pass |
Thanks for your analysis, I think I found the origin of the issue, I'll manage that in my next PR :) |
Hey @nvuillam, And interestingly, even though it shows the list of linters that should be enabled (ie. Kept [0] files on [19] found files
Kept files before applying linter filters:
-
+----MATCHING LINTERS-+----------+----------------+------------+
| Descriptor | Linter | Criteria | Matching files | Format/Fix |
+------------+--------+----------+----------------+------------+
MegaLinter flavor is "all", no need to check match with linters
[Post] No commands declared in user configuration |
Describe the solution you'd like
MegaLinter would be a more versatile tool to use if the command-line options could be enhanced as follows. When trying to use it as a template pipeline, which is called from another pipeline, if there are no values passed into the parameters (ie. 'DISABLE_DESCRIPTORS'), then it should react/execute as if that environment variable wasn't even passed into it.
This seems to work, since, when not passing any values, it does not prevent the Docker container (and MegaLinter itself) from running. However, even though the actual execution shows the parameter values being properly passed through...
... the MegaLinter does not pick up on these requested refined scopes, and instead, runs all linters.
Additionally, from testing, when using a combination of the
.mega-linter.yml
config file along with inline command-line parameters (ie.--env 'ENABLE=TERRAFORM'
), it seems like the command-line parameters are ignored..mega-linter.yml File
Calling Pipeline
MegaLinter Template Pipeline
Describe alternatives you've considered
The alternative would be to create a dedicated
.mega-linter.yml
file for each customized execution (which negates the dynamic approach of automation).Additional context
I am testing this using Azure DevOps online (not the on-premises server version), specifically via a Docker image execution, with the following Docker image:
The text was updated successfully, but these errors were encountered: