Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bib/cmd/bootc-image-builder/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ func upload(uploader cloud.Uploader, path string, flags *pflag.FlagSet) error {
defer file.Close()

var r io.Reader = file
var size int64
if pbar != nil {
st, err := file.Stat()
if err != nil {
return err
}
pbar.SetTotal(st.Size())
size = st.Size()
pbar.SetTotal(size)
pbar.Set(pb.Bytes, true)
pbar.SetWriter(osStdout)
r = pbar.NewProxyReader(file)
pbar.Start()
defer pbar.Finish()
}

return uploader.UploadAndRegister(r, osStderr)
return uploader.UploadAndRegister(r, uint64(size), osStderr)
}
53 changes: 41 additions & 12 deletions bib/cmd/bootc-image-builder/legacy_iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import (
"fmt"
"math/rand"
"slices"
"strconv"
"strings"

Expand All @@ -15,6 +14,8 @@
"github.com/osbuild/images/pkg/customizations/kickstart"
"github.com/osbuild/images/pkg/depsolvednf"
"github.com/osbuild/images/pkg/disk"
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/distro/defs"
"github.com/osbuild/images/pkg/image"
"github.com/osbuild/images/pkg/manifest"
"github.com/osbuild/images/pkg/osbuild"
Expand All @@ -24,8 +25,6 @@
"github.com/sirupsen/logrus"

podman_container "github.com/osbuild/images/pkg/bib/container"

"github.com/osbuild/bootc-image-builder/bib/internal/distrodef"
)

