1
0
mirror of https://github.com/containers/buildah.git synced 2025-08-09 10:22:49 +03:00
Commit Graph

40 Commits

Author SHA1 Message Date
Nalin Dahyabhai
c806e6e065 Implement --squash for build-using-dockerfile and commit
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
2018-05-22 16:43:58 +00:00
Matthew Heon
a4f5707eeb Do not print directly to stdout in Commit()
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
2018-05-02 21:03:39 +00:00
Nalin Dahyabhai
44468f811c Force "localhost" as a default registry
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
2018-05-02 19:52:53 +00:00
Daniel J Walsh
3088277ee8 Add support for --iidfile to bud and commit
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
2018-04-26 12:19:43 +00:00
baude
49abf8264e Refactor buildah bud for vendoring
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
2018-04-24 20:08:51 +00:00
umohnani8
9ffd47edca Vendor in latest containers/image and containers/storage
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
2018-04-13 16:56:21 +00:00
Daniel J Walsh
b75bf0a5b3 Currently buildah run is not handling command options correctly
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
2018-02-27 12:08:45 +00:00
TomSweeneyRedHat
6c05a352df Add authfile param to commit
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #433
Approved by: rhatdan
2018-02-01 05:48:09 +00:00
TomSweeneyRedHat
9790b89771 Allow all auth params to work with bud
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #419
Approved by: rhatdan
2018-01-30 15:41:52 +00:00
Boaz Shuster
ad49b24d0b Return a better error message when failed to resolve an image
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
2018-01-24 14:03:28 +00:00
Boaz Shuster
fe2de4f491 Handle commit error gracefully
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
2018-01-15 15:48:20 +00:00
Daniel J Walsh
a3fef4879e Validate options
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
2017-09-28 17:07:03 +00:00
Daniel J Walsh
47665ad777 Cleanup buildah-commit code
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_@>
2017-09-26 18:11:26 +00:00
TomSweeneyRedHat
c9c735e20d Add authentication to commit and push
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #250
Approved by: rhatdan
2017-08-29 15:20:19 +00:00
TomSweeneyRedHat
498f0ae9d7 Add credentials to buildah from
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Add credentials to buildah from

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

Closes: #204
Approved by: nalind
2017-08-22 18:55:38 +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
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
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
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
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
12e582ee1a Report pull/commit progress by default
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
2017-05-10 12:53:25 +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
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
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
37d3ab9dca Merge pull request #26 from rhatdan/link
Remove link from CLI
2017-03-24 12:46:19 -04:00
Nalin Dahyabhai
5b8579d897 Merge pull request #25 from nalind/vendor-updates
Vendor updates
2017-03-23 16:49:24 -04:00
Daniel J Walsh
80f73013cd Remove link from CLI
We have decided not to support using the --link param in the CLI.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-23 14:59:20 -04:00
Daniel J Walsh
2ca263ad1e Default --root option to ENV BUILDAHROOT
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-22 16:33:46 -04:00
Nalin Dahyabhai
f0b508598a Update implementation to match dependencies
types.ImageSource.Close() can return an error now, and ParseImageName()
moved to containers/image/transports/alltransports.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-22 16:33:24 -04:00
Nalin Dahyabhai
9edc229948 commit: "do-not-compress" -> "disable-compression"
Rename the "commit" "--do-not-compress" flag to be called
"--disable-compression" instead.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-20 16:30:01 -04:00
Nalin Dahyabhai
ae1295b0c9 Tweak more help usage and descriptions
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-20 15:51:35 -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
f4be6fdc48 Don't mix "config" in with "run" and "commit"
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>
2017-03-17 18:46:15 -04:00
Nalin Dahyabhai
631cda1e5f Update flag Usage strings to highlight arg types
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>
2017-03-17 18:46:15 -04:00
Nalin Dahyabhai
a2ccec8c43 Catch up to the projectatomic move
Catch up import paths and docs to build correctly now that we're in
projectatomic.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-03-16 10:54:45 -04:00
Nalin Dahyabhai
83a1ec775e Clarify that we can find containers by name or ID
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>
2017-03-16 10:19:05 -04:00
Nalin Dahyabhai
0bbb076df8 Fix a copy/paste error in an error message
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>
2017-02-24 15:14:52 -05:00
Nalin Dahyabhai
0ab0890e4e Massive refactoring
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>
2017-02-10 11:48:15 -05:00
Nalin Dahyabhai
a15a927d8d Compress committed image layers by default
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>
2017-01-28 08:18:02 +01:00
Nalin Dahyabhai
02f30c773e Rename: lumper -> buildah
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-01-27 16:55:04 +01:00