main: skip arch checks onIMAGE_BUILDER_EXPERIMENTAL=bootstrap

This commit skips the arch checks if the experimental "bootstrap"
option is used. The main use-case of this option is to bootstrap
a foreign architecture so just assume that and skip arch checks
when set.

This allows to write:
```
$ IMAGE_BUILDER_EXPERIMENTAL=bootstrap=ghcr.io/mvo5/fedora-buildroot:41 \
   ./image-builder build --arch=riscv64 minimal-raw --distro=fedora-41
```
and do a riscv64 cross arch build.
This commit is contained in:
Michael Vogt 2025-02-18 20:22:47 +01:00 committed by Achilleas Koutsou
parent 06e73caec1
commit 8635a22ad9
2 changed files with 44 additions and 1 deletions

View file

@ -15,6 +15,7 @@ import (
"github.com/osbuild/bootc-image-builder/bib/pkg/progress"
"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/images/pkg/experimentalflags"
"github.com/osbuild/images/pkg/imagefilter"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/ostree"
@ -150,7 +151,9 @@ func cmdManifestWrapper(pbar progress.ProgressBar, cmd *cobra.Command, args []st
if err != nil {
return nil, err
}
if archChecker != nil {
// assume that users with the "bootstrap" flag want cross building
// and skip arch checks then
if archChecker != nil && experimentalflags.String("bootstrap") == "" {
if err := archChecker(img.Arch.Name()); err != nil {
return nil, err
}