summaryrefslogtreecommitdiff
path: root/reference
Commit message (Collapse)AuthorAgeFilesLines
* reference: add test-coverage for digested referencesSebastiaan van Stijn2023-03-061-0/+4
| | | | | | | Trying to overwrite a digest with another digest is not allowed, and cannot be forced. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* reference: don't string-match errors in tests, and fix error formatSebastiaan van Stijn2023-03-062-8/+7
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* reference: use t.TempDir() for testsSebastiaan van Stijn2023-03-061-34/+12
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* reference: rename variables that collided with type / importSebastiaan van Stijn2023-03-061-28/+28
| | | | | | | | These variables collided with the "repository" and "store" types declared in this package. Rename the variables colliding with "repository", and rename the "store" type to "refStore". Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* remove unneeded "digest" alias for "go-digest"Sebastiaan van Stijn2022-03-042-2/+2
| | | | | | | | I think this was there for historic reasons (may have been goimports expected this, and we used to have a linter that wanted it), but it's not needed, so let's remove it (to make my IDE less complaining about unneeded aliases). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* refactor: move from io/ioutil to io and os packageEng Zer Jun2021-08-271-6/+5
| | | | | | | | The io/ioutil package has been deprecated in Go 1.16. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* fix goimportsAkihiro Suda2020-02-111-5/+5
| | | | Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
* bump gotest.tools v3.0.1 for compatibility with Go 1.14Sebastiaan van Stijn2020-02-111-7/+7
| | | | | | full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Remove unused functions, variables, fieldsSebastiaan van Stijn2019-09-181-2/+3
| | | | | | | | | | | | | opts/env_test: suppress a linter warning this one: > opts/env_test.go:95:4: U1000: field `err` is unused (unused) > err error > ^ Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* goimports: fix importsSebastiaan van Stijn2019-09-182-2/+2
| | | | | | | Format the source according to latest goimports. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #37781 from mtrmac/reference-race-upstreamYong Tang2018-10-182-0/+13
|\ | | | | Don't fail on two concurrent reference.store.AddDigest calls
| * Don't fail on two concurrent reference.store.AddDigest callsMiloslav Trmač2018-09-072-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reference.store.addReference fails when adding a digest reference that already exists (regardless of the reference target). Both callers (via reference.store.AddDigest) do check in advance, using reference.store.Get, whether the digest reference exists before calling AddDigest, but the reference store lock is released between the two calls, so if another thread sets the reference in the meantime, AddDigest may fail with > Cannot overwrite digest ... . Handle this by checking that the pre-existing reference points at the same image, i.e. that there is nothing to do, and succeeding immediately in that case. This is even cheaper, avoids a reference.store.save() call. (In principle, the same failure could have happened via reference.store.AddTag, as > Conflict: Tag %s is already set to image %s, if you want to replace it, please use -f option but almost all callers (except for migrate/v1.Migrate, which is run single-threaded anyway) set the "force" parameter of AddTag to true, which makes the race invisible. This commit does not change the behavior of that case, except for speeding it up by avoiding the reference.store.save() call.) The existing reference.store.Get checks are now, in a sense, redundant as such, but their existence allows the callers to provide nice context-dependent error messages, so this commit leaves them unchanged. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* | Format code with gofmt -s from go-1.11beta1Kir Kolyshkin2018-09-061-5/+5
|/ | | | | | | | | | | | | | This should eliminate a bunch of new (go-1.11 related) validation errors telling that the code is not formatted with `gofmt -s`. No functional change, just whitespace (i.e. `git show --ignore-space-change` shows nothing). Patch generated with: > git ls-files | grep -v ^vendor/ | grep .go$ | xargs gofmt -s -w Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
* Update tests to use gotest.tools 👼Vincent Demeester2018-06-131-2/+2
| | | | Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* Various code-cleanupSebastiaan van Stijn2018-05-231-1/+1
| | | | | | remove unnescessary import aliases, brackets, and so on. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Automated migration usingDaniel Nephin2018-03-161-10/+10
| | | | | | gty-migrate-from-testify --ignore-build-tags Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Add canonical import commentDaniel Nephin2018-02-053-3/+3
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Add gosimple linterDaniel Nephin2017-09-121-3/+3
| | | | | | Update gometalinter Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Add ineffassign linterDaniel Nephin2017-09-081-20/+13
| | | | | | Also enable GC in linting to reduce memory usage. Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Move to a single tag-storeJohn Howard2017-08-182-11/+6
| | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* Remove string checking in API error handlingBrian Goff2017-08-152-6/+35
| | | | | | | | | | | | | | Use strongly typed errors to set HTTP status codes. Error interfaces are defined in the api/errors package and errors returned from controllers are checked against these interfaces. Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the line of causes one of the interfaces is implemented. The special error interfaces take precedence over Causer, meaning if both Causer and one of the new error interfaces are implemented, the Causer is not traversed. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Spelling fixesJosh Soref2017-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * additional * ambiguous * anonymous * anything * application * because * before * building * capabilities * circumstances * commit * committer * compresses * concatenated * config * container * container's * current * definition * delimiter * disassociates * discovery * distributed * doesnotexist * downloads * duplicates * either * enhancing * enumerate * escapable * exactly * expect * expectations * expected * explicitly * false * filesystem * following * forbidden * git with * healthcheck * ignore * independent * inheritance * investigating * irrelevant * it * logging * looking * membership * mimic * minimum * modify * mountpoint * multiline * notifier * outputting * outside * overridden * override * parsable * plugins * precedence * propagation * provided * provides * registries * repositories * returning * settings * should * signals * someone * something * specifically * successfully * synchronize * they've * thinking * uninitialized * unintentionally * unmarshaling * unnamed * unreferenced * verify Signed-off-by: Josh Soref <jsoref@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* LCOW: Move daemon stores to per platformJohn Howard2017-06-202-5/+10
| | | | Signed-off-by: John Howard <jhoward@microsoft.com>
* reference: handle combination of tag and digest in ImageDeleteVincent Demeester2017-02-161-4/+18
| | | | | | | | | If you remove an image with digest+tag, it will fail because it wont find it in the reference store (where digest+tag -> digest). Let's make sure we do the same in ImageDelete, stripping the tag if digest+tag are present. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
* reference: Handle combination of tag and digest in AddReferenceAaron Lehmann2017-02-091-0/+14
| | | | | | | | | | | | | | | | | | | With the switchover to the unified reference package, AddReference no longer does the right thing when passed a reference that has both a digest and a tag. It would put both the digest in the tag in the reference stored in the repositories.json file, which isn't the right format, and would mean that neither "docker run" nor docker services could locate the image. This meant that a simple "docker service create" command like "docker service create --name foo busybox top" would create a service that immediately went into a restart loop, because it couldn't use the image that had been pulled. Fix AddReference to strip out the tag when both a tag and digest are specified. We do this because we don't necessarily want to overwrite the tag - when both a digest and tag are specified, the tag is only advisory. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
* Use distribution referenceDerek McGowan2017-02-074-530/+87
| | | | | | | | | | | | Remove forked reference package. Use normalized named values everywhere and familiar functions to convert back to familiar strings for UX and storage compatibility. Enforce that the source repository in the distribution metadata is always a normalized string, ignore invalid values which are not. Update distribution tests to use normalized values. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* Remove use of forked reference package for cliDerek McGowan2017-01-191-55/+33
| | | | | | | Use resolving to repo info as the split point between the legitimate reference package and forked reference package. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* *: use opencontainers/go-digest packageStephen J Day2017-01-064-5/+5
| | | | | | | | The `digest` data type, used throughout docker for image verification and identity, has been broken out into `opencontainers/go-digest`. This PR updates the dependencies and moves uses over to the new type. Signed-off-by: Stephen J Day <stephen.day@docker.com>
* Move imageID validation to stringid pkgTonis Tiigi2016-12-261-3/+3
| | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* checkt t.Fatalf information for reference pathlixiaobing100512672016-11-302-2/+2
| | | | Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
* Update for distribution vendorDerek McGowan2016-11-101-0/+5
| | | | | | | Handle updates to reference package. Updates for refactoring of challenge manager. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* Generalize content addressable and reference storageTonis Tiigi2016-09-152-31/+30
| | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* reference: Do not drop the underlying error messageAntonio Murdaca2016-07-011-1/+1
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* fix typosallencloud2016-06-022-2/+2
| | | | Signed-off-by: allencloud <allen.sun@daocloud.io>
* Safer file io for configuration filesTonis Tiigi2016-04-211-13/+2
| | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* Fix docker run for 64 byte hex IDTonis Tiigi2016-03-111-0/+13
| | | | | | | | Fixes #20972 Also makes sure there is no check to registry if no image is found for the prefixed IDs. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* Allow uppercase characters in image reference hostnameAaron Lehmann2016-02-101-5/+12
| | | | | | | | | | | | | | | | | | | | | This PR makes restores the pre-Docker 1.10 behavior of allowing uppercase characters in registry hostnames. Note that this only applies to hostnames, not remote image names. Previous versions also prohibited uppercase letters after the hostname, but Docker 1.10 extended this to the hostname itself. - Vendor updated docker/distribution. - Add a check to "normalize" that rejects remote names with uppercase letters. - Add test cases to TestTagValidPrefixedRepo and TestTagInvalidUnprefixedRepo Fixes: #20056 Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
* Clean up reference type switchesTonis Tiigi2015-12-162-16/+22
| | | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* Improve reference parse errorsTonis Tiigi2015-12-161-1/+1
| | | | | | Fixes #18093 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* Update Named reference with validation of conversionsTonis Tiigi2015-12-163-16/+400
| | | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* Add own reference package wrapperTonis Tiigi2015-12-163-0/+730
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>