-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Problems while trying to use kubeconform #2873
Comments
@onepushmain Kubeconform looks for specific file extensions & content to be activated
Source: https://megalinter.io/beta/descriptors/kubernetes_kubeconform/#how-are-identified-applicable-files How is structured your repository ? do you have a kubernetes directory ? |
Similar issue here, at least for the KUBERNETES_HELM linter:
Since the descriptor sets active_only_if_file_found the linter is skipped. There is a variable KUBERNETES_DIRECTORY, but I could not figure out how to use it properly. At the moment my only workaround is adding a dummy Chart.yaml file at the root and then passing the actual subdirectory with Are there any solutions to disable the active_only_if_file_found check? Can one override it? Thanks! |
What if you try |
The same thing happens when Looking at the code there are only two places that are looked at to do the check (directly in the workspace or under linter_rules_path). This linter_rules_path is global, right? So any other linters would be affected as well. I have nonetheless tried setting it and found that the workspace is in the path twice (in line 351, since in my test linter_rules_path included the absolute path). Removing the workspace from the front allows the check to go through (but using this global LINTER_RULES_PATH variable). megalinter/megalinter/Linter.py Lines 341 to 373 in da6a41e
My config for testing was (in various variations):
|
mmmm what if we always activate the linter if |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Yeah, that seems like a logical solution. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
…CTORY** variable Example: `KUBERNETES_DIRECTORY: any` Fixes #2873 Co-authored-by: onepushmain <onepushmain@users.noreply.github.com>
A million years later, PR is on the way :) |
…CTORY** variable (#3058) * [automation] Auto-update linters version, help and documentation * trvy * Allow to use value `any` to always activate a linter who as a **_DIRECTORY** variable Example: `KUBERNETES_DIRECTORY: any` Fixes #2873 Co-authored-by: onepushmain <onepushmain@users.noreply.github.com> * black * [MegaLinter] Apply linters fixes --------- Co-authored-by: onepushmain <onepushmain@users.noreply.github.com> Co-authored-by: nvuillam <nvuillam@users.noreply.github.com>
…CTORY** variable (oxsecurity#3058) * [automation] Auto-update linters version, help and documentation * trvy * Allow to use value `any` to always activate a linter who as a **_DIRECTORY** variable Example: `KUBERNETES_DIRECTORY: any` Fixes oxsecurity#2873 Co-authored-by: onepushmain <onepushmain@users.noreply.github.com> * black * [MegaLinter] Apply linters fixes --------- Co-authored-by: onepushmain <onepushmain@users.noreply.github.com> Co-authored-by: nvuillam <nvuillam@users.noreply.github.com>
I think this issue isn't resolved yet. With KUBERNETES_HELM and KUBERNETES_KUBESCAPE linters enabled and with the KUBERNETES_DIRECTORY environment variable set to
|
@lukaalba it is another problem ^^ Isn't there a Chart.yml in your repo ? https://megalinter.io/latest/descriptors/kubernetes_helm/#how-are-identified-applicable-files |
Thanks for your reply! But I'm not sure if I fully get you here. Reading the previous comments I would have expected that setting the Setting I'm not sure but to me it looks like megalinter/megalinter/Linter.py Lines 347 to 361 in 8fc6cb2
|
@lukaalba MegaLinter will look in If KUBERNETES_DIRECTORY is Do you have one or multiple Chart.yml files ? ( I'm not a K8 expert ^^ ) If you have multiple, we'll have to make some enhancements ^^ |
I have only one Chart.yml, so this shouldn't be an issue :D Just for clarification. With this project structure:
Setting |
Hi, I am encountering the same issue as @lukaalba . Even if I set KUBERNETES_DIRECTORY to "chart" or "chart/" it will be ignored and i get the following message:
The directory structure is equal to the one provided by @lukaalba. I "discovered" that setting KUBERNETES_DIRECTORY doesn't affect the "helm" and "kubescape" linter, but only kubeconform. Starting megalinter inside the chart-directory is working as expected. Megalinter recognizes that this directory indeed exists, but it's maybe checking the wrong directory for the Chart.yaml ?
|
I think you're right... let's provide a variable that will force KUBE linters if set to true ? |
Thanks for reopening this issue! From the user point of perspective it would be clearer how to use those linters if the helm and kubescape one respect the KUBERNETES_DIRECTORY, too. Any idea if this is possible? |
Sry for the late reply, i've been sick. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Hi - I just ran into this issue as well (having a Chart.yaml file located in Assuming I'm looking in the correct location in the source code: https://github.com/oxsecurity/megalinter/blob/main/megalinter/Linter.py#L346-L379, would it be correct to say that MegaLinter isn't incorporating From cursory testing (adding additional logging to |
…y (_DIRECTORY) Fixes oxsecurity#2873 This includes a new place when searching for active only if files. The other existing places are not affected.
…y (_DIRECTORY) (#3323) * fix: allow active_only_if_file_found to work in specified subdirectory (_DIRECTORY) Fixes #2873 This includes a new place when searching for active only if files. The other existing places are not affected. * run build * fix python code style, reduce diff --------- Co-authored-by: Timothy Earley <timothy.earley@deutschebahn.com> Co-authored-by: Nicolas Vuillamy <nicolas.vuillamy@gmail.com>
Is there a general timeline for when the next release will be? Ran into this same issue today and realized the fix isn't present in v7.8.0 |
@Kryan90 there is no pre-written timeline for new releases as it depends from content and maintainers availability, but there is almost never more than one month between 2 minor releases :) Meanwhile, you can use beta version if you are in a hurry to benefit from a features/fix :) |
Hello!
I'm having some problems while using megalinter into my kubernetes manifest repository. Seem like the megalinter don't have the option to run some kubernetes linteres/checkers
my
.mega-linter.yml
:logs that I get while running with this config:
Am I doing something wrong?
thanks in advance for the support and, I apologize if this is too trivial, it's my first time using this tool
The text was updated successfully, but these errors were encountered: