262 Commits

Author SHA1 Message Date
Dan Walsh
b9b2a8a7ef Vendor in latest containers/image and bump to version 0.3
OCI 1.0 Image specification is now released so we want to bump
buildah version to support 1.0 images.

Bump to version 0.3

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

Closes: #203
Approved by: rhatdan
v0.3
2017-07-20 20:23:32 +00:00
Nalin Dahyabhai
b37a981500 Stop trying to set the Platform in runtime specs
run: The latest version of runtime-spec dropped the Platform field, so
stop trying to set it when generating a configuration for a runtime.

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

Closes: #201
Approved by: rhatdan
2017-07-20 18:38:19 +00:00
Nalin Dahyabhai
a500e22104 Update image-spec and runtime-spec to v1.0.0
Update to just-released versions of image-spec and runtime-spec, and the
latest version of runtime-tools.

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

Closes: #201
Approved by: rhatdan
2017-07-20 18:38:19 +00:00
Daniel J Walsh
ac2aad6343 Update the version number we identify as to 0.2.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #199
Approved by: nalind
v0.2
2017-07-18 20:55:06 +00:00
Dan Walsh
c8a887f512 Add support for -- ending options parsing to buildah run
If you specify an option in a buildah run command, the command fails.
The proper syntax for this is to add --

buildah run $ctr -- ls -l /

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

Closes: #197
Approved by: nalind
2017-07-18 19:19:45 +00:00
Dan Walsh
f4a5511e83 Only print heading once when executing buildah images
The current buildah images command prints the heading twice, this
bug was introduced when --json flag was added.

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

Closes: #195
Approved by: rhatdan
2017-07-17 20:37:08 +00:00
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
Daniel J Walsh
98ca81073e Improve buildah push man page and help information
This better documents the options available to the user.

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

Closes: #186
Approved by: rhatdan
2017-07-13 19:58:04 +00:00
Tomas Tomecek
5f80a1033b add a way to disable PTY allocation
Fixes #179

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #181
Approved by: nalind
2017-07-13 14:18:08 +00:00
Tomas Tomecek
70518e7093 clarify --runtime-flag of run command
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Fixes #178

Closes: #182
Approved by: rhatdan
2017-07-10 19:12:48 +00:00
Tomas Tomecek
0c70609031 gitignore build artifacts
* manpages
* buildah binary
* imgtype binary

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #183
Approved by: rhatdan
2017-07-10 19:02:13 +00:00
Daniel J Walsh
b1c6243f8a Need \n for Printing untagged message
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #176
Approved by: rhatdan
2017-06-29 13:32:47 +00:00
Nalin Dahyabhai
12a3abf6fa Update to match newer storage and image-spec APIs
Update to adjust to new types and method signatures in just-updated
vendored code.

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

Closes: #174
Approved by: rhatdan
2017-06-28 21:05:58 +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
be2d536f52 Bump containers/storage and containers/image
Bump containers/storage and containers/image, and pin them to their
current versions.  This requires that we update image-spec to rc6 and
add github.com/ostreedev/ostree-go, which adds build-time requirements
on glib2-devel and ostree-devel.

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
Daniel J Walsh
7af6ab2351 Add the missing buildah version from the readme and the buildah man page
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #173
Approved by: rhatdan
2017-06-28 15:59:35 +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
Tomas Tomecek
d9a77b38fc readme: link to actual manpages
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #165
Approved by: rhatdan
2017-06-27 16:10:40 +00:00
Brent Baude
e50fee5738 cmd/buildah/containers.go: Add JSON output option
Consumers of the buildah output will need structured text like
the JSON format.  This commit adds a --json option to
buildah containers.

Example output:
```
[
    {
        "ID": "8911b523771cb2e0a26ab9bb324fb5be4e992764fdd5ead86a936aa6de964d9a",
        "Builder": true,
        "ImageId": "26db5ad6e82d85265d1609e6bffc04331537fdceb9740d36f576e7ee4e8d1be3",
        "ImageName": "docker.io/library/alpine:latest",
        "ContainerName": "alpine-working-container"
    }
]

```

Signed-off-by: Brent Baude <bbaude@redhat.com>

Closes: #164
Approved by: rhatdan
2017-06-27 16:01:07 +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
Brent Baude
62845372ad cmd/buildah/images.go: Add JSON output option
The Atomic CLI will eventually need to be able to consume
structured output (in something like JSON).  This commit
adds a -j option to output to trigger JSON output of
images.

Example output:
```
[
    {
        "id": "aa66247d48aedfa3e9b74e4a41d2c9e5d2529122c8f0d43417012028a66f4f3b",
        "names": [
            "docker.io/library/busybox:latest"
        ]
    },
    {
        "id": "26db5ad6e82d85265d1609e6bffc04331537fdceb9740d36f576e7ee4e8d1be3",
        "names": [
            "docker.io/library/alpine:latest"
        ]
    }
]
```

Signed-off-by: Brent Baude <bbaude@redhat.com>

Closes: #161
Approved by: rhatdan
2017-06-26 16:05:58 +00:00
Nalin Dahyabhai
5458250462 Update the example commit target to skip transport
Update the target name that we use when committing an image in the
example script to not mention the local storage transport, since the
default is to use it anyway.

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

Closes: #163
Approved by: rhatdan
2017-06-26 15:56:18 +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
21b1a9349d Add a -a/--all option to "buildah containers"
Add a --all option to "buildah containers" that causes it to go through
the full list of containers, providing information about the ones that
aren't buildah containers in addition to the ones that are.

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

