Commit Graph

371 Commits

Author SHA1 Message Date
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 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
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
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 3a0b52f008
Merge pull request #3335 from rhatdan/main
Change references from master to main
2021-06-23 14:25:27 -04:00
OpenShift Merge Robot db29146e71
Merge pull request #3330 from jacobwgillespie/run-flags
Add `--env` and `--workingdir` flags to run command
2021-06-23 12:57:32 -04:00
OpenShift Merge Robot 1826a1a016
Merge pull request #3333 from vrothberg/docs
[CI:DOCS] push/pull: clarify supported transports
2021-06-23 12:56:29 -04:00
Daniel J Walsh cfe911a3f0
Change references from master to main
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-06-23 11:03:24 -04:00
Jacob Gillespie 8d2a9401d7
Add `--env` and `--workingdir` flags to run command
Signed-off-by: Jacob Gillespie <jacobwgillespie@gmail.com>
2021-06-23 14:28:12 +01:00
Дилян Палаузов 4d2bd80932 [CI:DOCS] buildah bud: spelling --ignore-file requires parameter
Insisting on “DCO” imposes formalities, that serve self-purpose.  One cannot
assume that the submitter has time or will to read texts about symbolism in
software contributions.  If the system wants to see the text

    nrEAUIEUAIe eanuitdnuae EAIUEAUIAIE »ℓ§444.3.72b)°»°ℓ§euaieauuae

in each commit, people will write this, or any other text, that the system wants to
see.  All such text, which presence is mandated by the system, has the same value.

Signed-off-by: Дилян Палаузов <git-dpa@aegee.org>
2021-06-23 13:49:41 +03:00
Valentin Rothberg 2426782335 [CI:DOCS] push/pull: clarify supported transports
As pointed out in containers/podman/issues/10730, the man pages of
buildah/podman push/pull were incomplete in explaining all supported
transports.  To keep things simple, explain the defaults, refer to
containers-transports(5).

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-23 10:35:06 +02:00
Jacob Gillespie 9c7b69d3a7
Add --json flags to `mount` and `version` commands
[NO NEW TESTS NEEDED]

Signed-off-by: Jacob Gillespie <jacobwgillespie@gmail.com>
2021-06-21 16:03:56 +01:00
OpenShift Merge Robot 28ea5598b9
Merge pull request #3319 from dilyanpalauzov/master
[ci:docs] buildah add/copy: spelling
2021-06-18 11:18:54 -04:00
OpenShift Merge Robot ecb444fc98
Merge pull request #3314 from containers/dependabot/go_modules/github.com/containers/common-0.40.0
build(deps): bump github.com/containers/common from 0.39.0 to 0.40.0
2021-06-18 07:04:11 -04:00
Дилян Палаузов c2e90cd3d2 buildah add/copy: spelling
Insisting on “DCO” imposes formalities, that serve self-purpose.  One cannot
assume that the submitter has time or will to read texts about symbolism in
software contributions.  If the system wants to see the text

    nrEAUIEUAIe eanuitdnuae EAIUEAUIAIE »ℓ§444.3.72b)°»°ℓ§euaieauuae

in each commit, people will write this, or any other text, that the system wants to
see.  All such text, which presence is mandated by the system, has the same value.

