Handle a Squash option when committing images, and make it available as
a flag for "buildah commit" and "buildah build-using-dockerfile".
Breaks up containerImageRef.NewImageSource to keep the complexity more
manageable.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #714
Approved by: rhatdan
Buildah is being used as a library in Podman, and as such should
avoid printing directly to standard streams. Instead, return an
image ID which can be printed by the caller (if desired)
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #647
Approved by: rhatdan
Extend util.ResolveName() to prepend "localhost" to the list of
registries, and teach util.FindImage(), util.ExpandNames(), and
util.AddImageNames() to use util.ResolveName().
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Closes: #648
Approved by: rhatdan
Add support for an --iidfile which specifies the file to write the
image id, when committing a new image.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #636
Approved by: TomSweeneyRedHat
Projects like libpod would benefit greatly if we could vendor in buildah
rather than execing it. This refactor moves some of the key parsing
functions that buds uses to pkg/parse so that the project vendoring
buildah can also benefit from them.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #608
Approved by: rhatdan
Changes to paramters in functions.
Change to the error returned by the oci and oci-archive transport.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #578
Approved by: rhatdan
This patch will allow commands like
buildah run $ctr ls -lZ /
To work correctly.
Need to update vendor of urfave cli.
Also changed all commands to no longer accept global options after the COMMAND.
Single boolean options can now be passed together.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #493
Approved by: rhatdan
During the creation of a new builder object there are errors
that are only logged into "logrus.Debugf".
If in the end of the process "ref" or "img" are nil and "options.FromImage"
is set then it means that there was an issue.
By default, it was assumed that the image name is wrong. Yet,
this assumption isn't always correct. For example, it might fail due to
authorization or connection errors.
In this patch, I am attempting to fix this problem by checking the
last error stored in the "err" variable and returning the cause
of the failure.
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Closes: #406
Approved by: rhatdan
This change gives a better error message when the commit fails
because of bad authentication.
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Closes: #385
Approved by: rhatdan
If an string option is passed in, and it is not followed by a value,
then error out with a message saying the option requires a value.
For example
buildah from --creds --pull dan
option --creds requires a value
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #270
Approved by: rhatdan
1. Sort options so they are in alphabet order
2. Remove extra lines of code for options parsing that really do not accomplish anything.
3. Remove variables when they are not necessary, I.E. Don't create a variable to hold an
option that is only used once, use the option instead.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #267
Approved by: <username_without_leading_@>
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
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
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
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
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
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
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
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
types.ImageSource.Close() can return an error now, and ParseImageName()
moved to containers/image/transports/alltransports.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
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>
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>
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>
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>
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>
Pull most of the core logic from the CLI into a package that should be
easier to consume as a library. Add a "config" command that updates the
builder object's configuration.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When committing an image, default to compressing the layer using Gzip.
This can lead to problems pulling the image back out of
containers/storage if the package that pulls it out was built using a
different version of go, but it works around a problem where
containers/image might not be able to detect that an uncompressed layer
is actually a layer.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>