2019-01-12 04:58:27 +00:00
|
|
|
/*
|
|
|
|
Copyright 2017 The Kubernetes Authors.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/docker/distribution/reference"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NormalizeImageRef normalizes the image reference following the docker convention. This is added
|
|
|
|
// mainly for backward compatibility.
|
|
|
|
// The reference returned can only be either tagged or digested. For reference contains both tag
|
|
|
|
// and digest, the function returns digested reference, e.g. docker.io/library/busybox:latest@
|
|
|
|
// sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa will be returned as
|
|
|
|
// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa.
|
2019-09-27 21:51:53 +00:00
|
|
|
//
|
|
|
|
// Deprecated: use github.com/docker/reference.ParseDockerRef() instead
|
2019-01-12 04:58:27 +00:00
|
|
|
func NormalizeImageRef(ref string) (reference.Named, error) {
|
2019-09-27 21:51:53 +00:00
|
|
|
return reference.ParseDockerRef(ref)
|
2019-01-12 04:58:27 +00:00
|
|
|
}
|