Introduce Makefile For All Scanners#601
Introduce Makefile For All Scanners#601EndPositive wants to merge 18 commits intosecureCodeBox:mainfrom EndPositive:makefiles
Conversation
…r dirs Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
…le testing retry libraries Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
…e unit/integration tests Signed-off-by: Jop Zitman <[email protected]>
Signed-off-by: Jop Zitman <[email protected]>
…s a dependency of integration-tests (only manually) Signed-off-by: Jop Zitman <[email protected]>
…able docker push in Makefile builds Signed-off-by: Jop Zitman <[email protected]>
|
Extra note of caution: the latest commit ec8c8f6 updates the CI so that all scanners are built with the new Makefiles. It would be really nice if someone could give it a review and trigger a run. Some more thoughts:
|
Yes good point. We've planned to change the pipeline so that it looks for changed files in the relevant folder. So that we would only run the builds for a specific scanner if files for it were changed, or if a central component e.g. operator, lurker, parser-sdk were changed. This should speed this up quite a lot as most pipelines would only run the build and tests for the changed scanner(s).
I think the only intentionally disabled integration-tests are the ones for the zap-advanced as they were just taking too long to run the scans. That should hopefully also be kinda solved by only running the tests only when the acutal zap-advanced code was changed.
Ah yes, thats a kind of edge case 🤔 Could we overwrite the build parser make targets in the zap-advanced makefile enought to just build the parser form the zap folder? I think this would be easier than reusing the image build for zap. Checked the pr out and tried the nmap makefile looks great already 🥳 |
… docker_meta Also use the same condition to chcek if the docker-meta action should be run for scanner as is used in the dependend docker build & push action. Both should be run together or not at all. Signed-off-by: Jannik Hollenbach <[email protected]>
Integrations tests section should hoperfully soon be deleted as they should be handled by the makefiles Signed-off-by: Jannik Hollenbach <[email protected]>
.github/workflows/ci.yaml
Outdated
| if: hashFiles(format('./scanners/{0}/scanner/Dockerfile', matrix.unit)) != '' | ||
| uses: crazy-max/ghaction-docker-meta@v1 | ||
| if: contains(fromJson('["angularjs-csti-scanner", "gitleaks", "kube-hunter", "kubeaudit", "ncrack", "nmap"]'), matrix.unit) |
There was a problem hiding this comment.
I believe this manual check was necessary. For example, the git-repo-scanner has its own Dockerfile but is always tagged with the secureCodeBox tag, and not the appVersion (which is 1.0 for git-repo-scanner).
In the old Pipeline, there was a distinction between third-party scanners and custom scanners. Both have a Dockerfile, but third-party scanners follow their own versioning, and custom scanners follow secureCodeBox versioning.
Signed-off-by: Jannik Hollenbach <[email protected]>
That would be awesome. For now, lets keep this PR with a matrix job and once we're fully over to Makefiles, we can do the extra magic.
You're right that zap-advanced was manually disabled, however I noticed that git-repo-scanner was never included. I can imagine that was due to GitHub rate-limiting?
Yep, that's currently what happens in the Makefile for zap-advanced, check it out! However, in the pipeline, we make use of the docker action, skipping the Makefile's build target altogether. For your proposal to work in the pipeline, we would have to get rid of the Docker build action. Do you know if the ubuntu-latest VM runs
Great! |
This will need to be more complicated as it should also only push on tagged releases Signed-off-by: Jannik Hollenbach <[email protected]>
Signed-off-by: Jannik Hollenbach <[email protected]>
yeah rate limiting is a problem, also we try to keep the integration test completly offline, that pretty hard to do with the git-repo-scanner. We should "just" be able to disable these tests for now by overwriting the
Mhh yeah... I'm not sure how easily we can / should migrate from the action, i does a lot of neat stuff in the background. I'll try to see if I can came up with a good solution to this 🤔 |
Signed-off-by: Jannik Hollenbach <[email protected]>
@J12934 how's that going? I would like to finish the PR. |
|
Hi @EndPositive I think the best way forward is, to do it like you suggested it by splitting out the "release docker build" to a seperate release pipeline and use the makefile builds in the normal commit / (and future pr) pipeline. Pushed this to a seperate branch just in case: https://github.com/secureCodeBox/secureCodeBox/tree/makefiles-split-pipeline Will talk this over with some other team members tomorrow, and will create separate github issues to track and organize the remaining work on this feature. |
|
@J12934 that sound good 😄. Some points for your tracker:
Let me know how the team meeting goes 😃 |
|
👋 Talked this over with my coworkers today, they are all exited about the makefiles and their possibilities and were all on board with the proposed changes. Which unit tests are not yet migrated to the makefiles? I'm not sure if there is a good way to integrate code-climate into the makefiles, maybe the underlying linting tools it uses under the hood (like eslint) but I'm not sure how easy that would be to setup correctly (especially for the different languages we have in use) |
|
Awesome work @J12934 ! Do you guys want to make a release (with the new scanners) before we start messing up main and the pipeline? Also, let's try to keep the work a bit separated, so contributing becomes easier. Keep this PR only on creating makefiles for scanners (no pipeline changes) and then I'll create another PR for hook makefiles. Maybe you can then look at updating the pipeline, since I'm unable to properly test not being authorized to trigger pipelines. |
|
Since this PR has gotten too bloated with further pipeline testing, I've decided to completely separate the changes for Makefiles and those for the pipeline. I'll close this PR in favor of #622 and further PR's. |
Description
This PR continues @fuhrmeistery 's work on the scanner Makefiles.
I have moved the Makefile for Amass into the project's root directory. From each scanner, we include the root Makefile and override configuration variables (such as scanner name) or whether a scanner container needs to be built. Each scanner can specify what demo target dependencies it has.
https://github.com/EndPositive/secureCodeBox/blob/eec9b75edb70b347af1e47dcdbc7cb7e14562e2b/scanners/zap/Makefile#L8-L13
Finally, in this manner, we can also completely override the root makefile's behaviour. Zap-advanced's Makefile, for example, redirects the parser-related targets to zap's makefile. Kubeaudit overrides the helm deploy target such that it can set extra helm values.
Checklist
npm testruns for the whole project.