Commit Graph

1452 Commits

Author SHA1 Message Date
Zhou Hao fa8991f732 add test to inspect
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #725
Approved by: rhatdan
2018-05-28 11:48:20 +00:00
umohnani8 25f4e8ec63 buildah bud picks up ENV from base image
buildah bud was not picking up the ENV from the base image
as it was being cleared. Fixes buildah bud to pick up the ENV.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #720
Approved by: rhatdan
2018-05-24 21:10:36 +00:00
Nalin Dahyabhai 2b18391384 Add tests for namespace control flags
Test that the --ipc, --net/--network, --pid, --userns, --uts options can
be used to control whether or not we create new namespaces of those
types in "buildah run".

Test that when ID mappings are not specified, we default to not using a
new user namespace, but when ID mappings are specified, we create a new
user namespace and ID mappings are set correctly in the running
container.

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

Closes: #700
Approved by: rhatdan
2018-05-24 14:10:01 +00:00
Nalin Dahyabhai 8e0fc35541 copy.bats: check ownerships in the container
When testing the --chown flag, expect ownership of content that we copy
in while specifying an owner to match the IDs of that owner as the
container knows them.

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

Closes: #700
Approved by: rhatdan
2018-05-24 14:10:01 +00:00
Nalin Dahyabhai 7860497e33 Fix SELinux test errors when SELinux is enabled
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #700
Approved by: rhatdan
2018-05-24 14:10:01 +00:00
pixdrift 40325d3e31 Additional bud CI tests
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #702
Approved by: rhatdan
2018-05-23 00:22:08 +00:00
Nalin Dahyabhai 71f0f9d063 build-using-dockerfile: add --annotation
Add an --annotation flag to "buildah build-using-dockerfile".

Refactor the logic for --label handling to use SetLabel() to set them in
the image configuration in Executor.Commit(), instead of passing them as
a field in CommitOptions for Builder.Commit() and expecting it to do so.

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

Closes: #716
Approved by: rhatdan
2018-05-22 19:27:45 +00:00
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
Zhou Hao 858bd4fc71 add test to inspect
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #715
Approved by: rhatdan
2018-05-22 13:19:07 +00:00
Nalin Dahyabhai 8b9c777a2e Test with Go 1.10, too
And teach govet.sh about build tags.

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

Closes: #711
Approved by: rhatdan
2018-05-21 19:31:58 +00:00
Nalin Dahyabhai 691451c269 bud.bats: print "$output" before checking its contents
Output the output of a command that we "run" before checking it over, so
that if the check fails, we'll see what we actually got.  Also check the
exit status of a couple of 'images -q' runs that we weren't.

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

Closes: #708
Approved by: rhatdan
2018-05-19 07:55:09 +00:00
Nalin Dahyabhai 8db406b683 util.ResolveName(): handle completion for tagged/digested image names
When checking if an image name includes a registry name, when checking
for cases where parsing it inserts additional path components, handle
cases where the name includes a tag or digest component.

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

Closes: #710
Approved by: rhatdan
2018-05-19 07:53:10 +00:00
Nalin Dahyabhai e9a2fd3498 Make it easier to parse our temporary directory as an image name
Make it easier to parse our temporary directory's name as an image name,
by making sure that we don't add '.' unnecessarily.

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

Closes: #705
Approved by: rhatdan
2018-05-18 17:25:07 +00:00
Daniel J Walsh 02cc30ba17 Add support for buildah bud --label
We want to be able to add labels when building a container image.

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

