Koji: expose boot mode in image extra metadata
Also extend the Koji test case to verify that the boot mode information is in the build extra metadata and that it contains valid value. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
0a5c82086a
commit
4ac6a7a11d
5 changed files with 27 additions and 5 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/upload/koji"
|
||||
)
|
||||
|
|
@ -180,7 +181,8 @@ func TestKojiImport(t *testing.T) {
|
|||
RPMs: []rpmmd.RPM{},
|
||||
Extra: koji.BuildOutputExtra{
|
||||
Image: koji.ImageExtraInfo{
|
||||
Arch: "noarch",
|
||||
Arch: "noarch",
|
||||
BootMode: distro.BOOT_LEGACY.String(),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/images/pkg/distro"
|
||||
"github.com/osbuild/images/pkg/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/upload/koji"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
@ -99,7 +100,8 @@ func main() {
|
|||
RPMs: []rpmmd.RPM{},
|
||||
Extra: koji.BuildOutputExtra{
|
||||
Image: koji.ImageExtraInfo{
|
||||
Arch: arch,
|
||||
Arch: arch,
|
||||
BootMode: distro.BOOT_NONE.String(), // TODO: put the correct boot mode here
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -184,7 +184,8 @@ func (impl *KojiFinalizeJobImpl) Run(job worker.Job) error {
|
|||
imageRPMs = rpmmd.DeduplicateRPMs(imageRPMs)
|
||||
|
||||
imgOutputExtraInfo := koji.ImageExtraInfo{
|
||||
Arch: buildArgs.Arch,
|
||||
Arch: buildArgs.Arch,
|
||||
BootMode: buildArgs.ImageBootMode,
|
||||
}
|
||||
imgOutputsExtraInfo[args.KojiFilenames[i]] = imgOutputExtraInfo
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,12 @@ type BuildRoot struct {
|
|||
// ImageExtraInfo holds extra metadata about the image.
|
||||
// This structure is shared for the Extra metadata of the output and the build.
|
||||
type ImageExtraInfo struct {
|
||||
// TODO: Ideally this is where the pipeline would be passed.
|
||||
Arch string `json:"arch"` // TODO: why?
|
||||
// Koji docs say: "should contain IDs that allow tracking the output back to the system in which it was generated"
|
||||
// TODO: we should probably add some ID here, probably the OSBuildJob UUID?
|
||||
|
||||
Arch string `json:"arch"`
|
||||
// Boot mode of the image
|
||||
BootMode string `json:"boot_mode,omitempty"`
|
||||
}
|
||||
|
||||
// BuildOutputExtra holds extra metadata associated with the build output.
|
||||
|
|
|
|||
|
|
@ -163,6 +163,19 @@ function verify_buildinfo() {
|
|||
echo "Unexpected arch for '${image}'. Expected '${ARCH}', but got '${image_arch}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local image_boot_mode
|
||||
image_boot_mode="$(echo "${image_metadata}" | jq -r '.boot_mode')"
|
||||
# for now, check just that the boot mode is a valid value
|
||||
case "${image_boot_mode}" in
|
||||
"uefi"|"legacy"|"hybrid")
|
||||
;;
|
||||
"none"|*)
|
||||
# for now, we don't upload any images that have 'none' as boot mode, although it is a valid value
|
||||
echo "Unexpected boot mode for '${image}'. Expected 'uefi', 'legacy' or 'hybrid', but got '${image_boot_mode}'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue