Commit Graph

1620 Commits

Author SHA1 Message Date
Valentin Rothberg
78bd5dd3df vendor containers/image for parallel copying of layers
Vendor the latest containers/image 50e5e55e46a391df8fce1291b2337f1af879b822
to enable parallel copying of layers.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2018-12-19 09:06:56 +01:00
Antonio Murdaca
ecd675e0a6
Merge pull request #572 from giuseppe/use-optimized-gzip
vendor: use faster version instead compress/gzip
2018-12-18 17:24:57 +01:00
Giuseppe Scrivano
5675895460
vendor: update containers/storage and containers/image
some tests I've done to try out the difference in performance:

I am using a directory repository so to not depend on the network.

User time (seconds): 39.40
System time (seconds): 6.83
Percent of CPU this job got: 121%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:38.07
User time (seconds): 8.32
System time (seconds): 1.62
Percent of CPU this job got: 128%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:07.72

User time (seconds): 42.68
System time (seconds): 6.64
Percent of CPU this job got: 162%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:30.44
User time (seconds): 8.94
System time (seconds): 1.51
Percent of CPU this job got: 178%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:05.85

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-18 10:45:39 +01:00
Giuseppe Scrivano
0f8f870bd3
vendor: update ostree-go
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-12-13 16:35:35 +01:00
Daniel J Walsh
a51e38e60d
Merge pull request #523 from mtrmac/cli-parsing
RFC: Reliable CLI parsing
2018-12-07 09:24:31 -05:00
Miloslav Trmač
8fe1595f92 Do not interpret % metacharacters in (skopeo inspect) output
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:54 +01:00
Miloslav Trmač
2497f500d5 Add commandAction to make *cli.Context unavailable in command handlers
That in turn makes sure that the cli.String() etc. flag access functions
are not used, and all flag handling is done using the *Options structures
and the Destination: members of cli.Flag.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:54 +01:00
Miloslav Trmač
afa92d58f6 Drop the *cli.Context argument from parseImage and parseImageSource
We no longer need it for handling flags.

