Commit Graph

1585 Commits

Author SHA1 Message Date
Silvano Cirujano Cuesta
aafae2bc50 docs: consolidate CONTRIBUTING
Move documentation about dependencies management from README.md to
CONTRIBUTING.md.

Closes #583

Signed-off-by: Silvano Cirujano Cuesta <silvano.cirujano-cuesta@siemens.com>
2019-01-17 16:04:13 +01:00
Daniel J Walsh
e5b9ea5ee6
Merge pull request #593 from vrothberg/progress-bar-tty-check
vendor latest c/image
2019-01-17 06:45:48 -05:00
Valentin Rothberg
1c2ff140cb vendor latest c/image
When copying images and the output is not a tty (e.g., when piping to a
file) print single lines instead of using progress bars. This avoids
long and hard to parse output.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-01-16 17:59:52 +01:00
Valentin Rothberg
f7c608e65e
Merge pull request #592 from eramoto/build-in-container
Makefile: Build docs in a container
2019-01-15 14:12:49 +01:00
ERAMOTO Masaya
ec810c91fe Makefile: Build docs in a container
Enables to build docs in a container even when go-md2man is not installed
locally.

Signed-off-by: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
2019-01-15 18:57:30 +09:00
Daniel J Walsh
17bea86e89
Merge pull request #581 from afbjorklund/build-tag
Allow building without btrfs and ostree
2019-01-04 09:13:25 -05:00
Anders F Björklund
3e0026d907 Allow building without btrfs and ostree
Copy the build tag scripts from Buildah

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2019-01-03 20:32:53 +01:00
Antonio Murdaca
3e98377bf2
Merge pull request #579 from runcom/v0134
release v0.1.34
2018-12-21 16:10:05 +01:00
Antonio Murdaca
0658bc80f3
version: bump to v0.1.35-dev
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-12-21 15:52:49 +01:00
Antonio Murdaca
e96a9b0e1b
version: bump to v0.1.34
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-12-21 15:52:36 +01:00
Antonio Murdaca
08c30b8f06
bump(github.com/containers/image)
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-12-21 15:52:01 +01:00
Antonio Murdaca
05212df1c5
Merge pull request #577 from runcom/0133
bump to v0.1.33
2018-12-19 12:11:04 +01:00
Antonio Murdaca
7ec68dd463
version: bump to v0.1.34-dev
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-12-19 11:14:07 +01:00
Antonio Murdaca
6eb5131b85
version: bump to v0.1.33
Signed-off-by: Antonio Murdaca <runcom@linux.com>
2018-12-19 11:13:51 +01:00
Antonio Murdaca
736cd7641d
Merge pull request #573 from vrothberg/parapull
vendor containers/image for parallel copying of layers
2018-12-19 09:30:06 +01:00
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