github.com/jcarley/cli@v0.0.0-20180201210820-966d90434c30/commands/images/pull.go (about)

     1  package images
     2  
     3  import (
     4  	"github.com/Sirupsen/logrus"
     5  	"github.com/daticahealth/cli/commands/environments"
     6  	"github.com/daticahealth/cli/lib/images"
     7  	"github.com/daticahealth/cli/models"
     8  )
     9  
    10  func cmdImagePull(envID, name string, user *models.User, ie environments.IEnvironments, ii images.IImages) error {
    11  	env, err := ie.Retrieve(envID)
    12  	if err != nil {
    13  		return err
    14  	}
    15  	repositoryName, tag, err := ii.GetGloballyUniqueNamespace(name, env, true)
    16  	if err != nil {
    17  		return err
    18  	}
    19  	if tag == "" {
    20  		logrus.Printf("No tag specified. Using default tag '%s'\n", images.DefaultTag)
    21  		tag = images.DefaultTag
    22  	}
    23  	logrus.Println("Verifying image has been signed...")
    24  	repo := ii.GetNotaryRepository(env.Pod, repositoryName, user)
    25  	target, err := ii.LookupTarget(repo, tag)
    26  	if err != nil {
    27  		logrus.Warnf("Content verification failed: %s\n", err.Error())
    28  		return nil
    29  	}
    30  	return ii.Pull(repositoryName, target, user, env)
    31  }