Commit Graph

3335 Commits

Author SHA1 Message Date
Ed Santiago e62277eabc WIP: tests: new assert()
This is much scarier than I had intended. The intention is to
start migrating from 'expect_output' and to use 'assert'
instead; the reason is that 'assert' allows much more
flexibility, particularly negative tests.

We've long wanted something like "assert that output does
not contain 'foo'". I've been too lazy to implement it,
but last week I noticed code in bud.bats that does:

    ! expect_output "sdfsdfsdf"

This is a really super bad idea: although it works fine when
things are good and tests pass, it's a disaster when tests
fail because the poor person debugging test output now sees
a test failure log, and starts tracking it down, and then
much later realizes that it was an intentional failure but
the '!' was negating it, and all that track-down work was
wasted.

To keep this PR reasonable, I'm keeping all positive uses
of expect_output untouched. We can migrate those (if desired)
over time. All negative uses are now assertions.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-07-28 14:30:59 -06:00
OpenShift Merge Robot f517d857b6
Merge pull request #3401 from containers/dependabot/go_modules/github.com/containers/image/v5-5.14.0
build(deps): bump github.com/containers/image/v5 from 5.13.2 to 5.14.0
2021-07-28 11:51:27 +02:00
OpenShift Merge Robot 42dbc97628
Merge pull request #3399 from rhatdan/dockerfile
Fix handling of --restore shadow-utils
2021-07-28 02:08:43 +02:00
Ed Santiago 5cdbcfc020
Proposed patch for 3399 (shadowutils)
Signed-off-by: Ed Santiago <santiago@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-27 13:34:48 -04:00
Daniel J Walsh abf6ea0e4f
Fix handling of --restore shadow-utils
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-27 13:33:47 -04:00
dependabot[bot] 914a7e5299
build(deps): bump github.com/containers/image/v5 from 5.13.2 to 5.14.0
Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.13.2 to 5.14.0.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.13.2...v5.14.0)

---
updated-dependencies:
- dependency-name: github.com/containers/image/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-27 13:22:21 -04:00
OpenShift Merge Robot 4535bc5342
Merge pull request #3381 from cevich/continuous_multi_arch
[CI:DOCS] Multi-arch: Always push updated version-tagged image
2021-07-27 19:00:46 +02:00
OpenShift Merge Robot 6aa4acee2b
Merge pull request #3404 from edsantiago/runc_debug_test
runtime-flag (debug) test: handle old & new runc
2021-07-27 18:53:43 +02:00
OpenShift Merge Robot 6dbf218fde
Merge pull request #3403 from containers/dependabot/go_modules/github.com/containers/storage-1.33.0
build(deps): bump github.com/containers/storage from 1.32.6 to 1.33.0
2021-07-27 17:13:44 +02:00
Ed Santiago 188cd46b08 runtime-flag (debug) test: handle old & new runc
Between runc-1.0.0-70.rc92 and 1.0.1-3, debug messages changed
entirely. Old runc is a short and sweet list:

   time="..." level=debug msg="nsexec:601 nsexec started"
   time="..." level=debug msg="child process in init()"
   time="..." level=debug msg="logging has already been configured"

New runc is pages and pages of gobbledygook which I'm not going to
paste here but which, basically, is completely different. Better,
because most messages now include "runc", but different.

These buildah tests need to pass in environments with old and
new runc. As best I can determine, the "child process in init"
message is the only string common to both old and new runc.
Use it as our gauge. (Note: I considered using a regex pattern
containing both "nsexec" and "runc". That's less maintainable.
If/when runc changes debug messages again, we may need to go
that route, but for now let's keep things clean).

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-07-27 07:33:42 -06:00
dependabot[bot] b935dbf50d
build(deps): bump github.com/containers/storage from 1.32.6 to 1.33.0
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.32.6 to 1.33.0.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/main/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.32.6...v1.33.0)

