func put()

in container_images/registry-image-forked/commands/out.go [193:227]


func put(req resource.OutRequest, img v1.Image, tags []name.Tag) error {
	images := map[name.Reference]remote.Taggable{}
	var identifiers []string
	for _, tag := range tags {
		images[tag] = img
		identifiers = append(identifiers, tag.Identifier())
	}

	repo, err := req.Source.NewRepository()
	if err != nil {
		return fmt.Errorf("resolve repository name: %w", err)
	}

	opts, err := req.Source.AuthOptions(repo, []string{transport.PushScope})
	if err != nil {
		return err
	}

	logrus.Infof("pushing tag(s) %s", strings.Join(identifiers, ", "))
	err = remote.MultiWrite(images, opts...)
	if err != nil {
		return fmt.Errorf("pushing tag(s): %w", err)
	}

	logrus.Info("pushed")

	if req.Source.ContentTrust != nil {
		err = signImages(req, img, tags)
		if err != nil {
			return fmt.Errorf("signing image(s): %w", err)
		}
	}

	return nil
}