container: add ListDigest to the spec

Add the ListDigest to the container Spec struct and all its copies so we
can store list digests when they are available and pass them on to the
appropriate osbuild stages, sources, and inputs.

Copy the value whenever a spec is moved to a different representation.
This commit is contained in:
Achilleas Koutsou 2023-03-17 15:19:41 +01:00
parent c95072d686
commit a7dd8ff94f
5 changed files with 17 additions and 12 deletions

View file

@ -42,11 +42,12 @@ func (impl *ContainerResolveJobImpl) Run(job worker.Job) error {
} else { } else {
for i, spec := range specs { for i, spec := range specs {
result.Specs[i] = worker.ContainerSpec{ result.Specs[i] = worker.ContainerSpec{
Source: spec.Source, Source: spec.Source,
Name: spec.LocalName, Name: spec.LocalName,
TLSVerify: spec.TLSVerify, TLSVerify: spec.TLSVerify,
ImageID: spec.ImageID, ImageID: spec.ImageID,
Digest: spec.Digest, Digest: spec.Digest,
ListDigest: spec.ListDigest,
} }
} }
} }

View file

@ -434,6 +434,7 @@ func generateManifest(ctx context.Context, workers *worker.Server, depsolveJobID
containerSpecs[i].LocalName = s.Name containerSpecs[i].LocalName = s.Name
containerSpecs[i].TLSVerify = s.TLSVerify containerSpecs[i].TLSVerify = s.TLSVerify
containerSpecs[i].ImageID = s.ImageID containerSpecs[i].ImageID = s.ImageID
containerSpecs[i].ListDigest = s.ListDigest
} }
} }

View file

@ -11,11 +11,12 @@ import (
// at the Source via Digest and ImageID. The latter one // at the Source via Digest and ImageID. The latter one
// should remain the same in the target image as well. // should remain the same in the target image as well.
type Spec struct { type Spec struct {
Source string // does not include the manifest digest Source string // does not include the manifest digest
Digest string // digest of the manifest at the Source Digest string // digest of the manifest at the Source
TLSVerify *bool // controls TLS verification TLSVerify *bool // controls TLS verification
ImageID string // container image identifier ImageID string // container image identifier
LocalName string // name to use inside the image LocalName string // name to use inside the image
ListDigest string // digest of the list manifest at the Source (optional)
} }
// NewSpec creates a new Spec from the essential information. // NewSpec creates a new Spec from the essential information.

View file

@ -2306,6 +2306,7 @@ func (api *API) resolveContainersForImageType(bp blueprint.Blueprint, imageType
specs[i].LocalName = s.Name specs[i].LocalName = s.Name
specs[i].TLSVerify = s.TLSVerify specs[i].TLSVerify = s.TLSVerify
specs[i].ImageID = s.ImageID specs[i].ImageID = s.ImageID
specs[i].ListDigest = s.ListDigest
} }
return specs, nil return specs, nil

View file

@ -253,8 +253,9 @@ type ContainerSpec struct {
Name string `json:"name"` Name string `json:"name"`
TLSVerify *bool `json:"tls-verify,omitempty"` TLSVerify *bool `json:"tls-verify,omitempty"`
ImageID string `json:"image_id"` ImageID string `json:"image_id"`
Digest string `json:"digest"` Digest string `json:"digest"`
ListDigest string `json:"list-digest,omitempty"`
} }
type ContainerResolveJob struct { type ContainerResolveJob struct {