Skip to content
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

No difference when using --threads option with docker image #609

Closed
w0rmr1d3r opened this issue Aug 25, 2021 · 5 comments
Closed

No difference when using --threads option with docker image #609

w0rmr1d3r opened this issue Aug 25, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@w0rmr1d3r
Copy link
Contributor

Describe the bug
I'm scanning a repo which takes aprox, 1min to get scanned.
I'm using gitleaks as follows:

docker run -v ${PWD}:/my-repo zricethezav/gitleaks:latest --path="/my-repo" --no-git --verbose

And wanted it to perform better, so I came accross the --threads option (from here).
I used it many times with different values, but no different outcome in time it takes to scan the repo.

To Reproduce
Steps to reproduce the behavior:

  1. execute it like this -> docker run -v ${PWD}:/my-repo zricethezav/gitleaks:latest --path="/my-repo" --no-git --verbose
  2. Try to increment the time by using it like this -> docker run -v ${PWD}:/my-repo zricethezav/gitleaks:latest --path="/my-repo" --no-git --verbose --threads=100
  3. Change the 100 value by any value, I put 10, 20, 100 and 1000.
  4. No difference in time it takes to scan the repo.

Expected behavior
It should take less time to scan the repo, unless that option is only useful when using gitleaks outside Docker.

Screenshots
Forgot to take screenshots :(

Basic Info (please complete the following information):

  • OS: docker for mac, tried in different machines, same result, time it takes doesn't change
  • Gitleaks Version: latest docker image

Additional context
Shall I open a PR saying that the option is deprecated or only available outside docker? I searched for open/closed issues, found nothing related to this topic.

cc @zricethezav

@w0rmr1d3r w0rmr1d3r added the bug Something isn't working label Aug 25, 2021
@zricethezav
Copy link
Collaborator

@w0rmr1d3r if you are using Docker for mac you can throttle the number of CPUs dedicated to Docker. I'm curious if bumping the CPU value would fix your problem?

Screen Shot 2021-09-02 at 10 20 23 AM

@w0rmr1d3r
Copy link
Contributor Author

Hello @zricethezav !
I actually did and nothing changed. I tried this locally, to see if I missed something, but I want it to work on my CI.
And there, it did the same, no changes even though I put more than 100 threads.
Always using docker.

Are we missing something?

@zricethezav
Copy link
Collaborator

@w0rmr1d3r I believe this is related to #619.

--nogit scans previously did not limit the number of goroutines being spun up so the --threads option was non functioning 😬. Because of this, the default behavior would essentially max out all available cpu resources assuming the target was large enough. Sorry bout that folks.

@w0rmr1d3r
Copy link
Contributor Author

It is!
I ran some tests again and with the --threads option it decreases the time it takes!

Thank you!

Closing the issue

@w0rmr1d3r
Copy link
Contributor Author

However, tested it in a Jenkins machine and got no significant changes.
Previously it took 1min 15sec, I forced to download latest (v7.6.0) and it takes 1min 14sec.

In my local it's showing progress, so I will say that it's limited to how Jenkins runs docker images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants