Commit Graph

68 Commits

Author SHA1 Message Date
Nalin Dahyabhai
12e582ee1a Report pull/commit progress by default
Have 'from', 'commit', and 'build-using-dockerfile' report progress via
stderr (so that capturing output from 'from' and 'commit' still works as
expected) unless --quiet is used to suppress the reporting.

Closes #94.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #98
Approved by: rhatdan
2017-05-10 12:53:25 +00:00
Nalin Dahyabhai
4d155b93b4 imagebuildah: add AdditionalTags
Add an AdditionalTags field to the imagebuildah options structure, to
provide for additional tags which we'll want to apply to the image that
we're writing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #88
Approved by: rhatdan
2017-05-08 18:05:31 +00:00
Dan Walsh
126b578d8e Contribute buildah.spec
Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Closes: #70
Approved by: rhatdan
2017-05-08 17:44:23 +00:00
Daniel J Walsh
4c66c03b3d Remove --mount from buildah-from
We don't have a good way of identifying to a user where a container
was mounted on the file system when doing a buildah from.

A user can just do a buildah mount CID /mnt, after the from line to
handle this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #86
Approved by: nalind
2017-04-24 21:45:07 +00:00
Nalin Dahyabhai
04ce6f39c4 imagebuildah: Reexport some things
Have imagebuildah reexport some constants and its own Mount type, to
reduce the number of our dependencies that a prospective consumer of
this package would also need to import directly.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #84
Approved by: rhatdan
2017-04-24 14:33:43 +00:00
Nalin Dahyabhai
ce87a52ef4 bud: Add flags for specifying the runtime command
So long as it's possible to have an incompatible version of runc
installed, we're going to want to easily point to another version, as we
already allow for with the "run" command.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #76
Approved by: nalind
2017-04-19 18:58:13 +00:00
Dan Walsh
8c8a13fdc2 Small cleanup on buildah rmi to make code cleaner
While adding rmi to ocid, I was asked to make this change, so want
to keep the code in buildah and ocid for these functions as close as
possible to the same.

Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Closes: #69
Approved by: nalind
2017-04-17 18:40:17 +00:00
Nalin Dahyabhai
cbeb888e30 Clean up image pulling policy
Change how we represent image pulling policy from a pair of booleans to
a single field which can take three values (never, if-missing, always),
with the default value being if-missing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #71
Approved by: rhatdan
2017-04-17 18:16:13 +00:00
Nalin Dahyabhai
d68d986d0f rm/rmi: Don't exit until we've tried them all
If we're told to remove more than one container or image, actually try
to remove them all, but still return an error if we fail at any of them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #68
Approved by: rhatdan
2017-04-14 09:37:24 +00:00
Nalin Dahyabhai
0b51d4990a Add a build-using-dockerfile command
Add a build-using-dockerfile command (alias: bud) which uses
openshift/imagebuilder to wrap parsing and dispatching, and runc (or
another OCI runtime) to handle RUN instructions.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai
b7a598ca21 Fixup metalinter errors
Fix a number of issues flagged by gometalinter.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +00:00
Nalin Dahyabhai
96d15578e4 Fixup golint warnings
Fix a number of issues flagged by golint.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +00:00
Nalin Dahyabhai
933a4a1107 Broaden what "rmi" can accept, and add tests
Teach "rmi" to handle arbitrary image references and incomplete
references, and add tests for both.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #61
Approved by: rhatdan
2017-04-11 18:35:08 +00:00
Daniel J Walsh
3b51b10929 Fix copy and paste error on container-image
Closes: #57
Approved by: rhatdan
2017-03-29 12:46:42 +00:00
Daniel J Walsh
121973dd50 Fix cut and paste error in buildah images
Closes: #54
Approved by: rhatdan
2017-03-28 21:29:54 +00:00
Daniel J Walsh
d7880327ae Add truncation to buildah containers|images
Closes: #52
Approved by: rhatdan
2017-03-28 19:48:15 +00:00
Nalin Dahyabhai
53f12844b2 Accept commit targets which are just store refs
Accept commit target names which don't include a transport name by
checking if they parse as valid containers-storage references after they
fail to parse as a general reference.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #49
Approved by: rhatdan
2017-03-28 19:33:07 +00:00
Nalin Dahyabhai
fc27a56f12 Rename "list"/"delete" to "containers"/"rm"
Rename the "list" and "delete" commands to "containers" and "rm",
respectively, and add "images" and "rmi" counterparts for them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #32
Approved by: rhatdan
2017-03-28 17:59:09 +00:00
Daniel J Walsh
b8214c4cff Switch buildah list quiet option to only list container id's
Add `noheading` option to eliminate headings

