Packit for Foreman - get production RPMs from PRs

We have recently enabled packit for the Foreman core repository and would like to show the new features to the wider developer community.

Packit? What’s Packit?!

Quoting their homepage:

What is Packit?

An open source project aiming to ease the integration of your project with Fedora Linux, CentOS Stream and other distributions.

Who should use Packit?

Upstream projects that want to build RPM packages out of pull requests, commits or releases, test their code changes and bring upstream releases to Fedora Linux.

The TL;DR version is probably: A service to build (and optionally test) RPMs from an upstream pull-request using the Fedora infrastructure.

Why should I care?

The idea is to provide RPMs that are built using production settings directly in a PR, so that involved parties can

  • test the result in a production-like environment
  • ensure the result can actually be packaged

How can I use this?

If you have an EL8 machine (CentOS Stream 8, RHEL 8, etc), you can enable the repository of a certain PR by calling

# dnf copr enable packit/theforeman-foreman-<PR_NUMBER> centos-stream-8-x86_64

After that a dnf upgrade will update all the packages or you can use dnf install for more fine-graned control.

It failed!!!

That’ll happen and we do not anticipate to make Packit blocking, as we probably can’t solve all problems inside a single PR.

If you’re a PR author or reviewer, and a Packit build failed while normal CI was happy with the changes, you can investiage it by clicking the “Details” button in the GitHub UI and follow the links to the Copr build logs. Or you can ping @theforeman/packaging so someone else will look into the issue for you. Don’t bother with Packit if Jenkins was unhappy :wink:

The following issues can occur:

  1. Infrastructure problems like Copr being down, network issues while downloading dependencies, etc. Those can be safely ignored (or retried by commenting /packit build).
  2. New dependency introduced by the PR, but that dependency is not yet packaged. This is a legitimate issue, but it will require changes to the foreman.spec RPM spec file, and we currently do not update that based on a PR, so feel free to ignore that for now.
  3. A change that works in development but not in a production setup, like a JavaScript import from a non-production path. This is something that Packit should enable us to catch before merging and should be fixed.
  4. Any other code change that breaks compilation. While probably a legit error, this also should have been caught by Jenkins.

I want that for $REPO!

Absolutely! Packit is enabled for the whole organization, so it should be just a matter of adding a packit.yml to the repository. Either try doing so yourself, or ping us :slight_smile:

4 Likes

Interesting.

There is now a packit role in Forklift (documentation) to make consuming those builds easier :slight_smile: