docs: mock's configuration

Related: https://pagure.io/koji/issue/4019
This commit is contained in:
Tomas Kopecek 2024-02-29 10:53:56 +01:00
parent 296cf75468
commit 54f32e8266
6 changed files with 90 additions and 5 deletions

View file

@ -0,0 +1,46 @@
Interaction with Mock
---------------------
`Mock`_ is crucial component for building in Koji. Every build runs the mock to
prepare fresh isolated environment and builds rpm or other content in chroot
handled by Mock.
For each buildroot (and thus every build) koji prepares configuration file for
mock to be used. Content of the file depends on some administrator's decisions
and can be tweaked by:
* ``/etc/mock/site-defaults.cfg`` on builder. This file is always consulted by
mock, so it is strongly recommended not to use default configuration but
deploy this file with more strict settings.
Typical values which should be changed:
- ``use_bootstrap = False`` - Bootstrap is a) not needed in most cases b)
slows down the build c) e.g. in combination with next option could lead to
unreproducible build. While this feature is pretty useful in some cases,
it should be turned off as default and could be selectively turned on for
specific buildroots per tag configuration.
- ``use_bootstrap_image`` - As noted before, this is generally unsafe
option, especially if used with image tags which are expected to be moved
(e.g. "latest"). Note, that to use this option (even via tag's
configuration), you need to explicitly allow it in :doc:`kojid.conf
<kojid_conf>` via ``mock_bootstrap_image = True``.
- ``nspawn_args`` - for old chroot, :ref:`RLIMIT_* <rlimits_kojid>` support
setting various RLIMIT values to the build process. In case of
nspawn-based chroot (``mock.new_chroot`` tag extra option) these are
handled by mock itself and must be set separately there.
- ``macros`` - some rpm macros could be defined every time for every build
based on builder itself. Typical usecase is to limit usage of CPUs on
given builder by setting ``config_opts['macros']['%_smp_ncpus_max'] = 2``.
- ``plugin_conf`` - Various plugins could be enabled and configured to be
available in build environment. Example is `rpmautospec`_ which allows
various ``%auto*`` macros in spec files.
* Another selective variant of altering mock's behaviour is setting its
options per buildtag. This is more described in :ref:`tuning-mock-per-tag`.
.. _Mock: https://github.com/rpm-software-management/mock/wiki
.. _rpmautospec: https://docs.pagure.org/fedora-infra.rpmautospec/