Commit Graph

5 Commits

Author SHA1 Message Date
Miloslav Trmač aaadde2550 Move tagOrDigest to dockerReference
This improves the dockerReference encapsulation, and makes it more clear
that the reference.IsNameOnly case can not happen.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-07-18 21:20:00 +02:00
Miloslav Trmač 55bcc37672 Add policy configuration scope validation
This e.g. rejects relative paths for directories.

Notably docker: transport is the only one which does not do any real
validation; we could copy&paste the character ranges and lengths
directly from docker/distribution/reference, which feels fairly ugly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-07-18 21:07:28 +02:00
Miloslav Trmač be1e012a0f Add types.ImageReference.PolicyConfiguration{Identity,Namespaces}
This makes the core policy lookup logic Docker-independent,
with the underlying Docker-specific implementation moved to
docker/policyconfiguration/naming.go.

Does not change behavior, only docker: and atomic: transports
currently implement the policy configuration naming, in a compatible
way, and the policy configuration is still not transport-aware.  That
happens next.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-07-18 20:50:11 +02:00
Miloslav Trmač 59edf8316f Add types.ImageReference.DockerReference()
This will consolidate Docker reference usage to all go through
types.ImageReference.

No users yet, will be migrated imminently.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-07-16 05:08:38 +02:00
Miloslav Trmač 0a1111ca30 Add types.ImageTransport and types.ImageReference
This minimizes transport-specific knowledge in image name parsing
(as in cmd/skopeo/utils.go) and allows separation of reference parsing
and their use.

Existing public NewImage... API has been removed; callers are expected
to use any of
* types.ImageTransport.ParseReference().NewImage...
  (if they have a general string)
* transportpackage.ParseReference().NewImage...
  (if they have a transport-specific string)
* transportpackage.NewReference().NewImage...
  (if they have transport-specific raw values)

This usually adds an extra error checking step for the
ParseReference/NewReference call compared to the previous code; this is
considered not a big loss, especially because reporting “the reference
is invalid” and “the reference looks valid but connecting/using it
failed” as distinct failure modes seems quite useful for users.

The references are currently one-way (you can get a types.Image* from an
ImageReference, but not the other way around); that will be fixed soon.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-07-16 05:08:38 +02:00