-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildroot_image: allow using OCI images as the base for buildroot
For now we can do this with: --buildroot-image registry.fedoraproject.org/fedora:41 --buildroot-image /path/to/a/tarball.tar This commit generalizes the logic for working with bootstrap image so it can work the same both with bootstrap and buildroot images. Fixes: #1159 Fixes: #1482
- Loading branch information
Showing
12 changed files
with
191 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Mock 6.0+ supports --bootstrap-image feature and OCI buildroot exports | ||
|
||
@buildroot_image | ||
Scenario: Use image from registry for buildroot preparation | ||
Given an unique mock namespace | ||
Given mock is always executed with "--buildroot-image registry.fedoraproject.org/fedora:rawhide" | ||
When an online source RPM is rebuilt against fedora-rawhide-x86_64 | ||
Then the build succeeds | ||
|
||
@buildroot_image | ||
Scenario: Image from 'export_buildroot_image' works with --buildroot-image | ||
Given an unique mock namespace | ||
Given next mock call uses --enable-plugin=export_buildroot_image option | ||
# No need to do a full build here! | ||
When deps for python-copr-999-1.src.rpm are calculated against fedora-rawhide-x86_64 | ||
And OCI tarball from fedora-rawhide-x86_64 backed up and will be used | ||
And the fedora-rawhide-x86_64 chroot is scrubbed | ||
And an online SRPM python-copr-999-1.src.rpm is rebuilt against fedora-rawhide-x86_64 | ||
Then the build succeeds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
layout: default | ||
title: Feature buildroot image | ||
--- | ||
|
||
Starting from version v6.0, Mock allows users to use an OCI container image for | ||
pre-creating the buildroot (build chroot). It can be either an online container | ||
image hosted in a registry (or cached locally), or a local image in the form of | ||
a tarball. | ||
|
||
Be cautious when using chroot-compatible images (e.g., it is not advisable to | ||
combine EPEL `ppc64le` images with `fedora-rawhide-x86_64` chroot). | ||
|
||
## Example Use-Case | ||
|
||
1. Mock aggressively caches the build root, so clean up your chroot first: | ||
|
||
```bash | ||
$ mock -r fedora-rawhide-x86_64 --scrub=all | ||
``` | ||
|
||
2. Perform any normal Mock operation, but select the OCI image on top of that: | ||
|
||
```bash | ||
$ mock -r fedora-rawhide-x86_64 \ | ||
--buildroot-image registry.fedoraproject.org/fedora:41 \ | ||
--rebuild /your/src.rpm | ||
``` | ||
|
||
## Using Exported Buildroot Image | ||
|
||
The [export_buildroot_image](Plugin-Export-Buildroot-Image) plugin allows you to | ||
wrap a prepared buildroot as an OCI archive (tarball). If you have this | ||
tarball, you may select it as well: | ||
|
||
```bash | ||
$ mock -r fedora-rawhide-x86_64 \ | ||
--buildroot-image /tmp/buildroot-oci.tar \ | ||
--rebuild /your/src.rpm | ||
``` | ||
|
||
Again, ensure that you do not combine incompatible chroot and image pairs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
releng/release-notes-next/export-import-oci-buildroot-image.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
A new plugin, `export_buildroot_image`, has been added. This plugin can export | ||
the Mock chroot as an OCI archive once all the build dependencies have been | ||
installed (when the chroot is ready-made for runnign `/bin/rpmbuild -bb`). | ||
|
||
A new complementary feature has been implemented in Mock, and can be enabled | ||
using the following option: | ||
|
||
--buildroot-image /tmp/buildroot-oci.tar | ||
|
||
It allows the use of generated OCI archives as the source for the build chroot, | ||
similar to how `bootstrap_image` is used "as the base" for the bootstrap chroot. | ||
|
||
Additionally, this feature may be used as: | ||
|
||
--buildroot-image registry.access.redhat.com/ubi8/ubi | ||
|
||
Of course, in both cases it is important to use chroot-compatible iamges. |