---
updated-dependencies:
- dependency-name: github.com/containers/storage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-27 08:29:27 +00:00
OpenShift Merge Robot 3821391ea6
Merge pull request #3398 from rhatdan/secrets
Allow dst and destination for target in secret mounts
2021-07-22 16:27:39 -04:00
Daniel J Walsh bb738d4406
Allow dst and destination for target in secret mounts
Fixes: https://github.com/containers/buildah/issues/3396

Patch from @mixedCase

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-22 14:47:22 -04:00
OpenShift Merge Robot 2fb04d5a4e
Merge pull request #3395 from hshiina/cgroupsv2
Add a few tests on cgroups V2
2021-07-22 11:43:20 -04:00
Chris Evich c0d49f8eb4
Multi-arch: Always push updated version-tagged img
Fixes #3365

Given a near daily release of Fedora updates, some addressing security
issues, it's safest for users to always have an updated version-tagged
image.  The cost of this is more image churn, but for a relatively small
image this should hopefully be a minor burden vs improved security.

Note: This is not a perfect solution, as there may be no
hard-dependencies between buildah and other packages with security
updates.  However it is an improvement over the previous regime where we
simply pushed the latest version-tagged image once, then never touched
it again.

Minor: Rename `gen_fqin` identifier to `reponame_reg` to be more
consistent with it's sister block `containers_reg`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-07-22 10:06:35 -04:00
Hironori Shiina c9a62264cf Add a few tests on cgroups V2
This change adds tests which has been skipped on cgroups V2.

Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
2021-07-21 14:34:10 -04:00
OpenShift Merge Robot 54cafea4c9
Merge pull request #3390 from vrothberg/fix-dangling
refine dangling filter
2021-07-21 13:12:32 -04:00
OpenShift Merge Robot 00e49484f4
Merge pull request #3393 from nalind/prepare
imagebuildah.stageExecutor.prepare(): remove pseudonym check
2021-07-21 13:03:34 -04:00
Nalin Dahyabhai 14965cde13 imagebuildah.stageExecutor.prepare(): remove pseudonym check
In prepare(), don't check if the image name that it's passed is a
pseudonym for the result of a stage in the Dockerfile.  Its callers
already did that.

When execute() knows that the image it's told to use as a base is a
pseudonym for the result of another stage in the Dockerfile, force the
pull policy to "never" to prevent an error when --pull-always=true.

Make imagebuildah.Mount a type alias instead of its own type, since we
never needed it to be a distinct type.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-07-21 10:31:17 -04:00
OpenShift Merge Robot 8c56a15dfe
Merge pull request #3359 from cevich/ghw_comment
[CI:DOCS] Update cirrus-cron notification GH workflow
2021-07-21 10:28:11 -04:00
OpenShift Merge Robot f33928d9bc
Merge pull request #3361 from stevegt/patch-2
Remove specific kernel version number requirement from install.md
2021-07-21 10:26:11 -04:00
Valentin Rothberg a23615aecf refine dangling filter
By proxy by vendoring containers/common.  Previously, a "dangling" image
was an untagged image; just a described in the Docker docs.  The
definition of dangling has now been refined to an untagged image without
children to be compatible with Docker.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-07-21 14:04:36 +02:00
OpenShift Merge Robot aedf4068c0
Merge pull request #3383 from rhatdan/chown
Chown with environment variables not set should fail
2021-07-21 06:30:08 -04:00
Daniel J Walsh 69e5e49040
Chown with environment variables not set should fail
Fixes: https://github.com/containers/buildah/issues/3380

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-20 05:16:38 -04:00
OpenShift Merge Robot dc3670b315
Merge pull request #3391 from rhatdan/dockerfile
[CI:DOCS] Just restore protections of shadow-utils
2021-07-19 14:00:58 -04:00
OpenShift Merge Robot 55ec519635
Merge pull request #3389 from containers/dependabot/go_modules/github.com/opencontainers/runc-1.0.1
build(deps): bump github.com/opencontainers/runc from 1.0.0 to 1.0.1
2021-07-19 13:21:57 -04:00
Daniel J Walsh 410c866212
Just restore protections of shadow-utils
Base images don't have shadow-utils permissions set correctly, this
change should speed up the building of images a little bit.