Closes: #44
Approved by: rhatdan
2017-03-28 16:18:18 +00:00
Daniel J Walsh
e63629bfc6 Add some obvious short options
Closes: #44
Approved by: rhatdan
2017-03-28 16:18:18 +00:00
Nalin Dahyabhai
6715edfd18 Add some more options for Run
Add options to Run() for passing in additional environment variables,
overriding the default command, user, and working directory, and a flag
for controlling whether or not we attach to the host's network.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #46
Approved by: rhatdan

Closes: #39
Approved by: nalind
2017-03-28 15:53:18 +00:00
Daniel J Walsh
b58b778ef3 Move all command definitions out of main.go into implementation source
This will allow us to more easily share these source modules between
kpod and buildah as well as move keep the definition with the implementation.

Closes: #45
Approved by: rhatdan
2017-03-27 19:03:28 +00:00
Daniel J Walsh
56f61d944a buildah delete should be able to delete multiple containers
Simple change to allow users to specify multiple containers to delete.
This would support cleaning up all containers

buildah delete $( buildah list -q)

Closes: #43
Approved by: rhatdan
2017-03-27 16:05:10 +00:00
Daniel J Walsh
547afe50a0 Remove --destination flag from buildah add|copy
We need to match the syntax of Dockerfile, three forms

buildah copy $CID SOURCE
buildah copy $CID SOURCE DESTINATION
buildah copy $CID SOURCE SOURCE SOURCE DESTINATION

Closes: #40
Approved by: nalind
2017-03-24 22:50:34 +00:00
Nalin Dahyabhai
aacaf34354 Only attempt to shut down a Store if we opened one
Only attempt to Shutdown() the default storage.Store if we actually
opened it to begin with.  This avoids some unnecessary churn with
storage in cases where argument parsing flags an invocation error.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #41
Approved by: rhatdan
2017-03-24 20:34:11 +00:00
Daniel J Walsh
c0b38746d3 Remove all --name and --root options
Also fix up buildah commit to require name and image
2017-03-24 14:05:25 -04:00
Nalin Dahyabhai
37d3ab9dca Merge pull request #26 from rhatdan/link
Remove link from CLI
2017-03-24 12:46:19 -04:00
Nalin Dahyabhai
5b8579d897 Merge pull request #25 from nalind/vendor-updates
Vendor updates
2017-03-23 16:49:24 -04:00
Daniel J Walsh
80f73013cd Remove link from CLI
We have decided not to support using the --link param in the CLI.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-23 14:59:20 -04:00
Nalin Dahyabhai
711e0f420f Merge pull request #22 from rhatdan/BUILDAHROOT
Default --root option to ENV BUILDAHROOT
2017-03-22 16:48:38 -04:00
Daniel J Walsh
2ca263ad1e Default --root option to ENV BUILDAHROOT
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-22 16:33:46 -04:00
Nalin Dahyabhai
f0b508598a Update implementation to match dependencies
types.ImageSource.Close() can return an error now, and ParseImageName()
moved to containers/image/transports/alltransports.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-22 16:33:24 -04:00
Nalin Dahyabhai
8292693fc8 Correctly report errors returned by commands
When running our various subcommands, report errors that they return
correctly, and ensure that in those cases we don't exit with status 0.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-22 15:17:53 -04:00
Nalin Dahyabhai
9edc229948 commit: "do-not-compress" -> "disable-compression"
Rename the "commit" "--do-not-compress" flag to be called
"--disable-compression" instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-20 16:30:01 -04:00
Nalin Dahyabhai
6135c2a947 Note that "scratch" is an accepted image name
Note that "scratch" is an option in the usage text for "from"'s --image
flag.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-20 16:11:30 -04:00
Nalin Dahyabhai
ae1295b0c9 Tweak more help usage and descriptions
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-20 15:51:35 -04:00
Nalin Dahyabhai
0d83d9ebfa Pull required flag values from the arguments list
When flags that we'd require be specified aren't, if there are command
line arguments, use their values as flag values.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:46:16 -04:00
Nalin Dahyabhai
f2fc0c7e5f Remove single-character aliases for subcommands
Remove the single-character aliases for subcommands.  They were not
popular.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:46:16 -04:00
Nalin Dahyabhai
2f545788b6 Default "from" to --pull=true
Change the behavior of "from" to default to have --pull be true, rather
than the previous default of false.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:46:16 -04:00
Nalin Dahyabhai
9d42fecce0 Show defaults for global options in help output
Read the library defaults from the storage library before we parse our
command line, so that help output will correctly show the default
storage locations.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:46:16 -04:00
Nalin Dahyabhai
f4be6fdc48 Don't mix "config" in with "run" and "commit"
Don't mix "config" options in with the "run" and "commit" commands.  It
might have made sense before "config" was a separate command, but it
doesn't any more, and it might suggest that settings changed during
"run" are temporary, when they are not.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:46:15 -04:00
Nalin Dahyabhai
631cda1e5f Update flag Usage strings to highlight arg types
Update the Usage strings that we include in Flag structures so that the
type of argument displayed in help output isn't just "value".

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:46:15 -04:00
Nalin Dahyabhai
a2ccec8c43 Catch up to the projectatomic move
Catch up import paths and docs to build correctly now that we're in
projectatomic.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-16 10:54:45 -04:00
Nalin Dahyabhai
83a1ec775e Clarify that we can find containers by name or ID
Clarify that the --name option can also specify a container ID, and the
right things will still happen.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-16 10:19:05 -04:00
Nalin Dahyabhai
3e7e08be90 Add a "list" command, for listing active builders
Add a "list" command which lists all known buildah working containers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-15 17:34:13 -04:00
Nalin Dahyabhai
b8f939db45 Fix parsing of the --storage-driver option
In the CLI tool, that's a string flag, not a boolean.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-06 17:20:44 -05:00
Nalin Dahyabhai
e467bea0aa Add "add" and "copy" commands
Add "add" and "copy" CLI commands, which end up calling the same buildah
method, differing only in whether or not they tell it to attempt to
extract local sources when those sources appear to be archive files
("add" does, "copy" does not).

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-06 15:39:22 -05:00
Nalin Dahyabhai
a0d394af74 Try to import containers that we didn't create
When we're given the name of a container on the command line, make every
command that attempts to open an in-progress build container fall back
to creating a new build configuration file for the specified container
if the container exists but wasn't originally created for a build.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-24 15:18:35 -05:00
Nalin Dahyabhai
0bbb076df8 Fix a copy/paste error in an error message
When we encounter an error parsing the target (new) image name during
"commit", don't use the container's name in the error message where we
meant to mention the image's name.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-24 15:14:52 -05:00
Nalin Dahyabhai
c46716525c Make the runtime for "run" more configurable
Provide RunOptions which can be used to change the runtime to something
other than "runc", and add an option that allows passing in additional
global arguments for the runtime.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-02-17 13:58:11 -05:00