// all possible locations for the bib's distro definitions
Expand Down Expand Up @@ -164,7 +163,11 @@
// depsolve packages
depsolvedSets := make(map[string]depsolvednf.DepsolveResult)
depsolvedRepos := make(map[string][]rpmmd.RepoConfig)
for name, pkgSet := range mani.GetPackageSetChains() {
pkgSetChains, err := mani.GetPackageSetChains()
if err != nil {
return nil, nil, err
}
for name, pkgSet := range pkgSetChains {
res, err := solver.Depsolve(pkgSet, 0)
if err != nil {
return nil, nil, fmt.Errorf("cannot depsolve: %w", err)
Expand Down Expand Up @@ -229,19 +232,48 @@
}
}

func needsRHELLoraxTemplates(si osinfo.OSRelease) bool {
return si.ID == "rhel" || slices.Contains(si.IDLike, "rhel") || si.VersionID == "eln"
// from:https://github.com/osbuild/images/blob/v0.201.0/data/distrodefs/rhel-10/imagetypes.yaml#L169
var loraxRhelTemplates = []string{

Check failure on line 236 in bib/cmd/bootc-image-builder/legacy_iso.go

View workflow job for this annotation

GitHub Actions / ⌨ Lint & unittests

var loraxRhelTemplates is unused (unused)
"80-rhel/runtime-postinstall.tmpl",
"80-rhel/runtime-cleanup.tmpl",
}

// from:https://github.com/osbuild/images/blob/v0.201.0/data/distrodefs/fedora/imagetypes.yaml#L408
var loraxFedoraTemplates = []string{

Check failure on line 242 in bib/cmd/bootc-image-builder/legacy_iso.go

View workflow job for this annotation

GitHub Actions / ⌨ Lint & unittests

var loraxFedoraTemplates is unused (unused)
"99-generic/runtime-postinstall.tmpl",
"99-generic/runtime-cleanup.tmpl",
}

func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, error) {
if c.Imgref == "" {
return nil, fmt.Errorf("pipeline: no base image defined")
}

imageDef, err := distrodef.LoadImageDef(c.DistroDefPaths, c.SourceInfo.OSRelease.ID, c.SourceInfo.OSRelease.VersionID, "anaconda-iso")
nameVer := fmt.Sprintf("%s-%s", c.SourceInfo.OSRelease.ID, c.SourceInfo.OSRelease.VersionID)
id, err := distro.ParseID(nameVer)
if err != nil {
return nil, err
}
// XXX: ensure all aliases we have for bib are available in
// images
distroYAML, err := defs.NewDistroYAML(nameVer)
if err != nil {
return nil, err
}
// XXX: put bootc-rpm-installer or something into images
installerImgTypeName := "image-installer"
imgType, ok := distroYAML.ImageTypes()[installerImgTypeName]
if !ok {
return nil, fmt.Errorf("cannot find image definition for %v", installerImgTypeName)
}
installerPkgSet, ok := imgType.PackageSets(*id, c.Architecture.String())["installer"]
if !ok {
return nil, fmt.Errorf("cannot find installer package set for %v", installerImgTypeName)
}
installerConfig := imgType.InstallerConfig(*id, c.Architecture.String())
if installerConfig == nil {
return nil, fmt.Errorf("empty installer config for %s", installerImgTypeName)
}

containerSource := container.SourceSpec{
Source: c.Imgref,
Expand Down Expand Up @@ -286,10 +318,7 @@
img.InstallerCustomizations.Product = c.SourceInfo.OSRelease.Name
img.InstallerCustomizations.OSVersion = c.SourceInfo.OSRelease.VersionID
img.InstallerCustomizations.ISOLabel = labelForISO(&c.SourceInfo.OSRelease, &c.Architecture)

img.ExtraBasePackages = rpmmd.PackageSet{
Include: imageDef.Packages,
}
img.ExtraBasePackages = installerPkgSet

var customizations *blueprint.Customizations
if c.Config != nil {
Expand Down Expand Up @@ -328,7 +357,7 @@
img.Kickstart.OSTree = &kickstart.OSTree{
OSName: "default",
}
img.InstallerCustomizations.UseRHELLoraxTemplates = needsRHELLoraxTemplates(c.SourceInfo.OSRelease)
img.InstallerCustomizations.LoraxTemplates = installerConfig.LoraxTemplates

// see https://github.com/osbuild/bootc-image-builder/issues/733
img.InstallerCustomizations.ISORootfsType = manifest.SquashfsRootfs
Expand Down
8 changes: 3 additions & 5 deletions bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"bytes"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -177,13 +176,11 @@ func manifestFromCobraForDisk(imgref, buildImgref, imgTypeStr, rootFs, rpmCacheR
return nil, nil, err
}

var buf bytes.Buffer
repos, err := reporegistry.New(nil, []fs.FS{repos.FS})
if err != nil {
return nil, nil, err
}
mg, err := manifestgen.New(repos, &manifestgen.Options{
Output: &buf,
// XXX: hack to skip repo loading for the bootc image.
// We need to add a SkipRepositories or similar to
// manifestgen instead to make this clean
Expand All @@ -196,10 +193,11 @@ func manifestFromCobraForDisk(imgref, buildImgref, imgTypeStr, rootFs, rpmCacheR
if err != nil {
return nil, nil, err
}
if err := mg.Generate(config, distro, imgType, archi, nil); err != nil {
manifest, err := mg.Generate(config, imgType, nil)
if err != nil {
return nil, nil, err
}
return buf.Bytes(), nil, nil
return manifest, nil, nil
}

func cmdManifest(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion bib/cmd/upload/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func uploadAMI(cmd *cobra.Command, args []string) {
// nolint:errcheck
defer f.Close()

check(uploader.UploadAndRegister(f, os.Stderr))
check(uploader.UploadAndRegister(f, 0, os.Stderr))
}

func setupCLI() *cobra.Command {
Expand Down
1 change: 0 additions & 1 deletion bib/data/defs/almalinux-10.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bib/data/defs/almalinux-9.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bib/data/defs/aurora-40.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bib/data/defs/aurora-helium-10.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bib/data/defs/bazzite-40.yaml

This file was deleted.

1 change: 0 additions & 1 deletion bib/data/defs/bluefin-40.yaml

This file was deleted.

93 changes: 0 additions & 93 deletions bib/data/defs/centos-10.yaml

This file was deleted.

Loading
Loading