koji-build
Start a Koji package build
TLDR
Build a package from src.rpm
Build a package from a SCM (Source Code Management) URL
Perform a scratch build
Wait on the build, even if it's running in the background
Don't wait on build
Display help
SYNOPSIS
koji build [options] <tag> <srpm-or-scmurl>
PARAMETERS
--scratch
Perform a scratch build; packages not saved to repo if successful
--wait[=<minutes>]
Wait for build to start (default: 180 minutes)
--nowait
Return immediately after queuing; do not wait
--background
Fork a background process to handle waiting
--quiet, -q
Reduce output verbosity
--rpmbuild-args=<ARGS>
Pass additional arguments to rpmbuild
--cfg=<FILE>
Use alternate config file (default: ~/.koji/client.cfg)
--user=<USER>
Username for authentication
--password=<PASS>
Password (interactive prompt if omitted)
--debug
Enable debug logging
-h, --help
Show help
DESCRIPTION
The koji build command is part of the Koji client toolkit, a distributed build system primarily used by Fedora, CentOS Stream, RHEL, and other RPM-based distributions for managing package builds at scale.
Koji enables developers and maintainers to submit source RPMs (SRPMs) or SCM URLs (like Git) for building into binary RPMs across a network of mock chroots on builder hosts. When invoked, koji build authenticates with the Koji hub, queues the build task for a specified tag (a logical grouping of packages, like 'f39' for Fedora 39), and optionally waits for completion.
Builds run in isolated environments mimicking target architectures and distributions, ensuring reproducibility. Successful builds archive RPMs and update tag repositories. Scratch builds are ephemeral and discarded post-build, ideal for testing.
This command integrates with Koji's web interface for monitoring via IDs returned. It supports options for customization like RPM build arguments or waiting timeouts, making it essential for CI/CD in RPM ecosystems. Usage requires a ~/.koji/client.cfg with hub URL and user cert/key.
CAVEATS
Requires Koji hub access and authentication; builds consume builder resources; large SRPMs or SCM checkouts may timeout; not for local builds (use mock or rpmbuild).
AUTHENTICATION
Setup requires koji moshimoshi or cert generation via koji create-user-cert.
TYPICAL USAGE
koji build f39-updates mypkg-1.0-1.src.rpm
koji build --scratch dist-git+https://src.fedoraproject.org/rpms/mypkg.git
HISTORY
Developed by Fedora Infrastructure team circa 2007 as successor to Plague; first released in 2008. Evolved with Python 3 support in Koji 1.30+ (2020); widely adopted by Mageia, openSUSE, and Epel.


