Commit Graph

3075 Commits

Author SHA1 Message Date
Miloslav Trmač
0d95328125 Merge pull request #79 from mtrmac/image-from-imagesource
Make types.Image Docker-independent, add docker.GenericImageFromSource
2016-05-30 17:35:34 +02:00
Miloslav Trmač
41dbbc9b50 Support dir:… as an image specification in (skopeo {inspect,layers})
This is not expected to be that useful in production; for now it serves
as a demonstration of the concept, and it allows (skopeo inspect) to be
clumsily used as parser of stand-alone manifests (by creating a dir:
structure with that manifest).

(skopeo layers) support follows naturally, but is even less useful.
2016-05-28 02:11:32 +02:00
Miloslav Trmač
323b56a049 Make types.Image Docker-independent
The remaining uses of the dependencies, in (skopeo inspect), now check
whether their types.Image is a docker.Image and call the docker.Image
functions directly.

This does not change behavior for Docker images.

For non-Docker images (which can't happen yet), the Name field is
removed; RepoTags remain and are reported as empty, because using
json:",omitempty" would also omit an empty list for Docker images.
2016-05-28 02:11:32 +02:00
Miloslav Trmač
ea643e8658 Use types.ImageSource instead of *dockerImageSource in genericImage
This finally makes genericImage Docker-independent.

(dockerImage is still the only implementation of types.Image.)
2016-05-28 02:11:32 +02:00
Miloslav Trmač
cada464c90 Split dockerImage to genericImage and docker.Image
The code not dependent on specifics of DockerImageSource now lives in
docker.genericImage; the rest directly in docker.Image.

docker.Image remains the only implementation of types.Image at this
point, but that will change.
2016-05-28 02:09:22 +02:00
Miloslav Trmač
0da4307aea Split SourceRefFullName from types.Image.Inspect
This is the only Docker-specific aspect of types.Image.Inspect.

This does not change behavior; plausibly we might want to replace the
Name value in (skopeo inspect) by something else which is not dependent
on Docker, but that can be a separate work later.

Adds a FIXME? in docker_image.go for consistency with
dockerImage.GetRepositoryTags, both will be removed later in the
patchset.
2016-05-28 02:08:12 +02:00
Miloslav Trmač
143e3602ae Split Docker-independent parts of dockerImage into docker/image.go
This does not change the code at all, only moving things around now.
2016-05-28 02:04:48 +02:00
Miloslav Trmač
0314fdb49e Remove temporary variables in (skopeo inspect)
We abort on failure to get the data anyway, so there is no need to use
temporaries to avoid modifying outputData on failure.

This is not a simplification yet, but handling optional (e.g.
Docker-specific) data this way will be simpler, and handling
non-optional data the same way will be more consistent.
2016-05-28 02:04:48 +02:00
Antonio Murdaca
847b5bff85 Merge pull request #78 from runcom/bump-0113dev
bump to v0.1.13-dev
2016-05-27 12:42:29 +02:00
Antonio Murdaca
864568bbd9 bump to v0.1.13-dev
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-27 12:26:54 +02:00
Antonio Murdaca
015f1c8c9a Merge pull request #77 from runcom/bump-0112
bump to v0.1.12
2016-05-27 12:25:54 +02:00
Antonio Murdaca
46bb9a0698 bump to v0.1.12
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-27 12:16:25 +02:00
Antonio Murdaca
62af96c5c9 Merge pull request #74 from mtrmac/key-import
Add SigningMechanism.ImportKeysFromBytes
2016-05-25 16:35:42 +02:00
Miloslav Trmač
aee0abb5d2 Add SigningMechanism.ImportKeysFromBytes
This will be needed for verification against specified public keys.

Also rerun hack/vendor.sh to pick up import support from
github.com/mtrmac/gpgme .
2016-05-25 16:04:20 +02:00
Miloslav Trmač
721a628f4a Merge pull request #76 from mtrmac/policy-config
Update a comment for prInsecureAcceptAnything
2016-05-25 16:03:30 +02:00
Miloslav Trmač
10280f2e0d Update a comment for prInsecureAcceptAnything 2016-05-25 15:53:12 +02:00
Miloslav Trmač
9ccfc6a423 Merge pull request #55 from mtrmac/policy-config
Add policy configuration data structures, construction and parsing
2016-05-25 15:46:53 +02:00
Miloslav Trmač
d9b1c229e5 Add policy configuration data structures, construction and parsing 2016-05-24 20:24:15 +02:00
Miloslav Trmač
7a8602c54c Add paranoidUnmarshalJSONObject() helper
This allows unmarshaling JSON data and refusing any ambiguous input, to
make sure users don't make mistakes when writing policy.

This might be a bit easier with reflection, but we will need the
non-reflection variant (for unmarshaling a map type) anyway, and quite a
few users which do ultimately unmarshal into a struct need to override
the type of one or more fields, so reflection would force them to define
temporary fields - not necessarily all that better.
2016-05-24 18:16:33 +02:00
Antonio Murdaca
dbb47e6bb6 Merge pull request #72 from runcom/godoc
Godoc
2016-05-24 17:37:53 +02:00
Antonio Murdaca
67119f4875 add doc.go stub
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-24 17:29:12 +02:00
Miloslav Trmač
3d1201007e Merge pull request #73 from runcom/mimetypes-choose
add the possibility to choose image's MIME type
2016-05-24 17:10:07 +02:00
Antonio Murdaca
15f478e26b add the possibility to choose image's MIME type
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-24 16:52:39 +02:00
Miloslav Trmač
0abbb9a2ce Merge pull request #69 from runcom/re-mimetypes
add mimetypes
2016-05-23 21:00:28 +02:00
Antonio Murdaca
7d12b66fb8 add mimetypes
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-23 20:40:52 +02:00
Miloslav Trmač
814a2a6f94 Merge pull request #70 from projectatomic/cleanups
Cleanups
2016-05-23 19:29:06 +02:00
Antonio Murdaca
4036b3543e cleanup API
moving stuff around (godoc.org review)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-23 17:20:55 +02:00
Miloslav Trmač
1cf55db9be Merge pull request #61 from runcom/fix-godoc
signature: remove pkg fixtures
2016-05-23 16:40:12 +02:00
Antonio Murdaca
7c5db83261 Remove signature/fixtures subpackage
This will make the output of godoc cleaner, we can't filter out the
subpackage otherwise.

Also copy the needed fixture into the integration subpackage, instead of
referring to it using ../signature/fixtures (and we can't import
signature/fixtures_info-test.go now).

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-21 21:21:58 +02:00
Antonio Murdaca
7522e6c99c Merge pull request #68 from mtrmac/cleanups
Random cleanups
2016-05-21 10:51:42 +02:00
Miloslav Trmač
09f33a7c2c Remove a redundant check
reference.WithDefaultTag is already calling reference.IsNameOnly, so we
don't need to guard it on the outside.
2016-05-21 04:48:33 +02:00
Miloslav Trmač
521e3ce0eb Remove duplicated test 2016-05-21 04:46:57 +02:00
Miloslav Trmač
532fae24ac Merge pull request #65 from runcom/fix-headers
provide a way to pass multi values-single key headers
2016-05-19 18:43:25 +02:00
Antonio Murdaca
c661fad3eb provide a way to pass multi values-signle key headers
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-18 17:02:53 +02:00
Miloslav Trmač
09f82a5ad2 Merge pull request #60 from projectatomic/more-cleanups
move dockerutils under docker
2016-05-17 17:52:10 +02:00
Antonio Murdaca
e775248b96 move dockerutils under docker/utils
also remove fixtures pkg as it would clutter godoc (there's not need
to have a .go files with fixtures)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-17 17:35:32 +02:00
Antonio Murdaca
df618e5f7a Merge pull request #58 from mtrmac/api-general
General image API cleanups
2016-05-17 15:58:08 +02:00
Miloslav Trmač
6a357b6fcc Add comments on the use of the API and the general direction. 2016-05-17 15:50:17 +02:00
Miloslav Trmač
7598aab521 Clean up Image.Inspect
This does not change behavior.

Rename types.DockerImageManifest to types.ImageInspectInfo.

This naming more accurately reflects what the function does and how it is
expected to be used.

(The only outstanding non-inspection piece is the Name field, which is
kind of a subset of GetIntendedDockerReference() right now. Not sure
whether that is intentional.)

Also fold makeImageManifest into its only user.
2016-05-16 20:50:46 +02:00
Miloslav Trmač
9766f72760 Move listing of repository tags from Image.Manifest to a separate Image.GetRepositoryTags
This does not change behavior.

Splits listing of repository tags, which is not a property of an image,
from the image.Manifest gathering of information about an image.
2016-05-16 20:50:46 +02:00
Miloslav Trmač
60e8d63712 Compute the digest in (skopeo inspect) instead of trusting the registry
Compute the digest ourselves, the registry is in general untrusted and
computing it ourserlves is easy enough.

The stop passing the unverifiedCanonicalDigest value around, simplifying
ImageSource.GetManifest and related code.  In particular, remove
retrieveRawManifest and have internal users just call Manifest() now that
we don't need the digest.
2016-05-16 20:50:45 +02:00
Miloslav Trmač
e3d257e7b5 Decouple (skopeo inspect) output formatting from types.Image.Manifest
Does not change behavior.

This will allow us to move collecting some of the data to the (skopeo
inspect) code and to have a more focused types.Image API, where
types.Image.Manifest() does not return a grab bag of manifest-unrelated
data, eventually.

For how it actually makes the coupling more explicit by having
types.Image.Manifest() return a types.DockerImageManifest instead of the
too generic types.ImageManifest.  We will need to think about which
parts of DockerImageManifest are truly generic, later.
2016-05-16 20:50:45 +02:00
Antonio Murdaca
c75f0f6780 Merge pull request #59 from mtrmac/api-for-signatures
API for signatures - drop Get prefixes on quick getters
2016-05-16 20:43:48 +02:00
Miloslav Trmač
c38ed76969 Rename GetIndendedDockerReference to IntendedDockerReference 2016-05-16 20:33:13 +02:00
Miloslav Trmač
119609b871 Drop the Get prefix from types.Image.GetManifest and GetSignatures
Keeps the Get prefix on the equivalent methods on types.ImageSource, to
hint that they may be slow.
2016-05-16 20:29:52 +02:00
Miloslav Trmač
dc7a05ebf9 Rename types.Image.Manifest to types.Image.Inspect
Does not change behavior.

This better expresses the purpose of this method (it is working with
more, currently much more, than the manifest), and frees up the Manifest
method name for a simple getter of the raw blob.
2016-05-16 20:24:39 +02:00
Antonio Murdaca
d4eb69e1ab Merge pull request #57 from mtrmac/api-for-signatures
API for signatures
2016-05-16 20:10:03 +02:00
Miloslav Trmač
e4913bd0b0 Add GetIntendedDockerReference to types.Image and types.ImageSource
This will be necessary for signature verification and related policy
evaluation in the future.
2016-05-16 19:25:11 +02:00
Miloslav Trmač
feb9de4845 Add GetManifest and GetSignatures to types.Image
No change in behavior.

These functions are guaranteed-cached versions of the same method in
types.ImageSource.  Both will be needed for signature policy evaluation,
and the symmetry with ImageSource is nice.

Also replaces the equivalent RawManifest method, preferring to keep
the same naming convention as types.ImageSource.
2016-05-16 19:25:11 +02:00
Antonio Murdaca
a39474c817 Merge pull request #56 from mtrmac/sub-pkgs
Move directory, docker and openshift from cmd/skopeo to their own subpackages
2016-05-16 18:44:18 +02:00