Commit Graph

792 Commits

Author SHA1 Message Date
Daniel J Walsh a6f7d725a0 Add/Copy need to support glob syntax
This patch allows users to do
buildah add $ctr * /dest

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

Closes: #194
Approved by: nalind
2017-07-17 20:11:48 +00:00
Daniel J Walsh dd98523b8d Add flag to remove containers on commit
I think this would be good practice to eliminate wasted disk space.

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

Closes: #189
Approved by: rhatdan
2017-07-17 19:07:21 +00:00
Nalin Dahyabhai f46ed32a11 Build imgtype independently
Just build imgtype once, and reuse the flags we use for the main binary.

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

Closes: #174
Approved by: rhatdan
2017-06-28 21:05:58 +00:00
Nalin Dahyabhai 72253654d5 imgtype: don't log at Fatal level
Logging at Fatal calls os.Exit(), which keeps us from shutting down
storage properly, which prevents test cleanup from succeeding.

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

Closes: #162
Approved by: rhatdan
2017-06-28 20:16:31 +00:00
Nalin Dahyabhai a2bd274d11 imgtype: add debugging, reexec, an optimization
In the imgtype test helper, add a -debug flag, correctly handle things
on the off chance that we need to call a reexec handler, and read the
manifest using the Manifest() method of an image that we're already
opening, rather than creating a source image just so that we can call
its GetManifest() method.

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

Closes: #162
Approved by: rhatdan
2017-06-28 20:16:31 +00:00
Nalin Dahyabhai 416301306a Make it possible to run tests with non-vfs drivers
Make the tests use the storage driver named in $STORAGE_DRIVER, if one's
set, instead of hard-coding the default of "vfs".

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

Closes: #162
Approved by: rhatdan
2017-06-28 20:16:31 +00:00
Daniel J Walsh a49a32f55f Add buildah export support
Will export the contents of a container as a tar ball.

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

Closes: #170
Approved by: rhatdan
2017-06-28 20:06:42 +00:00
Ryan Cole 6d85cd3f7d update 'buildah images' and 'buildah rmi' commands
add more flags to `buildah images` and `buildah rmi`, and write tests

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>

Closes: #155
Approved by: rhatdan
2017-06-28 15:36:19 +00:00
umohnani8 63ca9028bc Add 'buildah version' command
Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #157
Approved by: rhatdan
2017-06-27 15:50:36 +00:00
Nalin Dahyabhai 8efeb7f4ac Handle "run" without an explicit command correctly
When "run" isn't explicitly given a command, mix the command and
entrypoint options and configured values together correctly.

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

Closes: #160
Approved by: rhatdan
2017-06-26 13:21:53 +00:00
Nalin Dahyabhai 303a8df35d Ensure volume points get created, and with perms
Ensure that volume points are created, if they don't exist, when they're
defined in a Dockerfile (#151), and that if we create them, we create
them with 0755 permissions (#152).

When processing RUN instructions or the run command, if we're not
mounting something in a volume's location, create a copy of the volume's
initial contents under the container directory and bind mount that.

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

Closes: #154
Approved by: rhatdan
2017-06-24 10:37:13 +00:00
Nalin Dahyabhai 3163a98bdd Add a "push" command
Add a "push" command, which pulls an image's layers from local storage,
recomputes the image's digest and manifest, and uses the image library
to write the result to the specified location.

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai 1ed6c7123f Finish wiring --format into build-using-dockerfile
We weren't properly passing the preferred output format to the Commit()
method when committing images that we were building using
build-with-dockerfile.  Fix that.

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

Closes: #127
Approved by: rhatdan
2017-05-30 17:29:31 +00:00
Nalin Dahyabhai 05a7c97f20 Test that setting configurations values works
Test setting and importing of configuration settings by saving to both
formats, and then checking that the values in both configuration fields
has the right data when we use either image type as a source image.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:11 +00:00
Nalin Dahyabhai 9049b6108c Test writing while selecting metadata formats
Add a test helper for examining image metadata and checking their types,
and add tests that use it to verify that after writing either Docker v2
or OCI v1 images, that the manifest and configuration blobs that we
stored for them successfully decode as the correct data types.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:11 +00:00
Nalin Dahyabhai b92279faa4 Increase the timeout for metalinter from 2m to 4m
Increase the timeout that we set for running the metalinter from 2
minutes to 4 minutes, for cases where the calling environment is more
heavily loaded than we expected.

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

Closes: #119
Approved by: rhatdan
2017-05-23 17:06:37 +00:00
Nalin Dahyabhai 3065ea3d16 Add a "tag" command
Add a "tag" command, for adding names to locally-stored images.

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

Closes: #110
Approved by: rhatdan
2017-05-19 19:59:47 +00:00
Nalin Dahyabhai 76395efa52 Add an initial "inspect" command
Add an "inspect" command, which can be used to dump the contents of the
Buildah object for a working container, or the starting one we'd get for
a specified image.

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

Closes: #109
Approved by: rhatdan
2017-05-19 11:29:12 +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
Nalin Dahyabhai 60b9159485 Add a "go vet" validation step
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #91
Approved by: rhatdan
2017-05-08 17:50:38 +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 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
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 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
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
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
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 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 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
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 8bbc3a5a9c Tweak copying behavior so that dest can be a file
Change copy behavior so that the destination can be a file rather than a
directory if we're copying a single item.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-23 17:28:51 -04:00
Nalin Dahyabhai ce13780b83 Add a couple of tests for "run"
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-17 18:53:04 -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 6afcabc1aa Test looking up containers by name and root
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-15 17:29:18 -04:00
Nalin Dahyabhai cebd2b263c Sanitize base64 characters in pathnames in tests
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-07 16:02:12 -05:00
Nalin Dahyabhai 01a148a00b Fixup cleanliness in tests
Clean up the tests so that data files that we generate don't get dropped
in the root directory of the host, or in a part of ${TMPDIR} that we
won't clean up.  Add tests to exercise "add"'s extracting logic.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-07 15:54:51 -05:00
Nalin Dahyabhai 3b44a3e3b3 Simplify copy/add logic to better match dockerd's
Simplify our implementation of copy/add to always assume that the
destination location will be a directory.  Trying to be cleverer, like
cp is, would just be confusing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-07 13:26:17 -05:00
Nalin Dahyabhai 2160a9e803 Add some integration tests
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-06 18:47:51 -05:00