From f5e1aa311ec2c389fe92108fd206b4d4b5b5438f Mon Sep 17 00:00:00 2001 From: Jonathan Fuerth Date: Fri, 4 Jul 2025 16:43:17 -0400 Subject: [PATCH] [CU-86b5k3mgh] Relay helm manifest metadata to Concourse This will surface both the standard annotations like version and build date in the Concourse UI, and it also unlocks the possibility for us to include our own annotations about the provenance of the changes in each chart version, which will also appear in Concourse. --- pkg/resource/in.go | 21 +++++++++++++++++---- pkg/resource/types.go | 5 +++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/pkg/resource/in.go b/pkg/resource/in.go index 5d773dc..a0261f5 100644 --- a/pkg/resource/in.go +++ b/pkg/resource/in.go @@ -29,8 +29,9 @@ type ( } GetResponse struct { - Tag string `json:"tag"` - Digest string `json:"digest"` + Tag string `json:"tag"` + Digest string `json:"digest"` + Metadata []MetadataItem `json:"metadata,omitempty"` } ) @@ -63,6 +64,17 @@ func Get(ctx context.Context, request GetRequest, outputDir string) (*GetRespons return nil, err } + // Extract metadata from all manifest annotations + var metadata []MetadataItem + if manifestDescriptor.Annotations != nil { + for key, value := range manifestDescriptor.Annotations { + metadata = append(metadata, MetadataItem{ + Name: key, + Value: value, + }) + } + } + // Find different layers. for _, layer := range manifestDescriptor.Layers { var fileExtension string @@ -82,8 +94,9 @@ func Get(ctx context.Context, request GetRequest, outputDir string) (*GetRespons } return &GetResponse{ - Tag: request.Version.Tag, - Digest: desc.Digest.String(), + Tag: request.Version.Tag, + Digest: desc.Digest.String(), + Metadata: metadata, }, nil } diff --git a/pkg/resource/types.go b/pkg/resource/types.go index 538bc22..2345def 100644 --- a/pkg/resource/types.go +++ b/pkg/resource/types.go @@ -38,3 +38,8 @@ type Version struct { Tag string `json:"tag"` Digest string `json:"digest"` } + +type MetadataItem struct { + Name string `json:"name"` + Value string `json:"value"` +}