ci: Constrain parallel build jobs

The default `_NPROCESSORS_ONLN` heuristic we have isn't cgroups aware.
So it thinks it has e.g. 40 CPUs when running in a k8s pod. This can
then blow through our allocated resource limits.

Declare some modest amount of RAM and CPU resources and override `make`
parallelism.

This matches what ostree does in
https://github.com/ostreedev/ostree/pull/2151.
This commit is contained in:
Jonathan Lebon 2020-07-13 19:18:22 -04:00 committed by OpenShift Merge Robot
parent 89d79f3505
commit fda0be62ce
2 changed files with 4 additions and 3 deletions

View File

@ -40,9 +40,10 @@ codestyle: {
}
},
rust: {
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi") {
def n = 5
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") {
checkout scm
shwrap("ci/msrv.sh")
shwrap("MAKE_JOBS=${n} CARGO_BUILD_JOBS=${n} ci/msrv.sh")
}
}}

View File

@ -7,7 +7,7 @@ pkg_upgrade() {
}
make() {
/usr/bin/make -j $(getconf _NPROCESSORS_ONLN) "$@"
/usr/bin/make -j ${MAKE_JOBS:-$(getconf _NPROCESSORS_ONLN)} "$@"
}
build() {