@ -30,7 +30,7 @@ type OCIGetter struct {
opts options
opts options
}
}
// Get performs a Get from repo.Getter and returns the body.
// Get performs a Get from repo.Getter and returns the body.
func ( g * OCIGetter ) Get ( href string , options ... Option ) ( * bytes . Buffer , error ) {
func ( g * OCIGetter ) Get ( href string , options ... Option ) ( * bytes . Buffer , error ) {
for _ , opt := range options {
for _ , opt := range options {
opt ( & g . opts )
opt ( & g . opts )
@ -57,23 +57,22 @@ func (g *OCIGetter) get(href string) (*bytes.Buffer, error) {
if err != nil {
if err != nil {
return nil , err
return nil , err
}
}
if len ( tags ) == 0 {
return nil , errors . Errorf ( "Unable to locate any tags in provided repository: %s" , ref )
}
//Determine if version provided. If not
// Determine if version provided
// If empty, try to get the highest available tag
// If exact version, try to find it
// If semver constraint string, try to find a match
providedVersion := g . opts . version
providedVersion := g . opts . version
if g . opts . version == "" {
if len ( tags ) > 0 {
tag , err := registry . GetTagMatchingVersionOrConstraint ( tags , providedVersion )
providedVersion = tags [ 0 ]
if err != nil {
} else {
return nil , err
return nil , errors . Errorf ( "Unable to locate any tags in provided repository: %s" , ref )
}
} else {
if ! registry . ContainsTag ( tags , providedVersion ) {
return nil , errors . Errorf ( "Could not located provided version %s in repository %s" , providedVersion , ref )
}
}
}
ref = fmt . Sprintf ( "%s:%s" , ref , providedVersion )
ref = fmt . Sprintf ( "%s:%s" , ref , tag )
result , err := client . Pull ( ref , pullOpts ... )
result , err := client . Pull ( ref , pullOpts ... )
if err != nil {
if err != nil {