[NO TESTS NEEDED] This does not change buildah in any way, so no need to
tests.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-19 08:58:38 -04:00
dependabot[bot] 12c8c4cc38
build(deps): bump github.com/opencontainers/runc from 1.0.0 to 1.0.1
Bumps [github.com/opencontainers/runc](https://github.com/opencontainers/runc) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/opencontainers/runc/releases)
- [Commits](https://github.com/opencontainers/runc/compare/v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: github.com/opencontainers/runc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 08:23:43 +00:00
stevegt 38b6e3019a Remove specific kernel version number requirement from install.md
Existing specific version number requirement is misleading; discussion
in https://github.com/containers/podman/issues/10100.  Consensus there
and in #3295 is to avoid specific version numbers.

Signed-off-by: Steve Traugott <stevegt@t7a.org>
2021-07-16 19:25:41 -07:00
OpenShift Merge Robot 1419fda897
Merge pull request #3385 from cevich/generic_steps
[CI:DOCS] Multi-arch image workflow: Make steps generic
2021-07-16 13:22:43 -04:00
Chris Evich bc97173ac6
Multi-arch image workflow: Make steps generic
Since this workflow is duplicated across three repositories, maintaining
changes becomes onerous if the item contents vary between
implementations in any way.  Improve this situation by encoding the
repository-specific details into env. vars. then referencing those vars
throughout.  This way, a meaningful diff can be worked with to compare
the contents across repositories.

Also included are abstractions for the specific command used to obtain
the project version, and needed details for filtering the output.  Both
of these vary across the Buildah, Skopeo, and Podman repos.

***NOTE:*** This change requires the names of two github action secrets
to be updated: `BUILDAH_QUAY_USERNAME` -> `REPONAME_QUAY_USERNAME`
(and `*PASSWORD`).

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-07-16 10:37:52 -04:00
OpenShift Merge Robot ec35bc428a
Merge pull request #3101 from vrothberg/source
buildah source - create and manage source images
2021-07-15 15:38:10 -04:00
Nalin Dahyabhai 649f824193
Merge pull request from GHSA-7638-r9r3-rmjj
chroot: fix environment value leakage to intermediate processes
2021-07-15 10:09:26 -04:00
Nalin Dahyabhai a468ce0ffd chroot: fix environment value leakage to intermediate processes
Blake Burkhart reports that when running processes using "chroot"
isolation, the process being run can examine the environment of its
immediate parent and grandparent processes (CVE-2021-3602).

When run in a container in a CI/CD environment, the environment may
include sensitive information which was shared with the container in
order to be used only by buildah itself.  The command being executed is
able to read such information.

This patch reduces the set of environment variables passed to these
intermediate processes, from all variables to the one which is used to
control the level of debug logging.  It also corrects a misleading debug
message and expands the description of chroot isolation in man pages.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-07-15 10:08:38 -04:00
OpenShift Merge Robot 505c2cabd1
Merge pull request #3373 from rhatdan/parse
Reuse code from containers/common/pkg/parse
2021-07-14 14:53:01 -04:00
OpenShift Merge Robot 7513301882
Merge pull request #3379 from alvistack/master-linux-amd64
Update nix pin with `make nixpkgs`
2021-07-14 14:52:00 -04:00
Wong Hoi Sing Edison 2dee122f2a
Update nix pin with `make nixpkgs`
Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
2021-07-14 21:20:21 +08:00
Valentin Rothberg 8696bfc7ad buildah source - create and manage source images
Add new `buildah source {create,add,push,pull}` commands.  All commands
are marked as experimental.  None of it is meant to be officially
supported at the time of writing.  All code resides in `internal/source`
and is hence not visible to external consumers of Buildah; just to be
on the safe side.

A source container or source image is an OCI artifact, that is an OCI
image with custom config (media type).  There is a longer history behind
source images which are intended to ship the source artifacts of an
ordinary "executable" container image.  Until now, source images at
Red Hat are built with github.com/containers/BuildSourceImage.  We had a
growing desire (and always the long-term plan) to eventually replace
BuildSurceImage with something else, in this case Buildah.

This commit adds the initial base functionality along with tests to make
sure we're not regressing.  The new commands do the following:

* `create` - creates an empty and initialized source image
* `add` - tar up a local path and add it as a layer to the souce image
* `push/pull` - intentionally separate commands from `buildah push/pull`
                to allow for an easier usage and prevent the
                implementations from undesired (future) interference

Further note: also vendor in c/image@master which ships a required fix.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-07-13 13:48:48 +02:00
Chris Evich 1096b876c8
Update cirrus-cron notification GH workflow
Simple update due to master->main rename.  The only functional change is
to only run the workflow on weekdays.  Nobody's around on the weekend to
respond anyway.

Signed-off-by: Chris Evich <cevich@redhat.com>
2021-07-12 15:23:17 -04:00
Daniel J Walsh b5c130e7db
Reuse code from containers/common/pkg/parse
At some point code from buildah/pkg/parse we copied into
containers/common/pkg/parse.  Buildah should use the new code
now, so that we only have to make changes in one place.

[NO TESTS NEEDED] Since there is no new code added.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-12 14:58:58 -04:00
OpenShift Merge Robot 826dc723b1
Merge pull request #3374 from cevich/freshen_vm_images
Cirrus: Freshen VM images
2021-07-12 13:12:55 -04:00
Chris Evich adc60f201d
Cirrus: Freshen VM images
Signed-off-by: Chris Evich <cevich@redhat.com>
2021-07-12 11:32:31 -04:00
OpenShift Merge Robot bf372e3062
Merge pull request #3372 from containers/dependabot/go_modules/github.com/containers/storage-1.32.6
build(deps): bump github.com/containers/storage from 1.32.5 to 1.32.6
2021-07-12 10:45:55 -04:00
OpenShift Merge Robot 917195c9b8
Merge pull request #3362 from rhatdan/excludes
Fix excludes exception begining with / or ./
2021-07-12 10:44:55 -04:00
dependabot[bot] 556900ffd2
build(deps): bump github.com/containers/storage from 1.32.5 to 1.32.6
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.32.5 to 1.32.6.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/main/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.32.5...v1.32.6)

---
updated-dependencies:
- dependency-name: github.com/containers/storage
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-12 08:29:46 +00:00
OpenShift Merge Robot 0722ddb26b
Merge pull request #3367 from jluebbe/fix-bud-docs
Fix syntax for --manifest example in the documentaion
2021-07-09 14:19:11 -04:00
Daniel J Walsh 36e17cbb9b
Fix excludes exception begining with / or ./
Vendor in containers/storage v1.32.6 for the fix

Fixes: https://github.com/containers/buildah/issues/3272

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-07-09 13:59:16 -04:00
Jan Luebbe 2b7cd3d476 Fix syntax for --manifest example
Without the newlines this results in a single long line when rendered.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
2021-07-09 17:12:01 +02:00
OpenShift Merge Robot 0b592358c3
Merge pull request #3363 from containers/dependabot/go_modules/github.com/onsi/gomega-1.14.0
build(deps): bump github.com/onsi/gomega from 1.13.0 to 1.14.0
2021-07-08 06:27:10 -04:00
dependabot[bot] 25c0d3d832
build(deps): bump github.com/onsi/gomega from 1.13.0 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.13.0 to 1.14.0.
- [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.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-08 08:23:53 +00:00