Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on the old code in the graph package, with major changes to work with the new image/layer model. Add v1 migration code. Update registry, api/*, and daemon packages to use the reference package's types where applicable. Update daemon package to use image/layer/tag stores instead of the graph package Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com> Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Upstream-commit: 4352da7803d182a6013a5238ce20a7c749db979a Component: engine
This commit is contained in:
committed by
Aaron Lehmann
parent
1f0b9bebab
commit
e105a29374
@ -269,23 +269,6 @@ func ReadDockerIgnore(reader io.ReadCloser) ([]string, error) {
|
||||
return excludes, nil
|
||||
}
|
||||
|
||||
// ImageReference combines `repo` and `ref` and returns a string representing
|
||||
// the combination. If `ref` is a digest (meaning it's of the form
|
||||
// <algorithm>:<digest>, the returned string is <repo>@<ref>. Otherwise,
|
||||
// ref is assumed to be a tag, and the returned string is <repo>:<tag>.
|
||||
func ImageReference(repo, ref string) string {
|
||||
if DigestReference(ref) {
|
||||
return repo + "@" + ref
|
||||
}
|
||||
return repo + ":" + ref
|
||||
}
|
||||
|
||||
// DigestReference returns true if ref is a digest reference; i.e. if it
|
||||
// is of the form <algorithm>:<digest>.
|
||||
func DigestReference(ref string) bool {
|
||||
return strings.Contains(ref, ":")
|
||||
}
|
||||
|
||||
// GetErrorMessage returns the human readable message associated with
|
||||
// the passed-in error. In some cases the default Error() func returns
|
||||
// something that is less than useful so based on its types this func
|
||||
|
||||
@ -26,36 +26,6 @@ func TestReplaceAndAppendEnvVars(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageReference(t *testing.T) {
|
||||
tests := []struct {
|
||||
repo string
|
||||
ref string
|
||||
expected string
|
||||
}{
|
||||
{"repo", "tag", "repo:tag"},
|
||||
{"repo", "sha256:c100b11b25d0cacd52c14e0e7bf525e1a4c0e6aec8827ae007055545909d1a64", "repo@sha256:c100b11b25d0cacd52c14e0e7bf525e1a4c0e6aec8827ae007055545909d1a64"},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
actual := ImageReference(test.repo, test.ref)
|
||||
if test.expected != actual {
|
||||
t.Errorf("%d: expected %q, got %q", i, test.expected, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDigestReference(t *testing.T) {
|
||||
input := "sha256:c100b11b25d0cacd52c14e0e7bf525e1a4c0e6aec8827ae007055545909d1a64"
|
||||
if !DigestReference(input) {
|
||||
t.Errorf("Expected DigestReference=true for input %q", input)
|
||||
}
|
||||
|
||||
input = "latest"
|
||||
if DigestReference(input) {
|
||||
t.Errorf("Unexpected DigestReference=true for input %q", input)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadDockerIgnore(t *testing.T) {
|
||||
tmpDir, err := ioutil.TempDir("", "dockerignore-test")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user