Closes: #698
Approved by: umohnani8
2018-05-18 14:03:35 +00:00
umohnani8 2749191a5f buildah push/from can push and pull images with no reference
pushing with format <transport>:<path> is valid now.
Add support to pull images from oci-archive that have no image ref name.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #697
Approved by: rhatdan
2018-05-16 18:49:37 +00:00
Tom Sweeney 3e320b9ae4
Merge pull request #688 from pixdrift/env-ci
Add buildah bud CI tests for ENV variables
2018-05-15 11:37:46 -04:00
pixdrift 88c649e60e Add buildah bud CI tests for ENV variables
Signed-off-by: pixdrift <support@pixeldrift.net>
2018-05-15 22:34:14 +10:00
pixdrift 8515867443 Re-enable rpm .spec version check and new commit test
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #681
Approved by: rhatdan
2018-05-14 21:28:08 +00:00
TomSweeneyRedHat b9a1041b18 Update to F28 and new run format in baseline test
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #678
Approved by: rhatdan
2018-05-11 17:52:39 +00:00
pixdrift e17534d816 Add cpu-shares short flag (-c) and cpu-shares CI tests
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #670
Approved by: rhatdan
2018-05-10 15:52:19 +00:00
pixdrift 14837e2441 CI tests and minor fix for cache related noop flags
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #667
Approved by: ripcurld
2018-05-08 12:46:45 +00:00
pixdrift dd02e709d6 Add buildah bud ENTRYPOINT,CMD,RUN tests
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #656
Approved by: rhatdan
2018-05-06 11:05:59 +00:00
pixdrift 0ce647b4e8 Adding buildah bud RUN test scenarios
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #656
Approved by: rhatdan
2018-05-06 11:05:59 +00:00
pixdrift 6fda3dc3ae Extend tests for empty buildah run command
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #656
Approved by: rhatdan
2018-05-06 11:05:59 +00:00
pixdrift 24a4c1e2c0 Update buildah run to make command required
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #656
Approved by: rhatdan
2018-05-06 11:05:59 +00:00
pixdrift b65a41f391 Expanding buildah run cmd/entrypoint tests
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #656
Approved by: rhatdan
2018-05-06 11:05:59 +00:00
pixdrift 32c0cba081 Update test cases for buildah run behaviour
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #656
Approved by: rhatdan
2018-05-06 11:05:59 +00:00
Zhou Hao 6fe2b551d7 tests/config: perfect test
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #650
Approved by: rhatdan
2018-05-03 11:56:12 +00:00
Zhou Hao c213178419 tests/from: add name test
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #651
Approved by: rhatdan
2018-05-03 11:55:15 +00:00
TomSweeneyRedHat e130f2bef3 Touch up auth test commands
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #652
Approved by: rhatdan
2018-05-02 20:38:32 +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
Zhou Hao 579103a25c test/from: add add-host test
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #644
Approved by: rhatdan
2018-04-30 14:35:31 +00:00
Nalin Dahyabhai 523b1095d8 Add config --comment/--domainname/--history-comment/--hostname
Add options to "buildah config" for setting comment, domainname, and
hostname configuration bits, and the comment in history items which
describe layers that we add, and tests for them.  Add a test for the
--shell option while we're at it.

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

Closes: #641
Approved by: rhatdan
2018-04-27 16:33:13 +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
TomSweeneyRedHat b16a1eac07 Add /bin/sh -c to entrypoint in config
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #596
Approved by: rhatdan
2018-04-23 19:06:19 +00:00
Daniel J Walsh 37ecc5d42a Simple changes to allow buildah to pass make validate
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #606
Approved by: rhatdan
2018-04-20 09:57:35 +00:00
Daniel J Walsh e008b736ac Clarify the use of buildah config options
Make it clearer to the user which options can be executed
multiple times, versus those that can only used once.

Cleanup some documentation issues

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

Closes: #592
Approved by: rhatdan

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

Closes: #602
Approved by: pixdrift
2018-04-19 10:42:45 +00:00
umohnani8 83d7d100df Modify buildah rmi to account for changes in containers/storage
containers/storage now returns a copy of the image state, so need to
refetch the new state whenever we make a change such as untagging.
Also added more tests for buildah rm.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #578
Approved by: rhatdan
2018-04-13 16:56:21 +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
umohnani8 532e267a58 Fix secrets patch
The secrets code was just tarring and copying the contents of the secrets directory on host as is.
This meant it was not accounting for any symlinks inside the directory, leading up to the contents
not being copied over.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #582
Approved by: rhatdan
2018-04-12 20:27:36 +00:00
pixdrift 15e1054820 Update entrypoint behaviour to match docker
Signed-off-by: pixdrift <support@pixeldrift.net>

