go.mod: update osbuild/images to v0.123.0

Includes modularity support.
This commit is contained in:
Sanne Raymaekers 2025-03-10 11:29:18 +01:00 committed by Tomáš Hozza
parent 5e3d6aff54
commit 536b7d95c5
37 changed files with 655 additions and 157 deletions

View file

@ -3,7 +3,9 @@ package manifest
import (
"fmt"
"github.com/osbuild/images/internal/common"
"github.com/osbuild/images/pkg/container"
"github.com/osbuild/images/pkg/experimentalflags"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/images/pkg/runner"
@ -57,6 +59,11 @@ func NewBuild(m *Manifest, runner runner.Runner, repos []rpmmd.RepoConfig, opts
repos: filterRepos(repos, name),
containerBuildable: opts.ContainerBuildable,
}
// This allows to bootstrap the buildroot with a custom container
// for e.g. cross-arch-build experiments,
maybeAddExperimentalContainerBootstrap(m, runner, opts, pipeline)
m.addPipeline(pipeline)
return pipeline
}
@ -149,6 +156,40 @@ func (p *BuildrootFromPackages) getSELinuxLabels() map[string]string {
return labels
}
// maybeAddExperimentalContainerBootstrap will return a container buildroot
// if the "IMAGE_BUILDER_EXPERIMENTAL=bootstrap=<container-ref>" is
// defined. This allows us to do cross-arch build experimentation.
//
// A "bootstrap" container has only these requirements:
// - python3 for the runners
// - rpm so that the real buildroot rpms can get installed
// - setfiles so that the selinux stage for the real buildroot can run
// (and does not even need a working dnf or repo setup).
func maybeAddExperimentalContainerBootstrap(m *Manifest, runner runner.Runner, opts *BuildOptions, build *BuildrootFromPackages) {
bootstrapBuildrootRef := experimentalflags.String("bootstrap")
if bootstrapBuildrootRef == "" {
return
}
cntSrcs := []container.SourceSpec{
{
Source: bootstrapBuildrootRef,
Name: bootstrapBuildrootRef,
TLSVerify: common.ToPtr(false),
},
}
name := "bootstrap-buildroot"
bootstrapPipeline := &BuildrootFromContainer{
Base: NewBase(name, nil),
runner: runner,
dependents: make([]Pipeline, 0),
containers: cntSrcs,
disableSelinux: true,
}
m.addPipeline(bootstrapPipeline)
build.build = bootstrapPipeline
}
type BuildrootFromContainer struct {
Base
@ -159,6 +200,7 @@ type BuildrootFromContainer struct {
containerSpecs []container.Spec
containerBuildable bool
disableSelinux bool
}
// NewBuildFromContainer creates a new build pipeline from the given
@ -213,6 +255,10 @@ func (p *BuildrootFromContainer) serializeEnd() {
}
func (p *BuildrootFromContainer) getSELinuxLabels() map[string]string {
if p.disableSelinux {
return nil
}
labels := map[string]string{
"/usr/bin/ostree": "system_u:object_r:install_exec_t:s0",
}
@ -242,13 +288,15 @@ func (p *BuildrootFromContainer) serialize() osbuild.Pipeline {
panic(err)
}
pipeline.AddStage(stage)
pipeline.AddStage(osbuild.NewSELinuxStage(
&osbuild.SELinuxStageOptions{
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
ExcludePaths: []string{"/sysroot"},
Labels: p.getSELinuxLabels(),
},
))
if !p.disableSelinux {
pipeline.AddStage(osbuild.NewSELinuxStage(
&osbuild.SELinuxStageOptions{
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
ExcludePaths: []string{"/sysroot"},
Labels: p.getSELinuxLabels(),
},
))
}
return pipeline
}