make sure all different ref formats are supported

This commit is contained in:
Simon Aronsson 2020-12-21 18:06:14 +01:00
parent ff8cb884a0
commit eb8580f7f2
No known key found for this signature in database
GPG key ID: 8DA57A5FD341605B
4 changed files with 55 additions and 7 deletions

View file

@ -2,6 +2,7 @@ package manifest
import (
"fmt"
"github.com/containrrr/watchtower/pkg/registry/auth"
"github.com/containrrr/watchtower/pkg/registry/helpers"
"github.com/containrrr/watchtower/pkg/types"
ref "github.com/docker/distribution/reference"
@ -31,7 +32,8 @@ func BuildManifestURL(container types.Container) (string, error) {
if err != nil {
return "", err
}
img = strings.TrimPrefix(img, fmt.Sprintf("%s/", host))
img = auth.GetScopeFromImageName(img, host)
if !strings.Contains(img, "/") {
img = "library/" + img
}