go.mod: bump osbuild/images to v0.65.0

This commit is contained in:
Achilleas Koutsou 2024-06-07 14:03:40 +02:00
parent c80ca0a64d
commit 7abcd279eb
12 changed files with 141 additions and 92 deletions

2
go.mod
View file

@ -36,7 +36,7 @@ require (
github.com/labstack/gommon v0.4.2 github.com/labstack/gommon v0.4.2
github.com/openshift-online/ocm-sdk-go v0.1.420 github.com/openshift-online/ocm-sdk-go v0.1.420
github.com/oracle/oci-go-sdk/v54 v54.0.0 github.com/oracle/oci-go-sdk/v54 v54.0.0
github.com/osbuild/images v0.63.0 github.com/osbuild/images v0.65.0
github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1 github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1
github.com/osbuild/pulp-client v0.1.0 github.com/osbuild/pulp-client v0.1.0
github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_golang v1.19.1

4
go.sum
View file

@ -500,8 +500,8 @@ github.com/openshift-online/ocm-sdk-go v0.1.420 h1:zC/TboLemC09T5qxSdF5IZR20wnn4
github.com/openshift-online/ocm-sdk-go v0.1.420/go.mod h1:CiAu2jwl3ITKOxkeV0Qnhzv4gs35AmpIzVABQLtcI2Y= github.com/openshift-online/ocm-sdk-go v0.1.420/go.mod h1:CiAu2jwl3ITKOxkeV0Qnhzv4gs35AmpIzVABQLtcI2Y=
github.com/oracle/oci-go-sdk/v54 v54.0.0 h1:CDLjeSejv2aDpElAJrhKpi6zvT/zhZCZuXchUUZ+LS4= github.com/oracle/oci-go-sdk/v54 v54.0.0 h1:CDLjeSejv2aDpElAJrhKpi6zvT/zhZCZuXchUUZ+LS4=
github.com/oracle/oci-go-sdk/v54 v54.0.0/go.mod h1:+t+yvcFGVp+3ZnztnyxqXfQDsMlq8U25faBLa+mqCMc= github.com/oracle/oci-go-sdk/v54 v54.0.0/go.mod h1:+t+yvcFGVp+3ZnztnyxqXfQDsMlq8U25faBLa+mqCMc=
github.com/osbuild/images v0.63.0 h1:tk75nDV78Pbi+RBXCclHYQbzzJeqJDsCMVmDCWRhLcM= github.com/osbuild/images v0.65.0 h1:Vq6r5YQJvTYiznBPma8sHffNyPl0rx1i6hwMN+AbrIA=
github.com/osbuild/images v0.63.0/go.mod h1:kkiJNrd0XkVfwBxrJ8wWt6/d0+Eb+tG+zZVnw/xXE/8= github.com/osbuild/images v0.65.0/go.mod h1:kkiJNrd0XkVfwBxrJ8wWt6/d0+Eb+tG+zZVnw/xXE/8=
github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1 h1:UFEJIcPa46W8gtWgOYzriRKYyy1t6SWL0BI7fPTuVvc= github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1 h1:UFEJIcPa46W8gtWgOYzriRKYyy1t6SWL0BI7fPTuVvc=
github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1/go.mod h1:z+WA+dX6qMwc7fqY5jCzESDIlg4WR2sBQezxsoXv9Ik= github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1/go.mod h1:z+WA+dX6qMwc7fqY5jCzESDIlg4WR2sBQezxsoXv9Ik=
github.com/osbuild/pulp-client v0.1.0 h1:L0C4ezBJGTamN3BKdv+rKLuq/WxXJbsFwz/Hj7aEmJ8= github.com/osbuild/pulp-client v0.1.0 h1:L0C4ezBJGTamN3BKdv+rKLuq/WxXJbsFwz/Hj7aEmJ8=

View file

@ -1,8 +1,10 @@
package common package common
import ( import (
"bytes"
"fmt" "fmt"
"io" "io"
"os/exec"
"regexp" "regexp"
"sort" "sort"
"strconv" "strconv"
@ -84,3 +86,26 @@ type nopSeekCloser struct {
} }
func (nopSeekCloser) Close() error { return nil } func (nopSeekCloser) Close() error { return nil }
// MountUnitNameFor returns the escaped name of the mount unit for a given
// mountpoint by calling:
//
// systemd-escape --path --suffix=mount "mountpoint"
func MountUnitNameFor(mountpoint string) (string, error) {
cmd := exec.Command("systemd-escape", "--path", "--suffix=mount", mountpoint)
stdout, err := cmd.Output()
if err != nil {
return "", fmt.Errorf("systemd-escape call failed: %s", ExecError(err))
}
return strings.TrimSpace(string(stdout)), nil
}
// ExecError handles the error from an exec.Command().Output() call. It returns
// a formatted error that includes StdErr when the error is of type
// exec.ExitError.
func ExecError(err error) error {
if err, ok := err.(*exec.ExitError); ok {
return fmt.Errorf("%s [%w]", bytes.TrimSpace(err.Stderr), err)
}
return err
}

View file

@ -872,7 +872,6 @@ func newDistro(version int) distro.Distro {
minimalrawImgType, minimalrawImgType,
) )
// iot simplified installer was introduced in F38
x86_64.addImageTypes( x86_64.addImageTypes(
&platform.X86{ &platform.X86{
BasePlatform: platform.BasePlatform{ BasePlatform: platform.BasePlatform{
@ -921,62 +920,59 @@ func newDistro(version int) distro.Distro {
iotSimplifiedInstallerImgType, iotSimplifiedInstallerImgType,
) )
if common.VersionGreaterThanOrEqual(rd.Releasever(), "39") { x86_64.addImageTypes(
// bootc was introduced in F39 &platform.X86{
x86_64.addImageTypes( BasePlatform: platform.BasePlatform{
&platform.X86{ FirmwarePackages: []string{
BasePlatform: platform.BasePlatform{ "biosdevname",
FirmwarePackages: []string{ "iwlwifi-dvm-firmware",
"biosdevname", "iwlwifi-mvm-firmware",
"iwlwifi-dvm-firmware", "microcode_ctl",
"iwlwifi-mvm-firmware",
"microcode_ctl",
},
}, },
BIOS: true,
UEFIVendor: "fedora",
}, },
iotBootableContainer, BIOS: true,
) UEFIVendor: "fedora",
aarch64.addImageTypes( },
&platform.Aarch64{ iotBootableContainer,
BasePlatform: platform.BasePlatform{ )
FirmwarePackages: []string{ aarch64.addImageTypes(
"arm-image-installer", &platform.Aarch64{
"bcm283x-firmware", BasePlatform: platform.BasePlatform{
"brcmfmac-firmware", FirmwarePackages: []string{
"iwlwifi-mvm-firmware", "arm-image-installer",
"realtek-firmware", "bcm283x-firmware",
"uboot-images-armv8", "brcmfmac-firmware",
}, "iwlwifi-mvm-firmware",
"realtek-firmware",
"uboot-images-armv8",
}, },
UEFIVendor: "fedora",
}, },
iotBootableContainer, UEFIVendor: "fedora",
) },
iotBootableContainer,
)
ppc64le.addImageTypes( ppc64le.addImageTypes(
&platform.PPC64LE{ &platform.PPC64LE{
BIOS: true, BIOS: true,
BasePlatform: platform.BasePlatform{ BasePlatform: platform.BasePlatform{
ImageFormat: platform.FORMAT_QCOW2, ImageFormat: platform.FORMAT_QCOW2,
QCOW2Compat: "1.1", QCOW2Compat: "1.1",
},
}, },
iotBootableContainer, },
) iotBootableContainer,
)
s390x.addImageTypes( s390x.addImageTypes(
&platform.S390X{ &platform.S390X{
Zipl: true, Zipl: true,
BasePlatform: platform.BasePlatform{ BasePlatform: platform.BasePlatform{
ImageFormat: platform.FORMAT_QCOW2, ImageFormat: platform.FORMAT_QCOW2,
QCOW2Compat: "1.1", QCOW2Compat: "1.1",
},
}, },
iotBootableContainer, },
) iotBootableContainer,
} )
ppc64le.addImageTypes( ppc64le.addImageTypes(
&platform.PPC64LE{ &platform.PPC64LE{

View file

@ -474,14 +474,6 @@ func anacondaPackageSet(t *imageType) rpmmd.PackageSet {
}, },
}) })
if common.VersionLessThan(t.arch.distro.osVersion, "39") {
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"lklug-fonts", // orphaned, unavailable in F39
},
})
}
switch t.Arch().Name() { switch t.Arch().Name() {
case arch.ARCH_X86_64.String(): case arch.ARCH_X86_64.String():
ps = ps.Append(rpmmd.PackageSet{ ps = ps.Append(rpmmd.PackageSet{
@ -627,14 +619,6 @@ func containerPackageSet(t *imageType) rpmmd.PackageSet {
}, },
} }
if common.VersionLessThan(t.arch.distro.osVersion, "39") {
ps = ps.Append(rpmmd.PackageSet{
Include: []string{
"fedora-repos-modular",
},
})
}
return ps return ps
} }
@ -705,7 +689,8 @@ func iotSimplifiedInstallerPackageSet(t *imageType) rpmmd.PackageSet {
"shadow-utils", // includes passwd "shadow-utils", // includes passwd
}, },
}) })
} else if common.VersionLessThan(t.arch.distro.osVersion, "40") { } else {
// F39 only
ps = ps.Append(rpmmd.PackageSet{ ps = ps.Append(rpmmd.PackageSet{
Include: []string{ Include: []string{
"passwd", "passwd",

View file

@ -431,13 +431,13 @@ var iotSimplifiedInstallerPartitionTables = distro.BasePartitionTableMap{
}, },
}, },
arch.ARCH_AARCH64.String(): disk.PartitionTable{ arch.ARCH_AARCH64.String(): disk.PartitionTable{
UUID: "0xc1748067", UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
Type: "dos", Type: "gpt",
Partitions: []disk.Partition{ Partitions: []disk.Partition{
{ {
Size: 501 * common.MebiByte, Size: 501 * common.MebiByte,
Type: "06", Type: disk.EFISystemPartitionGUID,
Bootable: true, UUID: disk.EFISystemPartitionUUID,
Payload: &disk.Filesystem{ Payload: &disk.Filesystem{
Type: "vfat", Type: "vfat",
UUID: disk.EFIFilesystemUUID, UUID: disk.EFIFilesystemUUID,

View file

@ -256,10 +256,14 @@ func azureRhuiPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
// Includes the common azure package set, the common SAP packages, and // Includes the common azure package set, the common SAP packages, and
// the azure rhui sap package. // the azure rhui sap package.
func azureSapPackageSet(t *rhel.ImageType) rpmmd.PackageSet { func azureSapPackageSet(t *rhel.ImageType) rpmmd.PackageSet {
rhuiPkg := "rhui-azure-rhel8-sap-ha"
if t.Arch().Distro().OsVersion() == "8.10" {
rhuiPkg = "rhui-azure-rhel8-base-sap-ha"
}
return rpmmd.PackageSet{ return rpmmd.PackageSet{
Include: []string{ Include: []string{
"firewalld", "firewalld",
"rhui-azure-rhel8-sap-ha", rhuiPkg,
}, },
}.Append(azureCommonPackageSet(t)).Append(SapPackageSet(t)) }.Append(azureCommonPackageSet(t)).Append(SapPackageSet(t))
} }

View file

@ -460,10 +460,12 @@ func (s *Solver) makeDepsolveRequest(pkgSets []rpmmd.PackageSet) (*Request, map[
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
args := arguments{ args := arguments{
Repos: dnfRepoMap, Repos: dnfRepoMap,
RootDir: s.rootDir, RootDir: s.rootDir,
Transactions: transactions, Transactions: transactions,
OptionalMetadata: s.optionalMetadataForDistro(),
} }
req := Request{ req := Request{
@ -479,6 +481,20 @@ func (s *Solver) makeDepsolveRequest(pkgSets []rpmmd.PackageSet) (*Request, map[
return &req, rhsmMap, nil return &req, rhsmMap, nil
} }
func (s *Solver) optionalMetadataForDistro() []string {
// filelist repo metadata is required when using newer versions of libdnf
// with old repositories or packages that specify dependencies on files.
// EL10+ and Fedora 40+ packaging guidelines prohibit depending on
// filepaths so filelist downloads are disabled by default and are not
// required when depsolving for those distros. Explicitly enable the option
// for older distro versions in case we are using a newer libdnf.
switch s.modulePlatformID {
case "platform:f39", "platform:el7", "platform:el8", "platform:el9":
return []string{"filelists"}
}
return nil
}
// Helper function for creating a dump request payload // Helper function for creating a dump request payload
func (s *Solver) makeDumpRequest(repos []rpmmd.RepoConfig) (*Request, error) { func (s *Solver) makeDumpRequest(repos []rpmmd.RepoConfig) (*Request, error) {
dnfRepos, err := s.reposFromRPMMD(repos) dnfRepos, err := s.reposFromRPMMD(repos)
@ -640,6 +656,9 @@ type arguments struct {
// Load repository configurations, gpg keys, and vars from an os-root-like // Load repository configurations, gpg keys, and vars from an os-root-like
// tree. // tree.
RootDir string `json:"root_dir"` RootDir string `json:"root_dir"`
// Optional metadata to download for the repositories
OptionalMetadata []string `json:"optional-metadata,omitempty"`
} }
type searchArgs struct { type searchArgs struct {

View file

@ -513,17 +513,32 @@ func createMountpointService(serviceName string, mountpoints []string) *osbuild.
} }
unit := osbuild.Unit{ unit := osbuild.Unit{
Description: "Ensure custom filesystem mountpoints exist", Description: "Ensure custom filesystem mountpoints exist",
DefaultDependencies: false, DefaultDependencies: common.ToPtr(false), // Default dependencies would interfere with our custom order (before mountpoints)
ConditionPathIsDirectory: conditionPathIsDirectory, ConditionPathIsDirectory: conditionPathIsDirectory,
After: []string{"ostree-remount.service"},
} }
service := osbuild.Service{ service := osbuild.Service{
Type: osbuild.Oneshot, Type: osbuild.Oneshot,
RemainAfterExit: true, RemainAfterExit: false,
//compatibility with composefs, will require transient rootfs to be enabled too. // compatibility with composefs, will require transient rootfs to be enabled too.
ExecStartPre: []string{"/bin/sh -c \"if [ -z \"$(grep -Uq composefs /run/ostree-booted)\" ]; then chattr -i /; fi\""}, ExecStartPre: []string{"/bin/sh -c \"if grep -Uq composefs /run/ostree-booted; then chattr -i /; fi\""},
ExecStopPost: []string{"/bin/sh -c \"if [ -z \"$(grep -Uq composefs /run/ostree-booted)\" ]; then chattr +i /; fi\""}, ExecStopPost: []string{"/bin/sh -c \"if grep -Uq composefs /run/ostree-booted; then chattr +i /; fi\""},
ExecStart: []string{"mkdir -p " + strings.Join(mountpoints[:], " ")}, ExecStart: []string{"mkdir -p " + strings.Join(mountpoints, " ")},
} }
// For every mountpoint we want to ensure, we need to set a Before order on
// the mount unit itself so that our mkdir runs before any of them are
// mounted
befores := make([]string, len(mountpoints))
for idx, mp := range mountpoints {
before, err := common.MountUnitNameFor(mp)
if err != nil {
panic(err)
}
befores[idx] = before
}
unit.Before = befores
install := osbuild.Install{ install := osbuild.Install{
WantedBy: []string{"local-fs.target"}, WantedBy: []string{"local-fs.target"},
} }

View file

@ -23,12 +23,13 @@ const (
type Unit struct { type Unit struct {
Description string `json:"Description,omitempty"` Description string `json:"Description,omitempty"`
DefaultDependencies bool `json:"DefaultDependencies,omitempty"` DefaultDependencies *bool `json:"DefaultDependencies,omitempty"`
ConditionPathExists []string `json:"ConditionPathExists,omitempty"` ConditionPathExists []string `json:"ConditionPathExists,omitempty"`
ConditionPathIsDirectory []string `json:"ConditionPathIsDirectory,omitempty"` ConditionPathIsDirectory []string `json:"ConditionPathIsDirectory,omitempty"`
Requires []string `json:"Requires,omitempty"` Requires []string `json:"Requires,omitempty"`
Wants []string `json:"Wants,omitempty"` Wants []string `json:"Wants,omitempty"`
After []string `json:"After,omitempty"` After []string `json:"After,omitempty"`
Before []string `json:"Before,omitempty"`
} }
type Service struct { type Service struct {

View file

@ -85,14 +85,18 @@ var CustomFilesPolicies = pathpolicy.NewPathPolicies(map[string]pathpolicy.PathP
// MountpointPolicies for ostree // MountpointPolicies for ostree
var OstreeMountpointPolicies = pathpolicy.NewPathPolicies(map[string]pathpolicy.PathPolicy{ var OstreeMountpointPolicies = pathpolicy.NewPathPolicies(map[string]pathpolicy.PathPolicy{
"/": {}, "/": {},
"/ostree": {Deny: true}, "/home": {Deny: true}, // symlink to var/home
"/home": {Deny: true}, "/mnt": {Deny: true}, // symlink to var/mnt
"/opt": {Deny: true}, // symlink to var/opt
"/ostree": {Deny: true}, // symlink to sysroot/ostree
"/root": {Deny: true}, // symlink to var/roothome
"/srv": {Deny: true}, // symlink to var/srv
"/var/home": {Deny: true}, "/var/home": {Deny: true},
"/var/opt": {Deny: true},
"/var/srv": {Deny: true},
"/var/roothome": {Deny: true},
"/var/usrlocal": {Deny: true},
"/var/mnt": {Deny: true}, "/var/mnt": {Deny: true},
"/var/opt": {Deny: true},
"/var/roothome": {Deny: true},
"/var/srv": {Deny: true},
"/var/usrlocal": {Deny: true},
}) })
// CustomDirectoriesPolicies for ostree // CustomDirectoriesPolicies for ostree

2
vendor/modules.txt vendored
View file

@ -865,7 +865,7 @@ github.com/oracle/oci-go-sdk/v54/identity
github.com/oracle/oci-go-sdk/v54/objectstorage github.com/oracle/oci-go-sdk/v54/objectstorage
github.com/oracle/oci-go-sdk/v54/objectstorage/transfer github.com/oracle/oci-go-sdk/v54/objectstorage/transfer
github.com/oracle/oci-go-sdk/v54/workrequests github.com/oracle/oci-go-sdk/v54/workrequests
# github.com/osbuild/images v0.63.0 # github.com/osbuild/images v0.65.0
## explicit; go 1.20 ## explicit; go 1.20
github.com/osbuild/images/internal/common github.com/osbuild/images/internal/common
github.com/osbuild/images/internal/environment github.com/osbuild/images/internal/environment