Closes: #577
Approved by: rhatdan
2018-04-12 16:27:11 +00:00
Zhou Hao f2c532a958 config: add support for StopSignal
Add a stop-singnal option for buildah-config.

Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #567
Approved by: rhatdan
2018-04-12 06:58:26 +00:00
Fabio Bertinatto 6f7d05bcf6 Allow referencing stages as index and names
Signed-off-by: Fabio Bertinatto <fbertina@redhat.com>

Closes: #495
Approved by: nalind
2018-04-10 21:04:29 +00:00
Fabio Bertinatto d46d16c6df Add multi-stage builds tests
Signed-off-by: Fabio Bertinatto <fbertina@redhat.com>

Closes: #495
Approved by: nalind
2018-04-10 21:04:29 +00:00
TomSweeneyRedHat 6583273185 Allow umount to have multi-containers
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #561
Approved by: rhatdan
2018-04-08 13:07:37 +00:00
umohnani8 f5a76e0029 buildah bud walks symlinks
After a symlink is created, buildah bud would fail if the symlink was
mounted as a volume.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #541
Approved by: ripcurld
2018-04-05 20:02:31 +00:00
Daniel J Walsh 5ce80091ba Add support for shell
Also vendor in the latest imagebuilder code and all the packages
that come with it.

Note: imagebuilder.NewBuilderForReader has been removed from imagebuilder
so I had to split the function up into two different calls.

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

Closes: #517
Approved by: rhatdan
2018-04-03 22:25:56 +00:00
umohnani8 1ca41dcbcb Add various transport support to buildah from
buildah from now supports pulling images using the following transports:
docker-archive, oci-archive, and dir.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #524
Approved by: TomSweeneyRedHat
2018-03-22 17:22:47 +00:00
Boaz Shuster 5b4389cf69 Show Config/Manifest as JSON string in inspect when format is not set
In https://github.com/projectatomic/buildah/issues/363:
Config and Manifest are displayed as a string representing JSON
only when "--format" is set. However, this is necessary too if
"--format" is not set.

This patch fixes this by using the same technique above
to make the representation of Manifest and Config consistent.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #522
Approved by: rhatdan
2018-03-20 09:21:22 +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 cb42905a7f Add selinux test from #486
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #501
Approved by: rhatdan
2018-02-27 00:47:42 +00:00
umohnani8 4bbe6e7cc0 Implement --volume and --shm-size for bud and from
Add the remaining --volume and --shm-size flags to buildah bud and from
--volume supports the following options: rw, ro, z, Z, private, slave, shared

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #491
Approved by: rhatdan
2018-02-23 17:53:00 +00:00
baude e623e5c004 Initial ginkgo framework
This is an initial attempt at bringing in the ginkgo test framework into
buildah.  The inspect bats file was also imported.

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