Also, require the caller to explicitly pass an image name to parseImage
instead of, horribly nontransparently, using the first CLI option.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:38 +01:00
Miloslav Trmač
958cafb2c0 Inline contextsFromCopyOptions
It was not really any clearer when broken out. We already have
a pair of trivial src/dest API calls before this, so adding
a similar src/dest call for SystemContext follows the pattern.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
1d1bf0d393 Replace contextFromImageDestOptions by imageDestOptions.newSystemContext
This is analogous to the imageOptions.newSystemContext conversion.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
3094320203 Replace contextFromImageOptions by imageOptions.newSystemContext
We no longer need the *cli.Context parameter, and at that point
it looks much cleaner to make this a method (already individually;
it will be even cleaner after a similar imageDestOptions conversion).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
39de98777d Remove no longer needed flagsPrefix from imageOptions
contextFromImageOptions is finally not using any string-based lookup
in cli.Context, so we don't need to record this value any more.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
8084f6f4e2 No longer define all "skopeo copy" flags in utils_test.go
All the contextFromImage{,Dest}Options flags are now defined in
imageFlags/imageDestFlags.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
6ef45e5cf1 Migrate --authfile to sharedImageOptions
This introduces YET ANOTHER *Options structure, only to share this
option between copy source and destination.  (We do need to do this,
because the libraries, rightly, refuse to work with source and
destination declaring its own versino of the --authfile flag.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
444b90a9cf Migrate --dest-compress to imageDestOptions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
72a3dc17ee Migrate --dest-ostree-tmp-dir to imageDestOptions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
88c748f47a Introduce imageDestOptions
This is an extension of imageOptions that carries destination-specific
flags.

This will allow us to handle --dest-* flags without also exposing
pointless --src-* flags.

(This is, also, where the type-safety somewhat breaks down;
after all the work to make the data flow and availability explicit,
everything ends up in an types.SystemContext, and it's easy enough
to use a destination-specific one for sources.  OTOH, this is
not making the situation worse in any sense.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
7e8c89d619 Migrate --*daemon-host to imageOptions
This was previously only supported in (skopeo copy).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
694f915003 Migrate --*shared-blob-dir to imageOptions.
This was previously only supported in (skopeo copy).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
a77b409619 Migrate --*tls-verify to imageOptions
This was previously unsupported by (skopeo layers)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
1faff791ce Migrate --*cert-dir to imageOptions
This was previously unsupported by (skopeo layers).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
8b8afe0fda Migrate --*creds to imageOptions
This is one of the ugliest parts; we need an extra parameter to support
the irregular screds/dcreds aliases.

This was previously unsupported by (skopeo layers).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
09a120a59b Temporarily add flagPrefix to imageOptions
We don't want to worry about mismatch of the flagPrefix value
between imageFlags() and contextFromImageOptions().  For now,
record it in imageOptions; eventually we will stop using it in
contextFromImageOptions and remove it again.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
c769c7789e Introduce imageOptions
This is similar to the previous *Options structures, but this one
will support differing sets of options, in particular for the
copy source/destination.

The way the return values of imageFlags() are integrated into
creation of a cli.Command forces fakeContext() in tests to do
very ugly filtering to have a working *imageOptions available
without having a copyCmd() cooperate to give it to us.  Rather
than extend copyCmd(), we do the filtering, because the reliance
on copyCmd() will go away after all flags are migrated, and so
will the filtering and fakeContext() complexity.

Finally, rename contextFromGlobalOptions to not lie about only
caring about global options.

This only introduces the infrastructure, all flags continue
to be handled in the old way.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:29:18 +01:00
Miloslav Trmač
3ea3965e5e Use globalOptions for setting up types.SystemContext
contextFromGlobalOptions now uses globalOptions instead
of cli.Context.Global* .  That required passing globalOptions
through a few more functions.

Now, "all" that is left are all the non-global options
handled in contextFromGlobalOptions.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:57 +01:00
Miloslav Trmač
ee8391db34 Use globalOptions for the global timeout option
Replace commandTimeoutContextFromGlobalOptions with
globalOptions.commandTimeoutContext.  This requires passing
globalOptions to more per-command *Options state.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
e1cc97d9d7 Use globalOptions for policy configuration
This requires us to propagate globalOptions to the per-command
*Options state.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
f30756a9bb Use globalOptions for the debug flag
This works just like the command-specific options.  Handles only
the single flag for now, others will be added as the infrastructure
is built.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
33b474b224 Create a globalOptions structure
This works just like the command-specific options.  Also
moves the "Before:" handler into a separate method.

Does not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
485a7aa330 Use the *Options structures for command-specific options
Use Destionation: &opts.flag in the flag definition
instead of c.String("flag-name") and the like in the hadler and
matching only by strings.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
59117e6e3d Fix a typo
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
8ee3ead743 Create an "options" structure for each command
This is a big diff, but it really only replaces a few global variables
with functions returning a structure.

The ultimate goal of this patch set is to replace option handling using

> cli.StringFlag{Name:"foo", ...}
> ...
> func somethingHandler(c *cli.Context) error {
>     c.String("foo")
> }

where the declaration and usage are connected only using a string constant,
and it's difficult to notice that one or the other is missing or that the
types don't match, by

> struct somethingOptions {
>    foo string
> }
> ...
> cli.StringFlag{Name:"foo", Destination:&foo}
> ...
> func (opts *somethingOptions) run(c *cli.Context) error {
>     opts.foo
> }

As a first step, this commit ONLY introduces the *Options structures,
but for now empty; nothing changes in the existing implementations.

So, we go from

> func somethingHandler(c *cli.Context error {...}
>
> var somethingCmd = cli.Command {
>     ...
>     Action: somethingHandler
> }

to

> type somethingOptions struct{
> } // empty for now
>
> func somethingCmd() cli.Command {
>     opts := somethingOptions{}
>     return cli.Command {
>         ... // unchanged
>         Action: opts.run
>     }
> }
>
> func (opts *somethingOptions) run(c *cli.context) error {...} // unchanged

Using the struct type has also made it possible to place the definition of
cli.Command in front of the actual command handler, so do that for better
readability.

In a few cases this also broke out an in-line lambda in the Action: field
into a separate opts.run method.  Again, nothing else has changed.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:28:29 +01:00
Miloslav Trmač
bc39e4f9b6 Implement an optionalString, to be used as a cli.GenericFlag
This mirrors the behavior of cli.StringFlag, but records an explicit
"present" indication.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:23:49 +01:00
Miloslav Trmač
3017d87ade Implement an optionalBool, to be used as a cli.GenericFlag
This mirrors the behavior of cli.BoolFlag, but records and explicit
"present" indication.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:23:49 +01:00
Miloslav Trmač
d8f1d4572b Update github.com/urfave/cli
It's probably not strictly necessary, but let's work with the current
implementation before worrying about possible idiosyncracies.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-07 00:23:49 +01:00
Miloslav Trmač
41d8dd8b80
Merge pull request #570 from mtrmac/blob-info-caching
Vendor c/image after merging blob-info-caching
2018-12-07 00:22:16 +01:00
Miloslav Trmač
bcf3dbbb93 Vendor after merging c/image#536
... which adds blob info caching

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-12-06 23:26:31 +01:00
Daniel J Walsh
bfc0c5e531
Merge pull request #555 from mtrmac/revendor-image-spec
Re-vendor image-spec from upstream again
2018-12-06 14:40:04 -05:00
Miloslav Trmač
013ebac8d8 Re-vendor image-spec from upstream again
... after https://github.com/opencontainers/image-spec/pull/750 was merged.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-11-29 14:29:23 +01:00
Miloslav Trmač
fbc2e4f70f
Merge pull request #521 from mtrmac/regsv2-docker
Vendor in vrothberg/image:regsv2-docker
2018-11-29 14:00:43 +01:00
Miloslav Trmač
72468d6817 Vendor c/image after merging vrothberg/image:regsv2-docker
Also update the user and tests for the API change.
2018-11-29 13:28:04 +01:00
Miloslav Trmač
5dec940523 Add tests for contextFromGlobalOptions
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-11-19 22:10:05 +01:00
Miloslav Trmač
761a6811c1
Merge pull request #569 from mtrmac/podman-security-opt
Use --security-opt label=disable instead of label:disable
2018-11-08 22:52:46 +01:00
Miloslav Trmač
b3a023f9dd Use --security-opt label=disable instead of label:disable
podman only accepts the = syntax.

Fixes #567.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2018-11-08 03:29:52 +01:00
Antonio Murdaca
5aa217fe0d
Merge pull request #568 from runcom/bump-0.1.32
Bump 0.1.32
2018-11-07 22:22:50 +01:00
Antonio Murdaca
737438d026
version: bump to v0.1.33-dev
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-11-07 18:06:43 +01:00
Antonio Murdaca
1715c90841
version: bump to v0.1.32
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-11-07 18:06:24 +01:00
Miloslav Trmač
187299a20b
Merge pull request #566 from isimluk/fix-podman-build
Enable build in podman
2018-11-03 02:05:12 +01:00
Šimon Lukašík
89d8bddd9b Actually, enable build in podman 2018-11-03 00:10:44 +01:00
Daniel J Walsh
ba649c56bf
Merge pull request #565 from armstrongli/master
add timeout support for image copy
2018-11-02 11:32:36 -04:00