pull/30966/merge
Victor Ubahakwe 2 weeks ago committed by GitHub
commit b0bd409f90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -61,6 +61,7 @@ type Show struct {
Devel bool
OutputFormat ShowOutputFormat
JSONPathTemplate string
ShowOCI bool // Controls whether to display OCI annotations
chart *chart.Chart // for testing
}
@ -68,6 +69,7 @@ type Show struct {
func NewShow(output ShowOutputFormat, cfg *Configuration) *Show {
sh := &Show{
OutputFormat: output,
ShowOCI: false, // Default to not showing OCI annotations
}
sh.registryClient = cfg.RegistryClient
@ -96,6 +98,22 @@ func (s *Show) Run(chartpath string) (string, error) {
var out strings.Builder
if s.OutputFormat == ShowChart || s.OutputFormat == ShowAll {
fmt.Fprintf(&out, "%s\n", cf)
// Display OCI annotations only if enabled
// Example output when enabled:
// ---
// OCI Annotations:
// org.opencontainers.image.created: 2023-01-01T00:00:00Z
// org.opencontainers.image.description: Sample chart
if s.ShowOCI && s.chart.Metadata != nil && len(s.chart.Metadata.Annotations) > 0 {
fmt.Fprintln(&out, "---")
fmt.Fprintln(&out, "OCI Annotations:")
for k, v := range s.chart.Metadata.Annotations {
if strings.HasPrefix(k, "org.opencontainers.image.") {
fmt.Fprintf(&out, " %s: %s\n", k, v)
}
}
}
}
if (s.OutputFormat == ShowValues || s.OutputFormat == ShowAll) && s.chart.Values != nil {

Loading…
Cancel
Save