diff --git a/internal/distro/image_config.go b/internal/distro/image_config.go index 72de9aa01..ae840c01f 100644 --- a/internal/distro/image_config.go +++ b/internal/distro/image_config.go @@ -20,6 +20,9 @@ type ImageConfig struct { DefaultTarget string Sysconfig []*osbuild2.SysconfigStageOptions + // List of files from which to import GPG keys into the RPM database + GPGKeyFiles []string + // for RHSM configuration, we need to potentially distinguish the case // when the user want the image to be subscribed on first boot and when not RHSMConfig map[RHSMSubscriptionStatus]*osbuild2.RHSMStageOptions @@ -72,6 +75,9 @@ func (c *ImageConfig) InheritFrom(parentConfig *ImageConfig) *ImageConfig { if finalConfig.Sysconfig == nil { finalConfig.Sysconfig = parentConfig.Sysconfig } + if finalConfig.GPGKeyFiles == nil { + finalConfig.GPGKeyFiles = parentConfig.GPGKeyFiles + } if finalConfig.RHSMConfig == nil { finalConfig.RHSMConfig = parentConfig.RHSMConfig } diff --git a/internal/distro/rhel86/pipelines.go b/internal/distro/rhel86/pipelines.go index b28c33489..cdcbd87d5 100644 --- a/internal/distro/rhel86/pipelines.go +++ b/internal/distro/rhel86/pipelines.go @@ -371,7 +371,9 @@ func osPipeline(t *imageType, p.AddStage(osbuild.NewOSTreePasswdStage("org.osbuild.source", options.OSTree.Parent)) } - p.AddStage(osbuild.NewRPMStage(rpmStageOptions(repos), osbuild.NewRpmStageSourceFilesInputs(packages))) + rpmOptions := rpmStageOptions(repos) + rpmOptions.GPGKeysFromTree = imageConfig.GPGKeyFiles + p.AddStage(osbuild.NewRPMStage(rpmOptions, osbuild.NewRpmStageSourceFilesInputs(packages))) // If the /boot is on a separate partition, the prefix for the BLS stage must be "" if pt == nil || pt.FindMountable("/boot") == nil { diff --git a/internal/distro/rhel90/pipelines.go b/internal/distro/rhel90/pipelines.go index debb33e7e..c0b9974f6 100644 --- a/internal/distro/rhel90/pipelines.go +++ b/internal/distro/rhel90/pipelines.go @@ -363,7 +363,9 @@ func osPipeline(t *imageType, p.AddStage(osbuild.NewOSTreePasswdStage("org.osbuild.source", options.OSTree.Parent)) } - p.AddStage(osbuild.NewRPMStage(rpmStageOptions(repos), osbuild.NewRpmStageSourceFilesInputs(packages))) + rpmOptions := rpmStageOptions(repos) + rpmOptions.GPGKeysFromTree = imageConfig.GPGKeyFiles + p.AddStage(osbuild.NewRPMStage(rpmOptions, osbuild.NewRpmStageSourceFilesInputs(packages))) // If the /boot is on a separate partition, the prefix for the BLS stage must be "" if pt == nil || pt.FindMountable("/boot") == nil {