Skip to content

Commit

Permalink
cloudapi: set the default ostree ref for package selection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achilleas-k authored and supakeen committed May 31, 2023
1 parent c6acf1e commit 1723e58
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/cloudapi/v2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1723e58

Please sign in to comment.