From 1723e588ceaf2d1f3f74f5aece29b4241b1a24af Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Wed, 31 May 2023 00:42:56 +0200 Subject: [PATCH] cloudapi: set the default ostree ref for package selection Before, this was done in the PackageSets() function. The reason for this is that having an ostree ref affects package selection (for example, it adds rpm-ostree). At the package selection phase, it doesn't matter what the ostree ref is; it is just used to determine if a pipeline is for an ostree-based image type and it doesn't affect non-ostree-based image types because the image functions ignore it. This is only needed in the cloudapi now because other places have switched to using the new order of operations, where the manifest is generated after the ostree commit is resolved, so it's always added when needed. --- internal/cloudapi/v2/server.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/internal/cloudapi/v2/server.go b/internal/cloudapi/v2/server.go index a81119825..a7af57efa 100644 --- a/internal/cloudapi/v2/server.go +++ b/internal/cloudapi/v2/server.go @@ -107,6 +107,14 @@ func (s *Server) enqueueCompose(distribution distro.Distro, bp blueprint.Bluepri } ir := irs[0] + // NOTE(akoutsou): Image options don't have resolved ostree ref yet, but it + // will affect package sets if we don't add it and it's required. This + // used to be done in the old PackageSets() function (which no longer + // exists), but now we only need it in the cloud API where things aren't + // done in the (new) correct order yet. + ir.imageOptions.OSTree = &ostree.ImageOptions{ + ImageRef: ir.imageType.OSTreeRef(), + } manifestSource, _, err := ir.imageType.Manifest(&bp, ir.imageOptions, ir.repositories, manifestSeed) if err != nil { return id, HTTPErrorWithInternal(ErrorEnqueueingJob, err) @@ -210,6 +218,14 @@ func (s *Server) enqueueKojiCompose(taskID uint64, server, name, version, releas var kojiFilenames []string var buildIDs []uuid.UUID for _, ir := range irs { + // NOTE(akoutsou): Image options don't have resolved ostree ref yet, but it + // will affect package sets if we don't add it and it's required. This + // used to be done in the old PackageSets() function (which no longer + // exists), but now we only need it in the cloud API where things aren't + // done in the (new) correct order yet. + ir.imageOptions.OSTree = &ostree.ImageOptions{ + ImageRef: ir.imageType.OSTreeRef(), + } manifestSource, _, err := ir.imageType.Manifest(&bp, ir.imageOptions, ir.repositories, manifestSeed) if err != nil { return id, HTTPErrorWithInternal(ErrorEnqueueingJob, err)