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

Add support for predefined runner instance class #1217

Closed
nicDamours opened this issue May 13, 2024 · 1 comment · Fixed by #1219
Closed

Add support for predefined runner instance class #1217

nicDamours opened this issue May 13, 2024 · 1 comment · Fixed by #1219
Labels
feature Feature missing according to gitlab ci standard

Comments

@nicDamours
Copy link
Contributor

nicDamours commented May 13, 2024

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
Copy link
Owner

firecow commented May 14, 2024

It should be possible.

@firecow firecow added the feature Feature missing according to gitlab ci standard label May 14, 2024
nicDamours pushed a commit to nicDamours/gitlab-ci-local that referenced this issue May 14, 2024
Added feature to emulate gitlab hosted runner using the `--emulate` option with the name of one of the gitlab preset.
nicDamours pushed a commit to nicDamours/gitlab-ci-local that referenced this issue May 15, 2024
Changed initBashSpy function to return the spy in order to validate function call on it.
Changed tests to use initBashSpy function.
Changed memory preset to use `* 1024`, which helps readability.
nicDamours pushed a commit to nicDamours/gitlab-ci-local that referenced this issue May 15, 2024
Changed emulation option from `--emulate` to `--container-emulate` to follow container option convention.
nicDamours pushed a commit to nicDamours/gitlab-ci-local that referenced this issue May 15, 2024
Added gitlab hosted runner documentation url in the description of the new `--container-emulate` option.
Replaced "container-emulate" with "containerEmulate".
nicDamours added a commit to nicDamours/gitlab-ci-local that referenced this issue May 16, 2024
Removed amd64 suffix from possible runner emulation name.
nicDamours pushed a commit to nicDamours/gitlab-ci-local that referenced this issue May 16, 2024
Removed "AMD_64" from runner preset enum.
firecow pushed a commit that referenced this issue May 16, 2024
…he `--container-emulate` option with the name of one of the gitlab preset. (#1219)

* [FEATURE] #1217

Added feature to emulate gitlab hosted runner using the `--emulate` option with the name of one of the gitlab preset.

* [FEATURE] #1217

Changed initBashSpy function to return the spy in order to validate function call on it.
Changed tests to use initBashSpy function.
Changed memory preset to use `* 1024`, which helps readability.

* [FEATURE] #1217

Changed emulation option from `--emulate` to `--container-emulate` to follow container option convention.

* [FEATURE] #1217

Added gitlab hosted runner documentation url in the description of the new `--container-emulate` option.
Replaced "container-emulate" with "containerEmulate".

* [FEATURE] #1217

Removed amd64 suffix from possible runner emulation name.

* [FEATURE] #1217

Removed "AMD_64" from runner preset enum.

---------

Co-authored-by: Nicolas D'Amours <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature missing according to gitlab ci standard
Projects
None yet
2 participants