mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-10 07:50:08 -04:00
cli: image info (v2)
This commit is contained in:
parent
cd7b116794
commit
d0e53cbb59
37 changed files with 429 additions and 461 deletions
|
@ -61,8 +61,8 @@ func New(ctx context.Context, project, location, bucketName string, log *logger.
|
|||
}
|
||||
|
||||
// Upload uploads an OS image to GCP.
|
||||
func (u *Uploader) Upload(ctx context.Context, req *osimage.UploadRequest) (map[string]string, error) {
|
||||
imageName := u.imageName(req.Version, req.Variant)
|
||||
func (u *Uploader) Upload(ctx context.Context, req *osimage.UploadRequest) ([]versionsapi.ImageInfoEntry, error) {
|
||||
imageName := u.imageName(req.Version, req.AttestationVariant)
|
||||
blobName := imageName + ".tar.gz"
|
||||
if err := u.ensureBucket(ctx); err != nil {
|
||||
return nil, fmt.Errorf("setup: ensuring bucket exists: %w", err)
|
||||
|
@ -86,8 +86,12 @@ func (u *Uploader) Upload(ctx context.Context, req *osimage.UploadRequest) (map[
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("creating image: %w", err)
|
||||
}
|
||||
return map[string]string{
|
||||
req.Variant: imageRef,
|
||||
return []versionsapi.ImageInfoEntry{
|
||||
{
|
||||
CSP: "gcp",
|
||||
AttestationVariant: req.AttestationVariant,
|
||||
Reference: imageRef,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -220,8 +224,8 @@ func (u *Uploader) blobURL(blobName string) string {
|
|||
}).String()
|
||||
}
|
||||
|
||||
func (u *Uploader) imageName(version versionsapi.Version, variant string) string {
|
||||
return strings.ReplaceAll(version.Version, ".", "-") + "-" + variant + "-" + version.Stream
|
||||
func (u *Uploader) imageName(version versionsapi.Version, attestationVariant string) string {
|
||||
return strings.ReplaceAll(version.Version, ".", "-") + "-" + attestationVariant + "-" + version.Stream
|
||||
}
|
||||
|
||||
func (u *Uploader) imageFamily(version versionsapi.Version) string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue