229 Commits

Author SHA1 Message Date
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
Nalin Dahyabhai
9330f6b87e Mention needing runc at runtime in README.md
Closes #123.

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

Closes: #131
Approved by: nalind
2017-06-02 16:18:54 +00:00
Nalin Dahyabhai
7d2d8761e9 Include image-spec and runtime-spec versions
Include the versions from the image-spec and runtime-spec that we were
built with as part of our --version and --help output.

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

Closes: #131
Approved by: nalind
2017-06-02 16:18:54 +00:00
Dan Walsh
8ced1276e5 Change functions that use a fmt.Errorf to wrap an err to error.Wrapf
Impove error reporting by wrapping all returned err functions with
error.Wrapf

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

Closes: #124
Approved by: nalind

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

Closes: #125
Approved by: nalind
2017-06-02 14:17:04 +00:00
Dan Walsh
59dfec35c3 buildah mount command should list mounts when no arguments are given.
buildah mount should work like the mount command and list all mount points
when no options are specified.

Need buildah umount to remove mount point from the database when a mount point
is umounted.

Also remove Mounts field from the builder object.  We only support a single mount
point so no reason for this field any longer.

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

Closes: #124
Approved by: nalind
2017-06-01 18:37:40 +00:00
Nalin Dahyabhai
80ca77674c Tweak volume handling in Run()
Make sure that we don't mount a tmpfs in volume locations where Run()
has been told to mount something else.

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

Closes: #121
Approved by: rhatdan
2017-05-31 20:12:07 +00:00
Nalin Dahyabhai
3748b31c04 Defaul to the configured hostname in Run()
If Run() isn't passed a hostname to set, but we have one that was set
directly or inherited from the source image, use that value.

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

Closes: #121
Approved by: rhatdan
2017-05-31 20:12:07 +00:00
TomSweeneyRedHat
cafc73e5e0 Touch up small typo in README.md
Signed-off-by: TomSweeneyRedHat <tsweney@redhat.com>

Closes: #129
Approved by: rhatdan
2017-05-31 12:51:19 +00:00
Joshua "jag" Ginsberg
ab9bbe032b Make README dnf command copy-pastable
There are EOL spaces in the README preventing the `dnf install` command from being used in copy-pasta.

Signed-off-by: Joshua "jag" Ginsberg <jag@flowtheory.net>

Closes: #128
Approved by: rhatdan
2017-05-30 21:05:15 +00:00
TomSweeneyRedHat
2128b99ee9 Update README.md to show Dockerfile functionality
Signed-off-by: TomSweeneyRedHat <tsweney@redhat.com>

Closes: #126
Approved by: rhatdan
2017-05-30 20:57:49 +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
2048c74819 Cleanup: use FileInfo's own IsDir() method
Use os.FileInfo's IsDir() method instead of Mode().IsDir().

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

Closes: #120
Approved by: rhatdan
2017-05-24 19:48:09 +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
4b6ba974cc Make the output image format selectable
Make it possible to select the output format for Commit() and the
imagebuildah package, and wire that through to a --format option in the
CLI's "commit" and "bud" commands.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:11 +00:00
Nalin Dahyabhai
7a42d3c6d3 Learn to commit images in multiple formats
Build configuration and manifest data for both output formats that we
support, and select one or the other based on the list of manifest types
that would be accepted 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
88bf2ebdcf Also import configurations from V2S1 images
Since V2S1 image manifests don't include a config blob, when we
initialize a builder using an image with a V2S1 manifest, try to dig
configuration information out of the manifest's layer history, and build
a V2S2 image configuration using the results.

Leave the diffID list unpopulated, because we compute the right values
when we push the image, and to prevent us from mistakes if we ever try
to use them before that in the future.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:11 +00:00
Nalin Dahyabhai
b7ccc2397b Import and namespace more types
Import more manifest and schema variables and types, and rename some of
them to incorporate version numbers.

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