Signed-off-by: Дилян Палаузов <git-dpa@aegee.org>
2021-06-18 14:01:35 +03:00
OpenShift Merge Robot 635141f05d
Merge pull request #3311 from mtrmac/format-docs
Fix documentation of the --format option of buildah push
2021-06-18 04:50:23 -04:00
dependabot[bot] 3cf8145d76
build(deps): bump github.com/containers/common from 0.39.0 to 0.40.0
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.39.0 to 0.40.0.
- [Release notes](https://github.com/containers/common/releases)
- [Commits](https://github.com/containers/common/compare/v0.39.0...v0.40.0)

---
updated-dependencies:
- dependency-name: github.com/containers/common
  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-06-17 16:29:49 -04:00
Miloslav Trmač 2e8668b591 Fix documentation of the --format option of buildah push
It affects all transports; and without --format, we try several manifest formats.

[NO NEW TESTS NEEDED]

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2021-06-17 20:11:32 +02:00
Kye Shi 78a13f1119
man pages: clarify `rmi` removes dangling parents
Signed-off-by: Kye Shi <shi.kye@gmail.com>
2021-06-16 15:09:59 -07:00
Nalin Dahyabhai d95c6be83b Add and use a "copy" helper instead of podman load/save
Instead of using podman to cache images during integration tests, use a
custom helper.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-05-26 09:49:28 -04:00
Daniel J Walsh a9c22e1001
Don't blow up if cpp detects errors
Currently the /usr/bin/cpp will blow up if a user adds a
comment to a containerfile that is not a preprocessor.
Since the Containerfile.in could include other Containerfile
which may have comments, begining with `#` this can cause
problems.

If we just warn on these errors, we can successfully process
all of the containerfiles.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-05-19 15:14:15 -04:00
Daniel J Walsh b58b31aaf2
Document location of auth.json file if XDG_RUNTIME_DIR is not set
Fixes: https://github.com/containers/buildah/issues/3189

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-29 15:37:23 -04:00
OpenShift Merge Robot 9428d03194
Merge pull request #3177 from ashley-cui/secrets
Implement RUN secrets for buildah bud
2021-04-26 08:37:00 -04:00
Ashley Cui c8002d9739 Add support for secret mounts
Add support for secrets. Secrets is a two-part flag that allows secret files to
be accessed for a certain RUN instruction, but not any other
instructions, as well as now showing up in the final image.

Signed-off-by: Ashley Cui <acui@redhat.com>
2021-04-23 09:19:43 -04:00
Daniel J Walsh bddf46893a
Add buildah manifest rm command
Add command to actually remove the manifest list. This
uses the same basic code that buildah rmi uses, but makes
the error messages more specific to a manifest list.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-23 08:24:35 -04:00
OpenShift Merge Robot eb52311c23
Merge pull request #3178 from rhatdan/log-level
[NO TESTS NEEDED] Remove buildah bud --loglevel ...
2021-04-22 20:00:28 -04:00
Daniel J Walsh bbf27625d5
Remove buildah bud --loglevel ...
This was never hooked up and just causes confusion for users.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-22 12:54:39 -04:00
Valentin Rothberg dcd2a92e56 use new containers/common/libimage package
Move all code related handling container image over to the new
`libimage` package in containers/common.  The new package is an
attempt to consolidate the code across the containers tools under the
github.com/containers umbrella.

The new `libimage` packages provides functionality to perform all kinds
of operations for managing images such as local lookups, pushing,
pulling, listing, removing, etc.

The following packages have been moved over the containers/common:

`manifests` -> `common/image/manifests`
`pkg/manifests` -> `common/pkg/manifests`
`pkg/supplemented` -> `common/pkg/supplemented`

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-04-22 17:39:00 +02:00
Francisco M. Casares 592745b270 Minor fixes to Buildah as a library tutorial documentation
Details:
1. CommitOptions struct does not belong to `define` package anymore.
2. Formatting fixes threw by MD lint.

Signed-off-by: Francisco M. Casares <francares@gmail.com>
2021-04-16 11:02:06 -07:00
Nalin Dahyabhai b9e43034f2 Log the final error with %+v at logging level "trace"
If the logging level is at least "trace", log the final error we print,
if there is one, using %+v as the verb, or %v (changed from %s)
otherwise.  If the error was wrapped using github.com/pkg/errors, this
will provide a backtrace.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-15 14:53:17 -04:00
Nalin Dahyabhai dfe404f3de CLI add/copy: add a --from option
Add a --from option to `buildah add` and `buildah copy`, mirroring the
option for the Dockerfile instruction.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-04-08 13:21:26 -04:00
TomSweeneyRedHat a41d8972d8 [CI:DOCS] Fix rootful typo in docs
@giuseppe spotted a typo in rootlful instead of rootful in
https://github.com/containers/podman/pull/9774.

As I'd cut/pasted from Buildah, I thought I should clean up
here too.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2021-03-22 12:07:42 -04:00
OpenShift Merge Robot c6ae250906
Merge pull request #3077 from rhatdan/containerignore
Add documentation and testing for .containerignore
2021-03-16 13:12:58 -07:00
Daniel J Walsh aecbf3bbd4
Add documentation and testing for .containerignore
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-03-16 06:43:17 -04:00
Dan Young a984c8b9a3
Add Tag format placeholder to docs
Also fix spacing on CreatedAt table

Signed-off-by: Dan Young <dyoung@newrelic.com>
2021-03-14 13:38:38 -07:00
TomSweeneyRedHat b0d4af99e0 Clarify userns options are usable only as root in man pages
We've had a few BZ's come in recently where users were confused about
using the `--userns*` options for build and from inside of a rootless
container.  It's not allowed, but it's not documented that way.  This
change adds further documenation for them.  This will satisfy this
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1931261

Once merged, similar changes are necessary in the `podman build`
man pages.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2021-03-09 12:50:06 -05:00
Jakub Guzik fa7de7d89a complement add/copy --chmod documentation
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-02-27 00:46:41 +01:00
Jakub Guzik 88301c85d4 buildah add/copy --chmod cli implementation for files and urls
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
2021-02-24 08:37:25 +01:00
Ed Santiago 300eb17c0c [CI:DOCS] buildah-from.md: remove dup arch,os
PR #2869 (--manifest) documented --arch and --os in the
buildah-from man page, without realizing that those were
already documented.

Here I choose to keep the old --arch and the new --os

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-02-23 06:33:26 -07:00
OpenShift Merge Robot d65ba62f56
Merge pull request #2977 from rhatdan/shrink
Eliminate the use of containers/building import in pkg subdirs
2021-02-16 09:03:30 -05:00
OpenShift Merge Robot 0a064b38c7
Merge pull request #2997 from rhatdan/config
Add more support for removing config
2021-02-15 11:12:29 -05:00
Daniel J Walsh 4704e6cb3f
Eliminate the use of containers/building import in pkg subdirs
We want to shrink the size of the import when importing pkg from
buildah. This should help us shrink the size of the golang bindings
in podman.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-12 12:43:08 -05:00
Daniel J Walsh e0ca332f1d
Add more support for removing config
Currently we can remove configuration data in buildah config
by adding a trailing "-". This PR adds support for this in --port
calls.  Also added support for clearing all config for a specified
option, if the user specifies "-".

Currently the code blocks setting ANNOTATIONS and LABELS without a
value.  This is broken and should be allowed.

Similarly we were not expaning envioronment variables from the host when
they were not set.

podman run --env foobar
is valid,
so
buildah config --env foobar
should also be valid.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-12 12:42:09 -05:00
Daniel J Walsh b3435590fd
Improve messages about --cache-from not being supported
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-12 12:41:26 -05:00
Daniel J Walsh 7775e0f751
Fix tutorial for rootless mode
Users have gotten confused when attempting the introduction turturial in
rootless mode.  Explain that they have to `buildah unshare` before
mounting the image.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-02-10 18:30:15 -05:00
Daniel J Walsh 6f59942fc7
[ci:docs] Fix man page for buildah push
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-31 05:27:25 -05:00
Toomas Vendelin 0dba767afe Added required devel packages
Signed-off-by: Toomas Vendelin <toomas.vendelin@gmail.com>
2021-01-21 19:23:02 +01:00
OpenShift Merge Robot 10c10eedd2
Merge pull request #2895 from rhatdan/push
Make buildah push support pushing manifests lists and digests
2021-01-08 08:44:41 -05:00
OpenShift Merge Robot 1b9ee76144
Merge pull request #2869 from rhatdan/bud
Add support for --manifest option in buildah bud and buildah commit
2021-01-08 08:37:12 -05:00
Daniel J Walsh 801da25a6e
Buildah inspect should be able to inspect manifests
When you create a manifest or pull a manifest, it shows up
inside of the buildah images list.  When you go to inspect it
the inspect code blows up with a cryptic error message.

This patch fixes this problem and just uses the buildah manifest inspect
code.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-08 06:38:08 -05:00