CI: Add gitlab tags to builds which can use all CPUs
PATCH 1/1 CI: Add gitlab tags to builds which can use all CPUs
Most gitlab runners are mostly idle at present and could happily run several jobs at once.
There are a few exceptions, such as the world builds.
Add a 'single' tag for the exceptions so that they are dealt with separately, with no concurrency. This is not quite perfect, since it means that a 'single' job can be combined with a number of normal jobs, but in practice this doesn't seem to matter.
To use this, for each existing machine, add a new, separate runner, with the tag 'single'. Set 'limit = 1' in its config.toml file and set 'concurrent = 10' (for example) in the global section. The machine will then pick up one 'single' job and up to 9 other jobs at once.
In my testing this reduces the time to complete a CI pipeline.
My choice of which jobs to mark as single is mostly down to how much CPU they need. For the 'docs' job, it runs for a short time, so doesn't seem worth marking it as a 'single' job.
---
.gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
.gitlab-ci.yml +12 -0
@@ -110,6 +110,8 @@ stages: build all 32bit ARM platforms: extends: .world_build + tags: + - single script: - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}";
@@ -122,6 +124,8 @@ build all 32bit ARM platforms: build all 64bit ARM platforms: extends: .world_build + tags: + - single script: - virtualenv -p /usr/bin/python3 /tmp/venv - . /tmp/venv/bin/activate
@@ -136,6 +140,8 @@ build all 64bit ARM platforms: build all PowerPC platforms: extends: .world_build + tags: + - single script: - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}";
@@ -147,6 +153,8 @@ build all PowerPC platforms: build all other platforms: extends: .world_build + tags: + - single script: - ret=0; git config --global --add safe.directory "${CI_PROJECT_DIR}";
@@ -192,6 +200,8 @@ Check for configs without MAINTAINERS entry: # Ensure host tools build Build tools-only and envtools: extends: .testsuites + tags: + - single script: - make tools-only_config tools-only -j$(nproc); make mrproper;
@@ -224,6 +234,8 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: # Check for any pylint regressions Run pylint: extends: .testsuites + tags: + - single script: - git config --global --add safe.directory "${CI_PROJECT_DIR}" - pip install -r test/py/requirements.txt
Signature · 1 line
2.34.1
Quoted 15 lines · Simon Glass
Most gitlab runners are mostly idle at present and could happily run several jobs at once.
There are a few exceptions, such as the world builds.
Add a 'single' tag for the exceptions so that they are dealt with separately, with no concurrency. This is not quite perfect, since it means that a 'single' job can be combined with a number of normal jobs, but in practice this doesn't seem to matter.
To use this, for each existing machine, add a new, separate runner, with the tag 'single'. Set 'limit = 1' in its config.toml file and set 'concurrent = 10' (for example) in the global section. The machine will then pick up one 'single' job and up to 9 other jobs at once.
Quoted 7 lines
In my testing this reduces the time to complete a CI pipeline.
My choice of which jobs to mark as single is mostly down to how much CPU they need. For the 'docs' job, it runs for a short time, so doesn't seem worth marking it as a 'single' job.
Signed-off-by Simon Glass <[email protected]>
This is an interesting approach. What will work better long term is adding more runners with the "all" tag because as part of the rework of the Gitlab job I've done and you can see here:
https://source.denx.de/u-boot/u-boot/-/pipelines/23588
(but isn't ready to post as Ilias wants to look in to the sandbox+arm64 issue) means that every runner needs some tags and for runners which can handle multiple "small" jobs at once (as the first two stages are building a board and then testing, or similar) we can make use of that, and then restrict the world builds to the fastest nodes only. This also means that things like the Oracle "always free" tier cloud instances could be used for example as an "all" jobs node, I suspect. And the same for any other cloud provider with an equivalent tier.
Signature · 1 line
Tom
Hi Tom,
Quoted 26 lines · Tom Rini
Quoted 15 lines · Simon Glass
Most gitlab runners are mostly idle at present and could happily run several jobs at once.
There are a few exceptions, such as the world builds.
Add a 'single' tag for the exceptions so that they are dealt with separately, with no concurrency. This is not quite perfect, since it means that a 'single' job can be combined with a number of normal jobs, but in practice this doesn't seem to matter.
To use this, for each existing machine, add a new, separate runner, with the tag 'single'. Set 'limit = 1' in its config.toml file and set 'concurrent = 10' (for example) in the global section. The machine will then pick up one 'single' job and up to 9 other jobs at once.
Quoted 7 lines
In my testing this reduces the time to complete a CI pipeline.
My choice of which jobs to mark as single is mostly down to how much CPU they need. For the 'docs' job, it runs for a short time, so doesn't seem worth marking it as a 'single' job.
Signed-off-by Simon Glass <[email protected]>
Quoted 12 lines
This is an interesting approach. What will work better long term is adding more runners with the "all" tag because as part of the rework of the Gitlab job I've done and you can see here:
https://source.denx.de/u-boot/u-boot/-/pipelines/23588
(but isn't ready to post as Ilias wants to look in to the sandbox+arm64 issue) means that every runner needs some tags and for runners which can handle multiple "small" jobs at once (as the first two stages are building a board and then testing, or similar) we can make use of that, and then restrict the world builds to the fastest nodes only. This also means that things like the Oracle "always free" tier cloud instances could be used for example as an "all" jobs node, I suspect. And the same for any other cloud provider with an equivalent tier.
For reference I had this idea a year ago [1] and it didn't go anywhere at the time.
For me this patch reduces the CI time to 35mins best case. So I'm going to pick up this patch for the ci tree. Once you have patches for your approach (which seems better to me as well), we can go with that.
Regards,
Simon
[1] CAHFG_=USRrEytULOdnezrCmeAcV_KGO7M=ieWCoi1mCzHwmHRQ@mail.gmail.com/
https://lore.kernel.org/u-boot/CAPnjgZ0Gj==Q-YOU+EoD=s3h25Waw5EYa0DEOD_comoAy_bRMw@mail.gmail.com/
Simon Glass
AppliedHi Tom,
Quoted 26 lines · Tom Rini
Quoted 15 lines · Simon Glass
Most gitlab runners are mostly idle at present and could happily run several jobs at once.
There are a few exceptions, such as the world builds.
Add a 'single' tag for the exceptions so that they are dealt with separately, with no concurrency. This is not quite perfect, since it means that a 'single' job can be combined with a number of normal jobs, but in practice this doesn't seem to matter.
To use this, for each existing machine, add a new, separate runner, with the tag 'single'. Set 'limit = 1' in its config.toml file and set 'concurrent = 10' (for example) in the global section. The machine will then pick up one 'single' job and up to 9 other jobs at once.
Quoted 7 lines
In my testing this reduces the time to complete a CI pipeline.
My choice of which jobs to mark as single is mostly down to how much CPU they need. For the 'docs' job, it runs for a short time, so doesn't seem worth marking it as a 'single' job.
Signed-off-by Simon Glass <[email protected]>
Quoted 12 lines
This is an interesting approach. What will work better long term is adding more runners with the "all" tag because as part of the rework of the Gitlab job I've done and you can see here:
https://source.denx.de/u-boot/u-boot/-/pipelines/23588
(but isn't ready to post as Ilias wants to look in to the sandbox+arm64 issue) means that every runner needs some tags and for runners which can handle multiple "small" jobs at once (as the first two stages are building a board and then testing, or similar) we can make use of that, and then restrict the world builds to the fastest nodes only. This also means that things like the Oracle "always free" tier cloud instances could be used for example as an "all" jobs node, I suspect. And the same for any other cloud provider with an equivalent tier.
For reference I had this idea a year ago [1] and it didn't go anywhere at the time.
For me this patch reduces the CI time to 35mins best case. So I'm going to pick up this patch for the ci tree. Once you have patches for your approach (which seems better to me as well), we can go with that.
Regards,
Simon
[1] CAHFG_=USRrEytULOdnezrCmeAcV_KGO7M=ieWCoi1mCzHwmHRQ@mail.gmail.com/
https://lore.kernel.org/u-boot/CAPnjgZ0Gj==Q-YOU+EoD=s3h25Waw5EYa0DEOD_comoAy_bRMw@mail.gmail.com/
Applied to ci, thanks!