Closes: #148
Approved by: rhatdan
2017-06-22 21:01:33 +00:00
TomSweeneyRedHat
8b99eae5e8 Add runc to required packages in README.md
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #153
Approved by: rhatdan
2017-06-20 21:04:51 +00:00
Nalin Dahyabhai
cd6b5870e2 Make shallowCopy() not use a temporary image
Modify shallowCopy() to not use a temporary image.  Assume that the big
data items that we formerly added to the temporary image are small
enough that we can just hang on to them.

Write everything to the destination reference instead of a temporary
image, read it all back using the low level APIs, delete the image, and
then recreate it using the new layer and the saved items and names.

This lets us lift the requirement that we shallowCopy only to images
with names, so that build-using-dockerfile will work without them again.

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

Closes: #150
Approved by: rhatdan
2017-06-16 15:34:53 +00:00
Nalin Dahyabhai
02f5235773 Add a quick note about state version values
Add a note that the version we record in our state file isn't
necessarily the package version, but is meant to change when we make
incompatible changes to the contents of the state file.

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

Closes: #147
Approved by: rhatdan
2017-06-14 17:47:07 +00:00
Nalin Dahyabhai
597d2ab9fa Update the version number we identify as to 0.1.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #146
Approved by: rhatdan
v0.1
2017-06-14 16:49:59 +00:00
Dan Walsh
04a9fceaae Vendor in latest container/storage
container/storage now supports remote shares and having a configuration
file.  We need to merge this to demonstrate using buildah with nfs shares.

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

Closes: #145
Approved by: nalind
2017-06-14 13:16:37 +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
7b5fed15ae Don't overwrite parent information when reading
Don't overwrite an image configuration's information about the source
image unless we're intending to create a new working container.

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
4a05d8643d Add an option to specify a Create date for images
Add CommitOption option that to allow a caller to specify a creation
timestamp to use in images.

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
af5512ab74 Allow building a source image from another image
Factor out logic that fakes up a source image using a container to be
able to do so using either a container or an image, by passing in names
and the starting layer ID directly, and by making the addition of a
history element for the layer optional (true for a container, since it's
going to add a new layer, false for an image that we're just exporting).

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
b2baeb25f4 Take a shortcut when writing to local storage
When writing to local storage, take a couple of shortcuts: instead of
recompressing layers to ensure that the values we store in the image
manifest will be correct for content-addressibility, just pretend that
the layer ID is a blob hash value, and that it's a valid layer diffID.

Local storage doesn't generally care if these values are correct, and we
already have to recompute these values when exporting an image, but this
saves us quite a bit of time.

The image library's Copy() routine actually cares about and
sanity-checks these things, so if we're going to take advantage of the
shortcuts, we need to use its higher-level APIs to write a layer, write
the configuration, and write the manifest, then move those items that it
writes to an image with the right set of layers.

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
ebf3063cf2 Make histories consistent when synthesizing images
Ensure that "created" timestamps in Images and ImageSources derived from
an image reference that we synthesize don't vary, since we want to
compute the exact same image configuration and manifest every time we
read the image using that reference.

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
5b281d7cf4 Makefile: add source deps for the CLI tool
The commit logic incorporates routines from the 'util' subdirectory, so
add it as a build-time dependency to check.

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

Closes: #141
Approved by: rhatdan
2017-06-13 21:50:42 +00:00
Nalin Dahyabhai
0d13621874 Add a --volume flag to "buildah run"
Add a --volume/-v flag to "buildah run" to allow volume bind mounts to
be specified on the command line.

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

Closes: #144
Approved by: rhatdan
2017-06-13 21:43:40 +00:00
Nalin Dahyabhai
427cc1dd0f Fix "unmount" bash completion
Fix the infinitely self-recursing, but immediately replaced, version of
the "umount" completion function with the missing "unmount" completion
function.

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

Closes: #143
Approved by: rhatdan
2017-06-12 13:42:31 +00:00
Dan Walsh
e1876db308 Vendor in latest container/storage
container/storage now supports remote shares and having a configuration
file.  We need to merge this to demonstrate using buildah with nfs shares.

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

Closes: #140
Approved by: nalind
2017-06-09 13:57:06 +00:00
Nalin Dahyabhai
c11936323a Fix inspect/tag-by-truncated-image-ID
Teach inspect and tag about image IDs, truncated and otherwise.

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

Closes: #138
Approved by: rhatdan
2017-06-08 18:31:31 +00:00
Dan Walsh
7e042a9308 Cleanup man pages
Signed-off-by: Dan Walsh <dwalsh@redhat.com>

Closes: #137
Approved by: nalind
2017-06-07 13:48:36 +00:00
Dan Walsh
33c2a8a418 gccgo is giving errors about using copy
golang-bin-1.8.1-1.fc26.x86_64
gcc-go-7.1.1-1.fc26.x86_64

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

Closes: #135
Approved by: nalind
2017-06-06 19:40:56 +00:00
Nalin Dahyabhai
45d3e7953b Use errors.Errorf() instead of fmt.Errorf()
Use Errorf() from 'errors' rather than 'fmt' to help with stack traces.

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

Closes: #130
Approved by: rhatdan
2017-06-02 16:26:46 +00:00
Nalin Dahyabhai
215ded7892 Use errors.New() instead of Wrapf() for new errors
Call errors.New() instead of calling errors.Wrapf() when there's no
error to wrap.

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

Closes: #130
Approved by: rhatdan
2017-06-02 16:26:46 +00:00