Add a new generic container registry client via a new `container` package. Use this to create a command line utility as well as a new upload target for container registries. The code uses the github.com/containers/* project and packages to interact with container registires that is also used by skopeo, podman et al. One if the dependencies is `proglottis/gpgme` that is using cgo to bind libgpgme, so we have to add the corresponding devel package to the BuildRequires as well as installing it on CI. Checks will follow later via an integration test.
23 lines
896 B
Go
23 lines
896 B
Go
package docker
|
|
|
|
import (
|
|
"github.com/containers/image/v5/docker/reference"
|
|
"github.com/containers/image/v5/types"
|
|
)
|
|
|
|
// bicTransportScope returns a BICTransportScope appropriate for ref.
|
|
func bicTransportScope(ref dockerReference) types.BICTransportScope {
|
|
// Blobs can be reused across the whole registry.
|
|
return types.BICTransportScope{Opaque: reference.Domain(ref.ref)}
|
|
}
|
|
|
|
// newBICLocationReference returns a BICLocationReference appropriate for ref.
|
|
func newBICLocationReference(ref dockerReference) types.BICLocationReference {
|
|
// Blobs are scoped to repositories (the tag/digest are not necessary to reuse a blob).
|
|
return types.BICLocationReference{Opaque: ref.ref.Name()}
|
|
}
|
|
|
|
// parseBICLocationReference returns a repository for encoded lr.
|
|
func parseBICLocationReference(lr types.BICLocationReference) (reference.Named, error) {
|
|
return reference.ParseNormalizedNamed(lr.Opaque)
|
|
}
|