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.

Home Page:https://megalinter.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

please delete

NebulaOnion opened this issue · comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I currently don't know how to setup Megalinter for a self hosted Drone CI, and the docker image and the self hosted runner option didn't work.

Describe the solution you'd like
A clear and concise description of what you want to happen.
I would like if possible, for Drone CI support to be official since it's growing a lot in popularity.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

That's a great idea, i don't know drone CI but maybe we can work together to complete the doc and add a section:)

ML is docker image based and there is also mega-linter-runner so i'm sure that we can build a reusable template configuration:)

When you look to github, gitlab, azure etc... job scripts, isn't there something reusabke for drone CI? :)

The local runner is really only an abstraction to use the Docker image. By using it with the --debug option (correct me @nvuillam), you will see the command line that is sent to Docker.

The two important lines of the local runner are really:

commandArgs.push(...["-v", "/var/run/docker.sock:/var/run/docker.sock:rw"]);
commandArgs.push(...["-v", `${lintPath}:/tmp/lint:rw`]);

This sets the volume mounts. The first one is to allow MegaLinter to control Docker. (Probably for the Docker based linters). Then the second one is really to mount the repo to lint inside the container, so the container can access the files. That's how à Docker container can communicate files, and persist them, since otherwise, containers are generic and stateless!

The CI actions or jobs, call directly the Docker container like in here, the GitHub action definition, the
https://github.com/oxsecurity/megalinter/blob/8376adfd5bfe9cd934f2c8783b0fa6d9d509d0fa/action.yml

I'm not 100% sure how the repo files mounting is set in that case, but I think this could help you start your integration project!

Syntax seems quite simple and close to other CI providers

https://docs.drone.io/pipeline/docker/syntax/steps/

Could you try something like:

kind: pipeline
type: docker
name: MegaLinter

steps:
- name: megalinter
  image: oxsecurity/megalinter:v6

@NebulaOnion great :)
I checked in the docs and did not see artifacts... that's sad :/

  • Enabling file.io reporter could be a workaround solution for a start
  • DRONE_COMMENTS_REPORTER could be nice, but how to we post comments on drone ? it would require a new python class within MegaLinter, similar to Github, Gitlab and Azure reporters
  • About auto-commit of fixes, it is currently documented only for Github Actions, but if Drone is able to push a new commit that could do the job :)

Agreed, you can make a first PR with doc for what already works, then the new features about drone CI integration can be managed in other issues & PRs :)

Another thing: if there is something in drone CI to group console output into sections, it would be nice to implement it too :)

Nice proposition, agreed :)

@NebulaOnion oops... please can you make a PR to update doc once you have a config working ?

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@NebulaOnion a PR with updated doc + updated installer to have a Drone CI config template would indeed be great :)

About generator, it will probably be something like:

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@NebulaOnion but are you still working or going to work on a PR? Because right now the only one apparently interested and knowledgeable in this topic is you so if you don't advance somehow in a PR I'm afraid it will fall back into stale.

@bdovaz We don't use Drone CI anymore and I honestly don't know how to keep fixing the remaining issues, I'll close the issue, then.

@NebulaOnion what CI did you decide to use?
Is MegaLinter still in the pipeline? :)

@NebulaOnion oh great, another CI tool that could use MegaLinter :)

Please make a PR to update the installation instructions if you succeed to run MegaLinter on Gitea :)