cloudapi: add container specs to Serialize()
To add the container specs to Serialize(), we need to map them to the payload (OS) pipeline. We assume the first name in the image type's PayloadPipelines() list is the OS pipeline, which is true of all image types right now but might not be necessarily in the future. This is a temporary workaround. Eventually, the mapping will be set by the image type itself when we use the container source specs attached to the Manifest object.
This commit is contained in:
parent
df2c0c09bb
commit
e6dddabefe
1 changed files with 14 additions and 1 deletions
|
|
@ -478,7 +478,20 @@ func generateManifest(ctx context.Context, workers *worker.Server, depsolveJobID
|
|||
jobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorManifestGeneration, reason, nil)
|
||||
return
|
||||
}
|
||||
ms, err := manifest.Serialize(depsolveResults.PackageSpecs, nil)
|
||||
|
||||
// NOTE: This assumes that containers are only embedded in the first
|
||||
// payload pipeline, which is currently true for all image types but might
|
||||
// not necessarily be in the future. This is a workaround required for this
|
||||
// temporary state where the cloud API is not using the new manifest
|
||||
// generation procedure. Once it's updated, the container specs will be
|
||||
// mapped to pipeline names properly by the image type itself.
|
||||
var payloadPipelineName string
|
||||
if pipelineNames := imageType.PayloadPipelines(); len(pipelineNames) > 0 {
|
||||
payloadPipelineName = pipelineNames[0]
|
||||
} else {
|
||||
panic(fmt.Sprintf("ImageType %q does not define payload pipelines - this is a programming error", imageType.Name()))
|
||||
}
|
||||
ms, err := manifest.Serialize(depsolveResults.PackageSpecs, map[string][]container.Spec{payloadPipelineName: containerSpecs})
|
||||
|
||||
jobResult.Manifest = ms
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue