Commit Graph

142 Commits

Author SHA1 Message Date
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
aff92e565c Miscellaneous man page updates
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #67
Approved by: rhatdan
2017-04-14 10:12:01 +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
d410ce9aea Update bash-completions for build-using-dockerfile
Add completion for build-using-dockerfile and our renaming of the
containers/images --no-truncate flag to --notruncate during the CLI
overhaul.

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

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai
31b6e7b485 Add a man page for buildah-bud(1)
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai
761597056c Add a few tests for building images
It's nowhere near exhaustive, but it's a start.

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

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +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
a532522624 Vendor openshift/imagebuilder
Vendor openshift/imagebuilder and its dependencies, and pick up new
dependencies on golang.org/x/text and github.com/opencontainers/selinux.

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

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai
bed75252b0 Use imagebuilder's definition of "scratch"
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #59
Approved by: rhatdan
2017-04-13 21:42:51 +00:00
Nalin Dahyabhai
e67d2e7356 The "all" target shouldn't do any installing
Remove "install.tools" as a dependency of the top-level "all" target,
and make it a dependency of the "install" target.

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

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +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
c0a6d24ec2 Add a "validate" target
Add a "validate" target to the top level Makefile that checks formatting
of source files with golint, signed-off-by tags with git-validate, and
for various other warnings with gometalinter.

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

Closes: #62
Approved by: rhatdan
2017-04-12 21:25:35 +00:00
Nalin Dahyabhai
b1bb73e01c Teach "Run" to dig user IDs out of containers
When we have cgo, use fgetpwent() to try to look up user IDs and primary
GIDs in containers.  If that fails for any reason (or if we don't have
cgo), fall back to doing what we were doing before (i.e., trying to look
up the information on the host).

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

Closes: #63
Approved by: rhatdan
2017-04-11 18:41:54 +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
TomSweeneyRedHat
2fe578c82f Create manpages for the buildah project
Second pass of manpages, more tweaking to follow.

Signed-off-by: TomSweeneyRedHat <tsweney@redhat.com>

Closes: #53
Approved by: nalind
2017-04-11 17:22:37 +00:00
Nalin Dahyabhai
ccfa6a8bd4 Make Run() use a terminal only if it has one
Make Run() default to running the command with a PTY if we're being run
with stdout connected to terminal, and provide options to force the
decision one way or the other.

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

Closes: #64
Approved by: rhatdan
2017-04-11 16:55:52 +00:00
Nalin Dahyabhai
43cc44ac8a Turn off Travis builds against 1.6.
Some of our dependencies expect 1.7's "context" package and fields of
http.Transport which aren't in 1.6.

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

Closes: #65
Approved by: rhatdan
2017-04-11 13:14:07 +00:00
Daniel J Walsh
b9a1426111 buildah should be install in /usr/bin not /usr/sbin
Closes: #60
Approved by: rhatdan
2017-03-29 22:36:29 +00:00
Nalin Dahyabhai
19a7165783 Apply Last-Modified time as mtime when saving URLs
When saving the contents of a URL to a local file, attempt to set mtime
based on the response's Last-Modified header, if there is one.

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

Closes: #58
Approved by: nalind
2017-03-29 19:38:20 +00:00
Daniel J Walsh
c72d2db65d Add installation for buildah and bash completions
Closes: #15
Approved by: rhatdan
2017-03-29 14:40:39 +00:00
Daniel J Walsh
d008132404 First pass at bash completions
Closes: #15
Approved by: rhatdan
2017-03-29 14:40:39 +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
Nalin Dahyabhai
2f6cc3ee21 Use "scratch" for tests where we never "run"
We can use "scratch" now as a source for building images, so speed
things up a bit by using it instead of pulling alpine in tests where it
isn't expected to affect the test result.

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

Closes: #55
Approved by: rhatdan
2017-03-29 07:52:32 +00:00
Nalin Dahyabhai
c8032d783b Handle ADD/COPY where the destination ends with /
When the destination for an ADD or COPY operation ends with a path
separator, take that as an indicator that the destination should be a
directory, that we should create it if it doesn't already exist, and
that any files we're copying should be placed in the directory.

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

Closes: #56
Approved by: rhatdan
2017-03-29 07:48:51 +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
ce254f51fc Tweak ADDing/COPYing directories to copy contents
When copying or adding a source directory, copy the directory's contents
to the destination directory, to better match Dockerfile COPY behavior.

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

Closes: #50
Approved by: rhatdan
2017-03-28 19:42:47 +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
Daniel J Walsh
df71b8fe6a Update vendor patches
Closes: #51
Approved by: rhatdan
2017-03-28 19:22:27 +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
Nalin Dahyabhai
75c13530ac Update example scripts to use the new CLI syntax
Update the scripts in examples/ to adapt to changes in the CLI.

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

Closes: #48
Approved by: rhatdan
2017-03-28 16:22:28 +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
Nalin Dahyabhai
4c982a3799 Strip the image name down more for container names
When computing a default container name from the name of a source image,
drop tags and any leading components from the image name before
attempting to use it as part of a container name.

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

Closes: #33
Approved by: rhatdan
2017-03-27 19:22:36 +00:00
Nalin Dahyabhai
e96ba381a2 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
2017-03-27 19:07:38 +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
943191c7c2 Correctly set tags on the names of pulled images
Correctly set the tag portion of the name that we assign to images that
we've pulled.

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

Closes: #42
Approved by: nalind
2017-03-24 22:47:33 +00:00
Nalin Dahyabhai
c6a4a06454 Bind mount /etc/hosts, /etc/resolv.conf in Run()
When we run a command in Run(), since it's sharing the host's network
namespace, also have it share the host's DNS settings.

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

Closes: #34
Approved by: rhatdan
2017-03-24 20:37:06 +00:00
Nalin Dahyabhai
e202577172 Make Run() commands share the host's network
Make commands we run in Run() use the host's networking.

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

Closes: #34
Approved by: rhatdan
2017-03-24 20:37:06 +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
Nalin Dahyabhai
fd3a1f09d6 Merge pull request #27 from rhatdan/name
Remove all --name and --root options
2017-03-24 14:57:31 -04:00
Jonathan Lebon
e62d7d9a60 hook up to redhat-ci
Add a YAML file to hook up this repo to redhat-ci. I ported over the
tests and environment from the .travis.yml file, though feel free to
customize it to your needs. For more information on supported YAML
fields, please see:

https://github.com/jlebon/redhat-ci/blob/master/sample.redhat-ci.yml

RHCI does also support containerized builds, though the container
environment is unprivileged, which means the tests won't be able to e.g.
mount things. Instead, I set it up so it provisions an Atomic Host on
which we run a privileged container. This is a workflow that will be
made easier in the future.

Closes: #37
Approved by: jlebon
2017-03-24 18:42:00 +00:00
Daniel J Walsh
a07369f50d Merge pull request #38 from nalind/comment
Clarify a comment
2017-03-24 14:34:05 -04: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
3bd2228516 Clarify a comment
Clarify that we're referring to a buildah.Builder object here, and it's
not a capitalization mistake.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-24 13:48:39 -04:00