From fda0be62cee515cee9634fd8a7e19c71456dfdf7 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Mon, 13 Jul 2020 19:18:22 -0400 Subject: [PATCH] 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. --- .cci.jenkinsfile | 5 +++-- ci/libbuild.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 56593736..7534f41a 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -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") } }} diff --git a/ci/libbuild.sh b/ci/libbuild.sh index 34245ff6..8a682305 100644 --- a/ci/libbuild.sh +++ b/ci/libbuild.sh @@ -7,7 +7,7 @@ pkg_upgrade() { } make() { - /usr/bin/make -j $(getconf _NPROCESSORS_ONLN) "$@" + /usr/bin/make -j ${MAKE_JOBS:-$(getconf _NPROCESSORS_ONLN)} "$@" } build() {