oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.9k stars 231 forks source link

Can EXTENDS be set in env? #3616

Closed michaeloa closed 3 months ago

michaeloa commented 4 months ago

Can EXTENDS be set as an environment variable?

The documentation https://megalinter.io/latest/config-variables/ would seem to indicate that this is the case, but testing this out, it does not seem to be the case. At least I don't seem to be able to get it to work in Ubuntu WSL.

Being able to set this using an environment variable (or some other way) would be quite useful in the context of eliminating the need for having an explicit config file in each repo in order to use a common lint configuration.

echoix commented 3 months ago

I'm not one of the maintainers that worked with the extends. What I understand is that it should work from an env var.

How can we know that docker container launched is able to access that file?

What does debug logging illustrate as potential problem?

If you use the mega-linter-runner, it is simply a tool to call the Docker container and sets the environment variables to the Docker command (the -e). There's no magic done there.

michaeloa commented 3 months ago

Ah. I was assuming that npx mega-linter-runner would pick environment vars up from the environment; i.e.,

EXTENDS=https://example.com/config; npx mega-linter-runner

Would works.

Doing npx mega-linter-runner -e EXTENDS=https://example.com/config

does work, however, so I'll just do that then. Thanks.