Commit Graph

1811 Commits

Author SHA1 Message Date
Daniel J Walsh c46f6e0321 Update vendor of containers/common to v0.1.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #2087
Approved by: giuseppe
2020-01-16 13:50:07 +00:00
Lokesh Mandvekar b09fdc33e8 update install instructions for Debian, Raspbian and Ubuntu
Resolves: #1918

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>

Closes: #2088
Approved by: rhatdan
2020-01-16 12:59:45 +00:00
Daniel J Walsh 09d1c24e3d Add support for containers.conf
This is a rework of Qi Wang's patches.
Import package pkg/config from containers/common to read containers.conf
This patch allows users to specify default values stored in containers.conf
that will modify the behaviour of buildah tool.

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

Closes: #2011
Approved by: TomSweeneyRedHat
2020-01-15 17:24:36 +00:00
TomSweeneyRedHat bf14e6ca2d Bump back to v1.14.0-dev
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #2081
Approved by: rhatdan
2020-01-14 17:27:04 +00:00
TomSweeneyRedHat e8c07c6eac Bump to v1.13.1
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #2081
Approved by: rhatdan
2020-01-14 17:27:04 +00:00
dependabot-preview[bot] 720e5d6309 Bump github.com/containers/common from 0.0.5 to 0.0.7
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.0.5 to 0.0.7.
- [Release notes](https://github.com/containers/common/releases)
- [Commits](https://github.com/containers/common/compare/v0.0.5...v0.0.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Closes: #2078
Approved by: TomSweeneyRedHat
2020-01-13 21:03:17 +00:00
dependabot-preview[bot] b7e67317db Bump github.com/onsi/ginkgo from 1.10.3 to 1.11.0
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.10.3 to 1.11.0.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.10.3...v1.11.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Closes: #2079
Approved by: rhatdan
2020-01-13 19:25:50 +00:00
dependabot-preview[bot] f7731c2dee Bump github.com/pkg/errors from 0.8.1 to 0.9.0
Bumps [github.com/pkg/errors](https://github.com/pkg/errors) from 0.8.1 to 0.9.0.
- [Release notes](https://github.com/pkg/errors/releases)
- [Commits](https://github.com/pkg/errors/compare/v0.8.1...v0.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Closes: #2077
Approved by: @TomSweeneyRedHat
2020-01-13 16:37:23 +00:00
Daniel J Walsh 9def9c06cb
Merge pull request #2071 from rhatdan/codespell
Add codespell support
2020-01-13 10:57:47 -05:00
dependabot-preview[bot] 3af1491885 Bump github.com/onsi/gomega from 1.7.1 to 1.8.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.7.1 to 1.8.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.7.1...v1.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Closes: #2080
Approved by: TomSweeneyRedHat
2020-01-13 14:54:53 +00:00
Daniel J Walsh af05f5aa3c
Add codespell support
Check codespell on each PR in make validate.

Add fixes for issues found with codespell.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-01-10 12:12:30 -05:00
Daniel J Walsh 4e23b7a10c
Merge pull request #2073 from vrothberg/travis
Travis: rm go 1.12.x
2020-01-09 12:56:34 -05:00
Nalin Dahyabhai 55fa8f5a46 copyFileWithTar: close source files at the right time
Close source files after we've finished reading from them, rather than
leaving it for later.

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

Closes: #2072
Approved by: giuseppe
2020-01-09 11:10:24 +00:00
Nalin Dahyabhai 8c255bc1cc copy: don't digest files that we ignore
Don't start digesting the contents of any file that we end up skipping.

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

Closes: #2072
Approved by: giuseppe
2020-01-09 11:10:24 +00:00
Nalin Dahyabhai 9b35b5e3d2 Check for .dockerignore specifically
When generating the list of exclusions to process .dockerignore
contents, don't include .dockerignore if we don't have a .dockerignore
file in the context directory.  That way, if the file doesn't exist, and
the caller didn't pass in any patterns, we get no patterns instead of
just one ".dockerignore" pattern, and we can hit the faster copy path.

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

Closes: #2072
Approved by: giuseppe
2020-01-09 11:10:24 +00:00
Valentin Rothberg 432297d56d Travis: rm go 1.12.x
Remove go 1.12.x from the testing matrix to consume less resources from
Travis and save some energy.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-01-09 10:51:06 +01:00
Daniel J Walsh 47ce18b63c Don't setup excludes, if their is only one pattern to match
We are always adding .dockerignore to the pattern list, if this is the only pattern
then no patterns we added to the list, and we should return nil.

This is causing a major slowdown in buildah, since it is not using the optimized tar for
copying.

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

Closes: #2070
Approved by: saschagrunert
2020-01-08 12:49:37 +00:00
Boaz Shuster a3dec025f3 set HOME env to /root on chroot-isolation by default
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>

Closes: #2057
Approved by: rhatdan
2020-01-08 10:55:40 +00:00
Ed Santiago b555b7dfc6 docs: fix references to containers-*.5
Fix man page instances of 'registries.conf(5)' et al.
The correct man page is containers-registries.conf(5).

Found via:

  $ for i in registries.conf storage.conf policy.json ; do grep $i.5 docs/*.md | grep -v containers-$i;done

In buildah.md, I simply removed the storage.conf line from
the 'Commands' table because it's not a command.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2068
Approved by: TomSweeneyRedHat
2020-01-08 02:45:01 +00:00
Valentin Rothberg e7be041dad update openshift/api
Update the openshift/api dependency to the latest commit. Several users
have reported that the go.mod couldn't be parsed, which should now be
fixed.

Fixes: #2042
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Closes: #2066
Approved by: rhatdan
2020-01-08 01:42:36 +00:00
Qi Wang dbec497140 fix bug Add check .dockerignore COPY file
fix bug that buildah does not check .dockerignore file if source of COPY instruction is a filepath. This patch will skip the path if the overall result of the dockerignore matcher is true.

Signed-off-by: Qi Wang <qiwan@redhat.com>

Closes: #2064
Approved by: rhatdan
2020-01-07 14:14:13 +00:00
Ed Santiago 45543bf9b2 buildah bud --volume: run from tmpdir, not source dir
PR #2039 broke system tests, because they're installed in /usr:

   # buildah bud -v /usr/share/buildah/test/system:/testdir:rw,z /usr/share/buildah/test/system/bud/mount
   ...
   error building at STEP "RUN mount": error resolving mountpoints for container "173c5e567e95f2604b5ea677f5e5364839d5b455a9081cdb4101f20242997e5e": relabeling "/usr/share/buildah/test/system" failed: relabeling content in /usr is not allowed

Solution: mount a volume from TESTDIR (singular), which is in TMPDIR,
not TESTSDIR (plural), which is our test source dir.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2065
Approved by: vrothberg
2020-01-07 09:29:52 +00:00
Boaz Shuster d792c70fc9 Fix imageNamePrefix to give consistent names in buildah-from
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>

Closes: #2062
Approved by: TomSweeneyRedHat
2020-01-06 16:39:05 +00:00
Valentin Rothberg 20c2a545b9 cpp: use -traditional and -undef flags
@tanzislam noted [1] that Buildah should be using the -traditional flag
to prevent CPP from removing trailing backslashes in non-directive lines
and the -undef flag to prevent built-in macros from expansion (e.g.,
"linux" to "1").

[1] https://github.com/moby/moby/issues/735#issuecomment-568720297

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>

Closes: #2044
Approved by: TomSweeneyRedHat
2020-01-06 14:29:08 +00:00
Laurent Stacul c42f440f98 Fix image reference in tutorial 4
Signed-off-by: Laurent Stacul <laurent.stacul@gmail.com>

Closes: #2059
Approved by: rhatdan
2020-01-04 01:42:21 +00:00
Boaz Shuster 8d41b83622 discard outputs coming from onbuild command on buildah-from --quiet
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>

Closes: #2055
Approved by: rhatdan
2020-01-03 14:20:41 +00:00
Boaz Shuster 726e24d5e5 make --format columnizing consistent with buildah images
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>

Closes: #2052
Approved by: rhatdan
2019-12-29 10:49:45 +00:00
TomSweeneyRedHat 4b5437a981 Bump to v1.14.0-dev
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #2053
Approved by: rhatdan
2019-12-28 11:28:25 +00:00
TomSweeneyRedHat 57bd81884c Bump to v1.13.0
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #2053
Approved by: rhatdan
2019-12-28 11:28:25 +00:00
TomSweeneyRedHat a15607b862 Bump to c/storage v1.15.5
Bumping c/storage to v1.15.5.  Once merged I'll spin up
a Buildah v1.13.0

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

Closes: #2050
Approved by: rhatdan
2019-12-27 13:41:47 +00:00
Daniel J Walsh cf34522a2e Update container/storage to v1.15.4
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #2043
Approved by: TomSweeneyRedHat
2019-12-24 12:24:28 +00:00
TomSweeneyRedHat 6941254c29 Fix option handling for volumes in build
If the volume option was specified like: `--volume "${HOME}/.cache/zae9ujei:/myvol:rw,Z"`,
the COBRA code that processed the input from the user was considering the value to be a
SliceVar with two volumes `${HOME}/.cache/zae9ujei:/myvol:rw` and `Z` due to the comma.

Converted the COBRA code to consider the input as an ArrayVar instead and the value is
handled appropriately.  Also increased the testing to catch this going forward.

Addresses: #2000

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

Closes: #2039
Approved by: rhatdan
2019-12-22 15:06:05 +00:00
Daniel J Walsh 41b7852611 Rework overlay pkg for use with libpod
Podman uses the overlay mounts differently then in buildah.  Specifically the
overlay mount points can be used over and over again when starting and stopping
the container.  Since the paths are backed into the contianer config, we have
to be able to cleanout just the Upper and Merged directory rather then destroying
and recreating the overlay directories on each container start.

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

Closes: #1822
Approved by: vrothberg
2019-12-22 12:04:13 +00:00
Daniel J Walsh 9588a829c8 Fix buildahimage builds for buildah
1 We need to update all packages in the buildah image to make sure they are
up2date.
2 reinstall shadow-utils.  For some reason the fedora base image does not
include the file capabilities assigned to /usr/bin/newuidmap and
/usr/bin/newgidmap.  Reinstalling shadow-utils, brings them back.
3 Add a default user `build` to the system. This will create the
/etc/subuid and /etc/subgid maps get created correctly.

Once we have this we should be able to build a container starting with a non
privileged user

podman run -ti --user build --device=/dev/fuse -v ./Dockerfile:/Dockerfile:z quay.io/buildahi/stable buildah bud /

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

Closes: #2038
Approved by: baude
2019-12-20 17:00:02 +00:00
Daniel J Walsh e6815a12a7
Merge pull request #2031 from rhatdan/fips-mode
Add support for FIPS-Mode backends
2019-12-19 11:50:42 -05:00
Daniel J Walsh fb7d2b6bd6
Add support for FIPS-Mode backends
If host is running in fips mode, then RHEL8.2 and beyond container images
will come with a directory /usr/share/crypto-policies/back-ends/FIPS.
This directory needs to be bind mounted over /etc/crypto-policies/back-ends in
order to make all tools in the container follow the FIPS Mode rules.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-19 08:53:56 -05:00
Daniel J Walsh 2959a6b8fc
Merge pull request #2022 from rhatdan/tmpdir
Set the TMPDIR for pulling/pushing image to $TMPDIR
2019-12-19 08:31:43 -05:00
Daniel J Walsh e53fc16b9f
Set the TMPDIR for pulling/pushing image to $TMPDIR
Or set it to /var/tmp if the user did not specify.

Currently certain large workloads can not be handled because users are running
out of space on pulls/ and pushes.  Containers/image stores data temporarily in
the file system.  This allows the user to overide the location of the temporary
storage.

Also update containers/image to v5.0.1

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-18 14:33:15 -05:00
Ed Santiago 188269aaac WIP: safer test for pull --all-tags
The 'pull --all-tags' test flakes often in CI, e.g.:

   unexpected http code: 500 [...] URL: https://auth.docker.io/...

This is a remote registry error, not one we can resolve
on our end without complex retry-pull logic.

Here is an alternative which I believe provides better
testing anyway: instead of relying heavily on a remote
registry, do all the work using our already-set-up local
one. Pull one image (yes, sigh, from remote registry)
and push it locally with various different tags. Then
pull with --all-tags and make sure we get what we expect.

Advantages:
  + less reliance on network & remote server
  + less reliance on the _setup_ of said server, i.e.
    we don't have to just blindly trust that there
    will be multiple tagged versions of an image
  + better testing: since we know what we push to
    the local registry, we know exactly what we
    should expect to see on pull, and we now
    actually test that instead of a handwavey
    "oh just hope that there are more than three"
  + better testing of messages, and comparing image IDs

Disadvantages:
  - I've rolled two tests into one. (I'm not sure what the
    purpose was of pull-with-alltags-from-registry. Is the
    behavior that different?
  - In a development environment or some imaginary CI
    environment in which the local registry is persistent
    across runs, if someone were to remove one or more
    tags from the 'tags=(...)' list, tests would fail
    because the registry would include more tagged images
    (saved in a previous run) than the test expects. The
    diagnostic in this case would not be very helpful.

And of course, while I'm at it, improve a few of the other
tests: don't just check for error on non-docker --all-tags
pulls, actually make sure we get the expected message.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2032
Approved by: rhatdan
2019-12-18 18:16:09 +00:00
Ed Santiago 0662a4e364 BATS major cleanup: blobcache.bats: refactor
Split out into its own commit, because it's a big one
to review.

The same code was literally copy-pasted a bunch of times, with
the only difference being the use of $doomeddir vs $destdir in
a couple of spots. Refactor, and while we're at it refactor the
tests for expected matches and mismatches.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2029
Approved by: rhatdan
2019-12-17 18:16:45 +00:00
Ed Santiago 77db7f959e BATS major cleanup: part 4: manual stuff
This is the manual part of the cleanup.

  - remove most 'buildah rm's from cleanup steps
  - remove unused variables
  - use expect_output when possible, not 'test [ x = y ]'
    - includes fixing some not-what-you-think-it-is uses
      of run_buildah | grep
  - be careful not to leave droppings in current directory

Special attention to:

  - authenticate.bats: create Dockerfile in temp dir, not pwd!
  - push.bats: remove broken output check
  - registries.bats: refactor, remove duplicate tests & code
  - rmi.bats: better checking of messages
  - secrets.bats: use TESTDIR (tmp), not TESTSDIR (/usr/share) !
    We don't want to leave droppings behind if we fail; this has
    bitten us before. And, since there's only one test, there's
    no need to override setup() / teardown(). Do setup inline,
    and take advantage of existing defaults.

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2029
Approved by: rhatdan
2019-12-17 18:16:45 +00:00
Ed Santiago 6063bff02a BATS major cleanup, step 3: yet more run_buildah
Replace plain 'buildah' invocations with run_buildah

For ease of review, this commit was entirely machine-generated via:

   $ perl -pi -e 's/^(\s+)buildah(\s)/${1}run_buildah${2}/' *.bats

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2029
Approved by: rhatdan
2019-12-17 18:16:45 +00:00
Ed Santiago 229b18f6a8 BATS major cleanup, part 2: use more run_buildah
Replace this pattern:

       cid=$(buildah ...)
with:
       run_buildah ...
       cid=$output

As a special case, if the buildah command is 'from' and the
string 'scratch' does not appear in the arguments, add '--quiet'.
Otherwise we'll get Pulling messages as part of $output. This
is an overkill solution.

For ease of review, this commit was entirely machine-generated via:

   $ perl -pi -e 's{^(\s+)(\S+)=\$\(buildah (.*)\)$}{$indent=$1;$var=$2;$cmd=$3; $cmd =~ s/(\bfrom)\s(?!.*scratch)/$1 --quiet $2/; "${indent}run_buildah $cmd\n$indent$var=\$output"}e' *.bats

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2029
Approved by: rhatdan
2019-12-17 18:16:45 +00:00
Ed Santiago dee4b68ef0 BATS major cleanup, part 1: log-level
PR #1935 removed the default --debug logging; so all run_buildah
calls now use the default (error). It is safe to remove unnecessary
instances of --log-level=error .

For ease of review, this commit was entirely machine-generated via:

    $ perl -pi -e 's/ --log-level=error / /' *.bats

Signed-off-by: Ed Santiago <santiago@redhat.com>

Closes: #2029
Approved by: rhatdan
2019-12-17 18:16:45 +00:00
Daniel J Walsh acc7c35b61
Merge pull request #2026 from containers/dependabot/go_modules/github.com/containers/image/v5-5.1.0
Bump github.com/containers/image/v5 from 5.0.0 to 5.1.0
2019-12-17 11:00:03 -05:00
Daniel J Walsh d43f9acf9e
Bump github.com/containers/image/v5 from 5.0.0 to 5.1.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.0.0 to 5.1.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.0.0...v5.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-12-16 16:40:47 -05:00
Daniel J Walsh 068b6f5d63
Merge pull request #2025 from containers/dependabot/go_modules/github.com/containers/common-0.0.5
Bump github.com/containers/common from 0.0.3 to 0.0.5
2019-12-16 16:33:51 -05:00
dependabot-preview[bot] 91ba41a6fa
Bump github.com/containers/common from 0.0.3 to 0.0.5
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.0.3 to 0.0.5.
- [Release notes](https://github.com/containers/common/releases)
- [Commits](https://github.com/containers/common/compare/v0.0.3...v0.0.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-16 10:06:42 -05:00
Daniel J Walsh e28c43d178
Merge pull request #2024 from TomSweeneyRedHat/bump-1.12.0
Bump 1.12.0
2019-12-13 13:48:32 -05:00
TomSweeneyRedHat de31778eec Bump to v1.13.0-dev
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2019-12-13 11:42:33 -05:00