ci: Set RPM_BUILD_NCPUS when building RPMs

Otherwise, it defaults to `_SC_NPROCESSORS_ONLN` (via `%make_build` ->
`%_smp_mflags` -> `%_smp_build_ncpus` -> `%{getncpus}` ->
48c0f28834/rpmio/macro.c (L583)).
And that's going to be wrong in Kubernetes because we're constrained via
cgroups.

The `%_smp_build_ncpus` macro allows overriding this logic via
`RPM_BUILD_NCPUS`.

See: https://github.com/coreos/coreos-ci/issues/23
See: https://github.com/coreos/coreos-assembler/pull/632
See: https://github.com/coreos/coreos-assembler/pull/1287
This commit is contained in:
Jonathan Lebon 2021-01-21 10:49:11 -05:00 committed by OpenShift Merge Robot
parent 9138739c49
commit 91b48be098

View File

@ -2,7 +2,8 @@
stage("Build") { stage("Build") {
parallel rpms: { parallel rpms: {
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi") { def n = 5
cosaPod(buildroot: true, runAsUser: 0, memory: "2Gi", cpu: "${n}") {
checkout scm checkout scm
shwrap(""" shwrap("""
# fetch tags so `git describe` gives a nice NEVRA when building the RPM # fetch tags so `git describe` gives a nice NEVRA when building the RPM
@ -17,7 +18,7 @@ parallel rpms: {
# The RPM build expects pre-generated bindings, so do that now. # The RPM build expects pre-generated bindings, so do that now.
make -f Makefile.bindings bindings make -f Makefile.bindings bindings
cd packaging cd packaging
make -f Makefile.dist-packaging rpm RPM_BUILD_NCPUS=${n} make -f Makefile.dist-packaging rpm
mv \$(find . -name '*.rpm') .. mv \$(find . -name '*.rpm') ..
""") """)
// make it easy for anyone to download the RPMs // make it easy for anyone to download the RPMs