Closes: #472
Approved by: rhatdan
2018-02-22 13:06:08 +00:00
umohnani8 93a3c89943 Add the following flags to buildah bud and from
--add-host
	--cgroup-parent
	--cpu-period
	--cpu-quota
	--cpu-shares
	--cpuset-cpus
	--cpuset-mems
	--memory
	--memory-swap
	--security-opt
	--ulimit

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #477
Approved by: rhatdan
2018-02-19 17:00:29 +00:00
TomSweeneyRedHat ee383ec9cf Add redis test to baseline
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #476
Approved by: nalind
2018-02-14 14:18:08 +00:00
Boaz Shuster f29314579d Return multi errors in buildah-rm
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #458
Approved by: rhatdan
2018-02-12 12:02:37 +00:00
Nalin Dahyabhai 6b207f7b0c Fix unintended reversal of the ignoreUnrecognizedInstructions flag
We were interpreting the ignoreUnrecognizedInstructions incorrectly, so
fix that, and call out the unrecognized instruction keyword in the error
message (or debug message, if we're ignoring it).

Should fix #451.

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

Closes: #452
Approved by: rhatdan
2018-02-06 18:58:25 +00:00
Nalin Dahyabhai c35493248e build-using-dockerfile: set the 'author' field for MAINTAINER
When we encounter the MAINTAINER keyword in a Dockerfile, imagebuilder
updates the Author field in the imagebuilder.Builder structure.  Pick up
that value when we go to commit the image.

Should fix #448.

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

Closes: #450
Approved by: rhatdan
2018-02-06 01:18:55 +00:00
Boaz Shuster fbb8b702bc Return exit code 1 when buildah-rmi fails
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #412
Approved by: rhatdan
2018-02-05 13:50:30 +00:00
Boaz Shuster 815cedfc71 Trim the image reference to just its name before calling getImageName
When setting a container name the getImageName function goes through
all the names of the resolved image and finds the name that contains
the given name by the user.

However, if the user is specifying "docker.io/tagged-image"
the Docker transport returns "docker.io/library/tagged-image" which
makes getImageName returns the original image name because it does
not find a match.

To resolve this issue before calling getImageName the image given
by the user will be trimmed to be just the name.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #422
Approved by: rhatdan
2018-02-04 11:26:43 +00:00
TomSweeneyRedHat 1c97f6ac2c Bump Fedora 26 to 27 in rpm test
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #444
Approved by: rhatdan
2018-02-04 11:25:25 +00:00
Arthur Mello 49095a83f8 Add --prune,-p option to rmi command
Allows rmi to remove all dangling images (images without a tag and without a child image)
Add new test case

Signed-off-by: Arthur Mello <amello@redhat.com>

Closes: #418
Approved by: rhatdan
2018-02-01 10:50:33 +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
Fabio Bertinatto 61f5319504 Don't overwrite directory permissions on --chown
Signed-off-by: Fabio Bertinatto <fbertina@redhat.com>

Closes: #389
Approved by: rhatdan
2018-01-30 05:09:06 +00:00
Boaz Shuster 947714fbd2 Unescape HTML characters output into the terminal
By default, the JSON encoder from the Go standard library
escapes the HTML characters which causes the maintainer output
looks strange:

"maintainer": "NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e"
Instead of:
"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"

This patch fixes this issue in "buildah-inspect" only as this is
the only place that such characters are displayed.

Note: if the output of "buildah-inspect" is piped or redirected
then the HTML characters are not escaped.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #421
Approved by: rhatdan
2018-01-30 04:51:17 +00:00
Boaz Shuster b68f88c53d Fix: setting the container name to the image
In commit 47ac96155f the image name that is used
for setting the container name is taken from the resolved image
unless it is empty.

The image has the "Names" field and right now the first name is
taken. However, when the image is a tagged image, the container name
will end up using the original name instead of the given one.

For example:

$ buildah tag busybox busybox1
$ buildah from busybox1

Will set the name of the container as "busybox-working-container"
while it was expected to be "busybox1-working-container".

This patch fixes this particular issue.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>

Closes: #399
Approved by: rhatdan
2018-01-26 08:07:58 +00:00
TomSweeneyRedHat 5179733c63 Update auth tests and fix bud man page
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #404
Approved by: rhatdan
2018-01-22 13:34:50 +00:00
TomSweeneyRedHat fd995e6166 Add --all functionality to rmi
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #384
Approved by: rhatdan
2018-01-08 21:07:25 +00:00
Nalin Dahyabhai 86fa0803e8 Sanity check the history/diffid list sizes
When building an image's config blob, add a sanity check that the number
of diffIDs that we're including matches the number of entries in the
history which don't claim to be empty layers.

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

Closes: #383
Approved by: rhatdan
2018-01-08 21:06:35 +00:00
Daniel J Walsh 9f5e1b3a77 Make lint was complaining about some vetshowed err
We often use err as a variable inside of subblocks, and
we don't want golint to complain about it.

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

Closes: #379
Approved by: nalind
2018-01-03 21:10:28 +00:00
TomSweeneyRedHat c77a8d39f1 Create Registry in Docker for Travis CI
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #290
Approved by: rhatdan
2017-12-18 21:26:57 +00:00
Nalin Dahyabhai a5129ec3eb Add a test that 'rmi' works with truncated image IDs
Add a test to ensure that 'buildah rmi' works if passed a truncated
version of an image's ID.

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

Closes: #361
Approved by: rhatdan
2017-12-15 12:13:47 +00:00
Nalin Dahyabhai 47ac96155f Use configured registries to resolve image names
When locating an image for pulling, inspection, or pushing, if we're
given an image name that doesn't include a domain/registry, try building
a set of candidate names using the configured registries as domains, and
then pull/inspect/push using the first of those names that works.

If a name that we're given corresponds to a prefix of the ID of a local
image, skip completion and use the ID directly instead.

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

Closes: #360
Approved by: rhatdan
2017-12-14 22:21:16 +00:00
Nalin Dahyabhai 8b2b56d9b8 Update to work with newer image library
Update shallowCopy() to work with the newer version of image.
Remove things from Push() that we don't need to do any more.
Preserve digests in image names, make sure we update creation times, and
add a test to ensure that we can pull, commit, and push using such names
as sources.

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

Closes: #187
Approved by: rhatdan
2017-12-14 20:57:13 +00:00
Daniel J Walsh bf01a80b2b
Merge pull request #349 from TomSweeneyRedHat/dev/tsweeney/baseline2
Touchup baseline and rpm tests
2017-12-11 12:00:57 -06:00
Fabio Bertinatto 1fc5a49958 Add --chown option to add/copy commands
Signed-off-by: Fabio Bertinatto <fbertina@redhat.com>

Closes: #336
Approved by: rhatdan
2017-12-07 13:45:12 +00:00
TomSweeneyRedHat aae843123f Touchup baseline and rpm tests
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-12-06 11:14:09 -05:00
TomSweeneyRedHat ee9b8cde5a Create rpm and baseline test script
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #346
Approved by: rhatdan
2017-12-04 17:01:00 +00:00
Nalin Dahyabhai 2dd03d6741 tests/rpm.bats: use Fedora 27
Update tests/rpm.bats to use Fedora 27.

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

Closes: #342
Approved by: rhatdan
2017-12-01 13:22:58 +00:00
TomSweeneyRedHat 1680a5f0a0 Fix iterator and a few typos in baseline test
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #335
Approved by: rhatdan
2017-12-01 00:02:53 +00:00
TomSweeneyRedHat 5dd1a5f3c9 Touchup test scripts for some minor nits
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #335
Approved by: rhatdan
2017-12-01 00:02:53 +00:00
TomSweeneyRedHat 15792b227a Allow push to use the image id
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #341
Approved by: nalind
2017-11-30 23:47:13 +00:00
Nalin Dahyabhai a99d5f0798 Bump the GIT_VALIDATION_EPOCH to a newer version
Bump the GIT_VALIDATION_EPOCH in tests/validate/git-validation.sh to a
later commit.

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

Closes: #340
Approved by: rhatdan
2017-11-28 19:39:37 +00:00
TomSweeneyRedHat 4b23819189 Touchup test scripts for some minor nits
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #330
Approved by: rhatdan
2017-11-21 15:39:39 +00:00
TomSweeneyRedHat 9fa477e303 Create baseline test script
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2017-11-19 14:27:38 -05:00
Urvashi Mohnani 4419612150 Add manifest type conversion to buildah push
buildah push supports manifest type conversion when pushing using the 'dir' transport
Manifest types include oci, v2s1, and v2s2
e.g buildah push --format v2s2 alpine dir:my-directory

Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>

Closes: #321
Approved by: rhatdan
2017-11-15 13:38:28 +00:00
Nalin Dahyabhai 0df1c44b12 tests: check $status whenever we use run
Always be sure to check $status after using the run helper.

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

Closes: #313
Approved by: rhatdan
2017-11-10 09:58:08 +00:00
Nalin Dahyabhai 75fbb8483e Test that "run" fails with unresolvable names
Add a test that makes sure that "buildah run" fails if it can't resolve
the name of the user for the container.

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

Closes: #313
Approved by: rhatdan
2017-11-10 09:58:08 +00:00
Nalin Dahyabhai c83cd3fba9 Accept numeric USER values with no group ID
Change our behavior when we're given USER with a numeric UID and no GID,
so that we no longer error out if the UID doesn't correspond to a known
user so that we can use that user's primary GID.  Instead, use GID 0.

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

Closes: #313
Approved by: rhatdan
2017-11-10 09:58:08 +00:00
Nalin Dahyabhai d41ac23a03 Add a test for USER symlink resolution
Add a test that makes sure we catch cases where we attempt to open a
file in the container's tree that's actually a symlink that points out
of the tree.

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

Closes: #313
Approved by: rhatdan
2017-11-10 09:58:08 +00:00
Nalin Dahyabhai 0a44c7f162 "run --hostname test": do less setup
We don't need to mount the container for this test or add files to it,
and switching to a smaller base image that already includes a "hostname"
command means we don't need to run a package installer in the container.

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

Closes: #320
Approved by: nalind
2017-11-09 20:27:58 +00:00
Nalin Dahyabhai b12735358a "run --hostname test": print $output more
Make it easier to troubleshoot the "run --hostname" test.

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

Closes: #320
Approved by: nalind
2017-11-09 20:27:58 +00:00
Nalin Dahyabhai 318beaa720 integration tests: default to /var/tmp
Default to running integration tests using /var/tmp as scratch space,
since it's more likely to support proper SELinux labeling than /tmp,
which is more likely to be on a tmpfs.

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

Closes: #320
Approved by: nalind
2017-11-09 20:27:57 +00:00
Daniel J Walsh 3e8ded8646 Add secrets patch to buildah
Signed-off-by: umohnani8 <umohnani@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-11-08 00:01:57 +00:00
Daniel J Walsh 966f32b2ac Add proper SELinux labeling to buildah run
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #294
Approved by: nalind
2017-11-07 22:40:29 +00:00
TomSweeneyRedHat 515386e1a7 Fix for rpm.bats test issue
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #303
Approved by: nalind
2017-10-30 20:04:51 +00:00
Daniel J Walsh 8ecefa978c Vendor in changes to support sirupsen/logrus
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-10-10 17:30:11 +00:00
Daniel J Walsh 62fc48433c Add support for `buildah run --hostname`
Need to set the hostname inside of a container.

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

Closes: #266
Approved by: nalind
2017-09-24 09:55:24 +00:00
TomSweeneyRedHat 1d0b48d7da Add default transport to push if not provided
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #260
Approved by: rhatdan
2017-09-21 21:02:23 +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
Daniel J Walsh 52087ca1c5 Remove --transport flag
This is no simpler then putting the transport in the image page,
we should default to the registry specified in containers/image
and not override it.  People are confused by this option, and I
see no value.

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

Closes: #234
Approved by: rhatdan
2017-08-29 10:37:54 +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 ee91e6b981 Remove export command
We have implemented most of this code in kpod export, and we now
have kpod import/load/save.  No reason to implement them in both
commands.

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

Closes: #245
Approved by: nalind
2017-08-17 19:40:47 +00:00
Nalin Dahyabhai 94f2bf025a Replace --registry with --transport
Replace --registry command line flags with --transport.  For backward
compatibility, add Transport as an addtional setting that we prepend to
the still-optional Registry setting if the Transport and image name
alone don't provide a parseable image reference.

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

Closes: #235
Approved by: rhatdan
2017-08-03 15:55:13 +00:00
Nalin Dahyabhai 262b43a866 Improve "from" behavior with unnamed references
Fix our instantiation behavior when the source image reference is not a
named reference.

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

Closes: #235
Approved by: rhatdan
2017-08-03 15:55:13 +00:00
Nalin Dahyabhai 83fe25ca4e Turn on --enable-gc when running gometalinter
It looks like the metalinter is running out of memory while running
tests under PAPR, so give this a try.

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

Closes: #221
Approved by: rhatdan
2017-07-26 17:43:05 +00:00
Nalin Dahyabhai b7e9966fb2 Make sure that we can build an RPM
Add a CI test that ensures that we can build an RPM package on the
current version (as of this writing, 26) of Fedora, using the .spec file
under contrib.

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

Closes: #208
Approved by: jlebon
2017-07-25 21:03:38 +00:00
Nalin Dahyabhai fd7762b7e2 Try to enable "run" tests in CI
Try to ensure that we have runc, so that we can test the "run" command
in CI.  In the absence of a compatible packaged version of runc, we may
have to build our own.

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

Closes: #202
Approved by: rhatdan
2017-07-24 13:03:42 +00:00
Nalin Dahyabhai e92020a4db Keep the version in the .spec file current
Add a test to compare the version we claim to be with the version
recorded in the RPM .spec file.

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

Closes: #202
Approved by: rhatdan
2017-07-24 13:03:42 +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
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