firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.03k stars 115 forks source link

Add support for predefined runner instance class #1217

Closed nicDamours closed 1 month ago

nicDamours commented 1 month ago

Is your feature request related to a problem? Please describe. I was trying to debug some performance issues with my pipeline and I could not set the cpu and memory limit of the docker runner that gitlab-ci-local is using. I was able to make it work by editing the source and specifying those values manually, but it was quite the challenge.

Describe the solution you'd like Could it be possible to add an option to emulate the resources of a gitlab shared runner ? For example, we could use the option --emulate-runner=saas-linux-small-amd64 which could set the memory and CPUs limit to those of the saas-linux-small-amd64 instance. This would help debug performance issues.

The list of the available gitlab runner hosted by gitlab can be found here. https://docs.gitlab.com/ee/ci/runners/hosted_runners/linux.html

Describe alternatives you've considered I looked into the ulimit option, but it seams quite limited compared to --memory=, --cpus=, etc.

As stated previously, I was able to define those values manually and emulate gitlab's small runner.

Additional context My crude solution was to add the following line to the execScript function of the job.ts file.

dockerCmd += "--memory=8096m --kernel-memory=8096m --cpus=2 ";

I will try to implements the feature and submit a pull-request.

firecow commented 1 month ago

It should be possible.