From 1a7514dcc4ea3210ea255e3a50fcb2a9c8bff476 Mon Sep 17 00:00:00 2001 From: djach7 Date: Thu, 26 Oct 2023 13:16:26 -0400 Subject: [PATCH] Testing CI with updated images repo --- go.mod | 3 +++ go.sum | 4 ++-- .../osbuild/images/internal/fdo/fdo.go | 9 ++++---- .../images/pkg/blueprint/customizations.go | 5 ++-- .../osbuild/images/pkg/distro/rhel8/edge.go | 3 +-- .../osbuild/images/pkg/distro/rhel9/ami.go | 1 - .../osbuild/images/pkg/distro/rhel9/edge.go | 3 --- .../osbuild/images/pkg/distro/rhel9/images.go | 7 +----- .../pkg/image/ostree_simplified_installer.go | 3 +++ .../osbuild/images/pkg/manifest/raw_ostree.go | 16 +------------ .../osbuild/images/pkg/osbuild/copy_stage.go | 19 +-------------- .../osbuild/images/pkg/osbuild/device.go | 23 ++++++------------- vendor/modules.txt | 3 ++- 13 files changed, 29 insertions(+), 70 deletions(-) diff --git a/go.mod b/go.mod index 8906945ac7f..83a78d67507 100644 --- a/go.mod +++ b/go.mod @@ -185,3 +185,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// For testing with local images repo, will be removed in final +replace github.com/osbuild/images => github.com/djach7/images v0.0.0-20231031181955-7cc5d9caf67b diff --git a/go.sum b/go.sum index e74e9b023c1..2abd8053f11 100644 --- a/go.sum +++ b/go.sum @@ -104,6 +104,8 @@ github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRk github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= +github.com/djach7/images v0.0.0-20231031181955-7cc5d9caf67b h1:1U7+pMyKwEJ9ms51DQ6aYoHbkvqBAipoVkM7ysVHwPg= +github.com/djach7/images v0.0.0-20231031181955-7cc5d9caf67b/go.mod h1:ADky8mmrdfxM9IQoO0YdLI5VKvEsvrpRAX7WqZie50w= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= @@ -445,8 +447,6 @@ github.com/openshift-online/ocm-sdk-go v0.1.385 h1:EZs7CDfxtJEwywCERdNX6rApyFaJ+ github.com/openshift-online/ocm-sdk-go v0.1.385/go.mod h1:/+VFIw1iW2H0jEkFH4GnbL/liWareyzsL0w7mDIudB4= 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/osbuild/images v0.15.0 h1:9Fuaet/gWQ5WoX/nE2ooTcxgyWnlwTwk+w4+9JVjqRs= -github.com/osbuild/images v0.15.0/go.mod h1:N+XvrV/SoMeN7i2H499tOZMK6HV6JNzlA/wH3+DF/9g= github.com/osbuild/pulp-client v0.1.0 h1:L0C4ezBJGTamN3BKdv+rKLuq/WxXJbsFwz/Hj7aEmJ8= github.com/osbuild/pulp-client v0.1.0/go.mod h1:rd/MLdfwwO2cQI1s056h8z32zAi3Bo90XhlAAryIvWc= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= diff --git a/vendor/github.com/osbuild/images/internal/fdo/fdo.go b/vendor/github.com/osbuild/images/internal/fdo/fdo.go index c047a62158e..d86573baed9 100644 --- a/vendor/github.com/osbuild/images/internal/fdo/fdo.go +++ b/vendor/github.com/osbuild/images/internal/fdo/fdo.go @@ -3,10 +3,11 @@ package fdo import "github.com/osbuild/images/pkg/blueprint" type Options struct { - ManufacturingServerURL string - DiunPubKeyInsecure string - DiunPubKeyHash string - DiunPubKeyRootCerts string + ManufacturingServerURL string + DiunPubKeyInsecure string + DiunPubKeyHash string + DiunPubKeyRootCerts string + DiMfgStringTypeMacIface string } func FromBP(bpFDO blueprint.FDOCustomization) *Options { diff --git a/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go b/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go index 0fea9354518..c81712abafa 100644 --- a/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go +++ b/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go @@ -44,8 +44,9 @@ type FDOCustomization struct { DiunPubKeyInsecure string `json:"diun_pub_key_insecure,omitempty" toml:"diun_pub_key_insecure,omitempty"` // This is the output of: // echo "sha256:$(openssl x509 -fingerprint -sha256 -noout -in diun_cert.pem | cut -d"=" -f2 | sed 's/://g')" - DiunPubKeyHash string `json:"diun_pub_key_hash,omitempty" toml:"diun_pub_key_hash,omitempty"` - DiunPubKeyRootCerts string `json:"diun_pub_key_root_certs,omitempty" toml:"diun_pub_key_root_certs,omitempty"` + DiunPubKeyHash string `json:"diun_pub_key_hash,omitempty" toml:"diun_pub_key_hash,omitempty"` + DiunPubKeyRootCerts string `json:"diun_pub_key_root_certs,omitempty" toml:"diun_pub_key_root_certs,omitempty"` + DiMfgStringTypeMacIface string `json:"di_mfg_string_type_mac_iface,omitempty" toml:"di_mfg_string_type_mac_iface,omitempty"` } type KernelCustomization struct { diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel8/edge.go b/vendor/github.com/osbuild/images/pkg/distro/rhel8/edge.go index bbf6fa7d137..f19ffd2fce0 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel8/edge.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel8/edge.go @@ -65,13 +65,12 @@ func edgeRawImgType() imageType { filename: "image.raw.xz", compression: "xz", mimeType: "application/xz", - image: edgeRawImage, packageSets: nil, defaultSize: 10 * common.GibiByte, rpmOstree: true, bootable: true, bootISO: false, - kernelOptions: "modprobe.blacklist=vc4", + image: edgeRawImage, buildPipelines: []string{"build"}, payloadPipelines: []string{"ostree-deployment", "image", "xz"}, exports: []string{"xz"}, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel9/ami.go b/vendor/github.com/osbuild/images/pkg/distro/rhel9/ami.go index d863bcf1cb9..d2ec6809cbe 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel9/ami.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel9/ami.go @@ -8,7 +8,6 @@ import ( "github.com/osbuild/images/pkg/subscription" ) -// TODO: move these to the EC2 environment const amiKernelOptions = "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295" var ( diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel9/edge.go b/vendor/github.com/osbuild/images/pkg/distro/rhel9/edge.go index e53066a400b..c619510037e 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel9/edge.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel9/edge.go @@ -69,7 +69,6 @@ var ( defaultImageConfig: &distro.ImageConfig{ Locale: common.ToPtr("en_US.UTF-8"), }, - kernelOptions: "modprobe.blacklist=vc4", defaultSize: 10 * common.GibiByte, rpmOstree: true, bootable: true, @@ -146,7 +145,6 @@ var ( defaultImageConfig: &distro.ImageConfig{ Locale: common.ToPtr("en_US.UTF-8"), }, - kernelOptions: amiKernelOptions + " modprobe.blacklist=vc4", defaultSize: 10 * common.GibiByte, rpmOstree: true, bootable: true, @@ -167,7 +165,6 @@ var ( defaultImageConfig: &distro.ImageConfig{ Locale: common.ToPtr("en_US.UTF-8"), }, - kernelOptions: "modprobe.blacklist=vc4", defaultSize: 10 * common.GibiByte, rpmOstree: true, bootable: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel9/images.go b/vendor/github.com/osbuild/images/pkg/distro/rhel9/images.go index c978ae022ee..7e7c4a5249c 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel9/images.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel9/images.go @@ -405,12 +405,7 @@ func edgeRawImage(workload workload.Workload, img.Users = users.UsersFromBP(customizations.GetUsers()) img.Groups = users.GroupsFromBP(customizations.GetGroups()) - // The kernel options defined on the image type are usually handled in - // osCustomiztions() but ostree images don't use OSCustomizations, so we - // handle them here separately. - if t.kernelOptions != "" { - img.KernelOptionsAppend = append(img.KernelOptionsAppend, t.kernelOptions) - } + img.KernelOptionsAppend = []string{"modprobe.blacklist=vc4"} img.Keyboard = "us" img.Locale = "C.UTF-8" if !common.VersionLessThan(t.arch.distro.osVersion, "9.2") || !t.arch.distro.isRHEL() { diff --git a/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go b/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go index 1f06759c44b..b34811e0675 100644 --- a/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go +++ b/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go @@ -126,6 +126,9 @@ func (img *OSTreeSimplifiedInstaller) InstantiateManifest(m *manifest.Manifest, if img.FDO.DiunPubKeyRootCerts != "" { kernelOpts = append(kernelOpts, "fdo.diun_pub_key_root_certs=/fdo_diun_pub_key_root_certs.pem") } + if img.FDO.DiMfgStringTypeMacIface != "" { + kernelOpts = append(kernelOpts, "fdo.di_mfg_string_type_mac_iface="+img.FDO.DiMfgStringTypeMacIface) + } } bootTreePipeline.KernelOpts = kernelOpts diff --git a/vendor/github.com/osbuild/images/pkg/manifest/raw_ostree.go b/vendor/github.com/osbuild/images/pkg/manifest/raw_ostree.go index c1c1577d9b0..e9f74777e68 100644 --- a/vendor/github.com/osbuild/images/pkg/manifest/raw_ostree.go +++ b/vendor/github.com/osbuild/images/pkg/manifest/raw_ostree.go @@ -83,24 +83,10 @@ func (p *RawOSTreeImage) serialize() osbuild.Pipeline { "ostree-tree": *osbuild.NewOSTreeCheckoutInput("org.osbuild.source", commitChecksum), } - // Find the FS root mount name to use as the destination root - // for the target when copying the boot files. - var fsRootMntName string - for _, mnt := range *bootCopyMounts { - if mnt.Target == "/" { - fsRootMntName = mnt.Name - break - } - } - - if fsRootMntName == "" { - panic("no mount found for the filesystem root") - } - for _, paths := range bootFiles { bootCopyOptions.Paths = append(bootCopyOptions.Paths, osbuild.CopyStagePath{ From: fmt.Sprintf("input://ostree-tree/%s%s", commitChecksum, paths[0]), - To: fmt.Sprintf("mount://%s%s", fsRootMntName, paths[1]), + To: fmt.Sprintf("mount://root%s", paths[1]), }) } diff --git a/vendor/github.com/osbuild/images/pkg/osbuild/copy_stage.go b/vendor/github.com/osbuild/images/pkg/osbuild/copy_stage.go index 6d21df32308..8fc41e50fe1 100644 --- a/vendor/github.com/osbuild/images/pkg/osbuild/copy_stage.go +++ b/vendor/github.com/osbuild/images/pkg/osbuild/copy_stage.go @@ -2,7 +2,6 @@ package osbuild import ( "fmt" - "reflect" "sort" "github.com/osbuild/images/pkg/disk" @@ -65,15 +64,10 @@ func GenCopyFSTreeOptions(inputName, inputPipeline, filename string, pt *disk.Pa devices := make(map[string]Device, len(pt.Partitions)) mounts := make([]Mount, 0, len(pt.Partitions)) - var fsRootMntName string genMounts := func(mnt disk.Mountable, path []disk.Entity) error { stageDevices, name := getDevices(path, filename, false) mountpoint := mnt.GetMountpoint() - if mountpoint == "/" { - fsRootMntName = name - } - var mount *Mount t := mnt.GetFSType() switch t { @@ -92,13 +86,6 @@ func GenCopyFSTreeOptions(inputName, inputPipeline, filename string, pt *disk.Pa // update devices map with new elements from stageDevices for devName := range stageDevices { - if existingDevice, exists := devices[devName]; exists { - // It is usual that the a device is generated twice for the same Entity e.g. LVM VG, which is OK. - // Therefore fail only if a device with the same name is generated for two different Entities. - if !reflect.DeepEqual(existingDevice, stageDevices[devName]) { - panic(fmt.Sprintf("the device name %q has been generated for two different devices", devName)) - } - } devices[devName] = stageDevices[devName] } return nil @@ -114,10 +101,6 @@ func GenCopyFSTreeOptions(inputName, inputPipeline, filename string, pt *disk.Pa return mounts[i].Target < mounts[j].Target }) - if fsRootMntName == "" { - panic("no mount found for the filesystem root") - } - stageMounts := Mounts(mounts) stageDevices := Devices(devices) @@ -125,7 +108,7 @@ func GenCopyFSTreeOptions(inputName, inputPipeline, filename string, pt *disk.Pa Paths: []CopyStagePath{ { From: fmt.Sprintf("input://%s/", inputName), - To: fmt.Sprintf("mount://%s/", fsRootMntName), + To: "mount://root/", }, }, } diff --git a/vendor/github.com/osbuild/images/pkg/osbuild/device.go b/vendor/github.com/osbuild/images/pkg/osbuild/device.go index feba2c83427..66d651a7bc1 100644 --- a/vendor/github.com/osbuild/images/pkg/osbuild/device.go +++ b/vendor/github.com/osbuild/images/pkg/osbuild/device.go @@ -153,11 +153,11 @@ func deviceName(p disk.Entity) string { switch payload := p.(type) { case disk.Mountable: - return pathEscape(payload.GetMountpoint()) + return pathdot(payload.GetMountpoint()) case *disk.LUKSContainer: return "luks-" + payload.UUID[:4] case *disk.LVMVolumeGroup: - return payload.Name + return payload.Name + "vg" case *disk.LVMLogicalVolume: return payload.Name } @@ -206,21 +206,12 @@ func getDevices(path []disk.Entity, filename string, lockLoopback bool) (map[str return do, parent } -// pathEscape implements similar path escaping as used by systemd-escape -// https://github.com/systemd/systemd/blob/c57ff6230e4e199d40f35a356e834ba99f3f8420/src/basic/unit-name.c#L389 -func pathEscape(path string) string { - if len(path) == 0 || path == "/" { - return "-" - } - - path = strings.Trim(path, "/") - - escapeChars := func(s, char string) string { - return strings.ReplaceAll(s, char, fmt.Sprintf("\\x%x", char[0])) +func pathdot(path string) string { + if path == "/" { + return "root" } - path = escapeChars(path, "\\") - path = escapeChars(path, "-") + path = strings.TrimLeft(path, "/") - return strings.ReplaceAll(path, "/", "-") + return strings.ReplaceAll(path, "/", ".") } diff --git a/vendor/modules.txt b/vendor/modules.txt index 00dc3a5f464..f5dbcc69b92 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -655,7 +655,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/transfer github.com/oracle/oci-go-sdk/v54/workrequests -# github.com/osbuild/images v0.15.0 +# github.com/osbuild/images v0.15.0 => github.com/djach7/images v0.0.0-20231031181955-7cc5d9caf67b ## explicit; go 1.19 github.com/osbuild/images/internal/common github.com/osbuild/images/internal/environment @@ -1145,3 +1145,4 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 +# github.com/osbuild/images => github.com/djach7/images v0.0.0-20231031181955-7cc5d9caf67b