Skip to content

Commit

Permalink
Merge pull request #1011 from jonjohnsonjr/annotations
Browse files Browse the repository at this point in the history
bundle: Add --annotation flag
  • Loading branch information
jonjohnsonjr authored Jun 28, 2024
2 parents 93be67c + 8107b10 commit 60501c5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/cli/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func cmdBundle() *cobra.Command {
cmd.Flags().StringVar(&cfg.DestinationRepo, "destination-repository", "", "repo where packages will eventually be uploaded, used to skip existing packages (currently only supports http)")
cmd.Flags().StringVar(&bcfg.baseRef, "bundle-base", "", "base image used for melange build bundles")
cmd.Flags().StringVar(&bcfg.repo, "bundle-repo", "", "where to push the bundles")
cmd.Flags().StringToStringVarP(&bcfg.annotations, "annotation", "a", nil, "New annotations to add")

return cmd
}
Expand All @@ -116,6 +117,7 @@ type bundleConfig struct {
repo string
commonFiles fs.FS
pusher *remote.Pusher
annotations map[string]string

dirfs fs.FS
}
Expand Down Expand Up @@ -388,6 +390,11 @@ func bundleAll(ctx context.Context, cfg *Global, bcfg *bundleConfig, args []stri
}

idx := mutate.AppendManifests(empty.Index, addendums...)

if len(bcfg.annotations) != 0 {
idx = mutate.Annotations(idx, bcfg.annotations).(v1.ImageIndex) //nolint:errcheck
}

dst, err := name.ParseReference(fmt.Sprintf("%s/%s", bcfg.repo, "bundle"), name.Insecure)
if err != nil {
return err
Expand Down

0 comments on commit 60501c5

Please sign in to comment.