Closes: #118
Approved by: rhatdan
2017-05-24 18:20:10 +00:00
Nalin Dahyabhai
bdb7aff926 Makefile: add source deps for the CLI tool
The CLI tool also incorporates types from the 'docker' subdirectory, so
add it as a build-time dependency to check.

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

Closes: #117
Approved by: nalind
2017-05-23 17:32:55 +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
7a5342be8d Add more detail to errors returned from Commit()
Add some context to errors returned from the Commit() method.

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

Closes: #115
Approved by: rhatdan
2017-05-23 15:53:11 +00:00
Dan Walsh
45398cd196 Code cleanup
Other tools use --storage-opt, buildah should be consistent

Cleanup buildah.1 man page

add options to buildah man page
add missing commands

Finally sort the commands in the buildah command.

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

Closes: #112
Approved by: rhatdan
2017-05-23 15:47:15 +00:00
Nalin Dahyabhai
57e6a500d6 Make sure maps in config blobs are always created
When we decode map elements, either from our own data, or when importing
from elsewhere, maps that don't contain any keys aren't created
automatically, so we need to check, and potentially create, maps when we
want to add something to them.

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

Closes: #114
Approved by: rhatdan
2017-05-23 15:40:48 +00:00
Nalin Dahyabhai
0109d21679 Initialize the builder's annotations from OCI data
If we're building on an OCI image, initialize the Builder object's
annotations using the annotations from the source image.

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

Closes: #116
Approved by: rhatdan
2017-05-23 15:33:39 +00:00
TomSweeneyRedHat
91a7fac35b Touchup README.md with new commands and golang version
Signed-off-by: TomSweeneyRedHat <tsweney@redhat.com>

Closes: #113
Approved by: nalind
2017-05-22 19:21:37 +00:00
Nalin Dahyabhai
9bcd86d87b Fix a copy/paste error in a man page
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #111
Approved by: nalind
2017-05-19 20:34:57 +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
9865ea3660 Add ImportBuilderFromImage()
Add a function for returning a Builder initialized from an image's
metadata, but which isn't tied to a container, so it can't be saved.

This refactored the existing importBuilder() implementation to split the
bits which locate the image based on the information it's given about a
container from the bits which build the structure using information read
from the image.

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

Closes: #109
Approved by: rhatdan
2017-05-19 11:29:12 +00:00
Nalin Dahyabhai
6f4bd94b95 Update reference comments for docker types origins
Update comments which reference where the types in docker/types.go came
from to reflect renames of the upstream repositories.  The contents of
the types themselves, since they are encoded into images that are kept
on disk, shouldn't change often, if ever.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00
Nalin Dahyabhai
f32f6662d9 Improve configuration preservation in imagebuildah
Preserve and pass in more container configuration settings when
initializing and imagebuildah object, and pull more settings back out
when committing an image.  This should fix most of #97.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00
Nalin Dahyabhai
828df7b054 imagebuildah: Bail out earlier on bad target parse
When we attempt to commit an image, if we encounter an error parsing the
destination location, return an error before logging that we're in the
COMMIT step.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00
Nalin Dahyabhai
fc880bcc86 Maintain multiple working container configs
Maintain the container configuration in multiple formats in the Buildah
object, initializing one based on the other, depending on which format
the source image used for its configuration.

Replace directly manipulated fields in the Buildah object (Annotations,
CreatedBy, OS, Architecture, Maintainer, User, Workdir, Env, Cmd,
Entrypoint, Expose, Labels, and Volumes) with accessor functions which
update both configurations and which read from whichever one we consider
to be authoritative.  Drop Args because we weren't using them.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00
Nalin Dahyabhai
58e56e3efc Import container.{Config,HealthCheck},nat.PortSet
Import the container.Config and container.HealthCheck API types, and the
nat.Port and nat.PortSet types from go-connections.  Use the strslice
package from containers/image instead of rolling or importing our own.

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

Closes: #102
Approved by: rhatdan
2017-05-18 18:28:44 +00:00