distro: add GPGKeyFiles option to ImageConfig

Add a new option `GPGKeyFiles` to ImageConfig that indicates which files
containing GPG keys should be imported into rpm. For now it will be used
by the osPipeline in rhel{86,90} to set the corresponding option in the
`org.osbuild.rpm` stage.
This commit is contained in:
Christian Kellner 2022-03-03 23:20:17 +01:00 committed by Ondřej Budai
parent 92d32e697d
commit dbd6f1f48c
3 changed files with 12 additions and 2 deletions

View file

@ -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
}

View file

@ -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 {

View file

@ -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 {