Commit Graph

548 Commits

Author SHA1 Message Date
Romain Geissler f949a49ab0
Restore the default meaning of `--pull` (should be `always`).
Now the bud --help output correctly reads that the default behavior when
--pull is not provided at all is "missing", and that the default value
for --pull if explicitly provided but without value is "always".

Fixes #6266.

Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
2025-07-28 16:21:31 +00:00
Joshua Arrevillaga eea4838d88 ADD/COPY --link support added
What type of PR is this?
/kind feature

What this PR does / why we need it:
It implements --link for COPY and ADD instructions and enables the creation of
cachable layers that can be reused independently across builds.

Follows buildkit `--link` specifications

How to verify it
bats tests/bud.bats

Which issue(s) this PR fixes:
Fixes #4325

Does this PR introduce a user-facing change?
Yes, gives extra functionality to Containerfiles

Signed-off-by: Joshua Arrevillaga <2004jarrevillaga@gmail.com>
2025-07-09 17:14:28 -04:00
Nalin Dahyabhai 5968d82047 build, commit: set the OCI ...created annotation on OCI images
When building or committing an image in OCI format, default to setting
the org.opencontainers.image.created annotation to the value used in the
image's config blob for the image's creation date. The behavior can be
controlled using the new --created-annotation flag.

Add --annotation and --unsetannotation flags to `buildah commit` which
mimic the same flags for `buildah build`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-23 15:05:02 -04:00
flouthoc 47da2f29b2
build: add support for --inherit-annotations
Allows users to specify if they want to inherit annotations from base image
or not.

Closes: https://github.com/containers/buildah/issues/6153

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-06-13 12:28:12 -07:00
Nalin Dahyabhai 962ab4bb1e commit,build: --source-date-epoch/--timestamp omit identity label
When using either --source-date-epoch or --timestamp, default to not
adding a label with our version number in it, since it can change
between builds.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-10 16:18:50 -04:00
Nalin Dahyabhai b167073d54 docs: add --setopt "*.countme=false" to dnf examples
* Consistently use --releasever instead of --release in dnf examples
* Remove trailing whitespace
* Use --use-host-config --setopt "*.countme=false" when running dnf with
  an empty --installroot
* Use Fedora 42 instead of Fedora 30 in examples
* Block quote console examples in tutorials

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-10 14:16:36 -04:00
openshift-merge-bot[bot] 714f5ba2e5
Merge pull request #6195 from flouthoc/unsetanno
build,config: add support for `--unsetannotation`
2025-06-09 14:19:35 +00:00
Nalin Dahyabhai 865daceebb build: add --source-date-epoch and --rewrite-timestamp flags
Use $SOURCE_DATE_EPOCH as the default for the --source-date-epoch flag
to the "build" CLI.

When a source-date-epoch is set, we'll use it when writing new history
entries, force timestamps in data written for --output to the specified
timestamp, and populate a "SOURCE_DATE_EPOCH" ARG that we treat as
always being set, and which we don't complain about being left unused.
By default, this will not affect timestamps in newly-added layers.

Add a --rewrite-timestamp flag, which "clamps" timestamps in newly-added
layers to not be later than the --source-date-epoch value if the
--source-date-epoch flag is set, but has no effect otherwise.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-05 10:22:56 -04:00
flouthoc 83acf720d9
build,config: add support for --unsetannotation
Just like `--unsetlabel` add support for `--unsetannotation`.

Closes: https://github.com/containers/buildah/issues/6183

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-06-04 12:58:43 -07:00
Nalin Dahyabhai 6c82e7eac0 commit: add --source-date-epoch and --rewrite-timestamp flags
Add a --source-date-epoch flag, defaulting to $SOURCE_DATE_EPOCH if set,
which sets the created-on date and the timestamp for the new history
entries, but does not default to modifying the timestamps on contents in
new layers.

Add a --rewrite-timestamp flag, which "clamps" timestamps in the new
layers to not be later than the --source-date-epoch value if both
the --rewrite-timestamp and --source-date-epoch flags were set.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-04 13:02:26 -04:00
flouthoc 56f3171ab0
parse, validateExtraHost: honor Hostgateway in format
Flag `--add-host` should support `host-gateway` when argument is in the
form of `buildah build --add-host=proxyhost:host-gateway .`

This is consistent with podman.

Closes: https://github.com/containers/podman/issues/26034

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-05-30 09:56:35 -07:00
Nalin Dahyabhai b122c325fa buildah-build(1): clarify that --cgroup-parent affects RUN instructions
Tweak the wording that describes the effects of --cgroup-parent to be
clear that it only affects handling of RUN instructions.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-05-29 14:17:43 -04:00
openshift-merge-bot[bot] 9986534eea
Merge pull request #6178 from nalind/add-timestamp
add: add a new --timestamp flag
2025-05-28 19:16:00 +00:00
Nalin Dahyabhai d568dda6c0 [CI:DOCS] update a couple of lists in the build man page
The buildah-build man page enumerates the default set of masked and
read-only paths, but that list is hardwired into one of our
dependencies, and we didn't update this man page when it changed.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-05-21 09:53:28 -04:00
Nalin Dahyabhai b9a65a9d86 add: add a new --timestamp flag
Add a --timestamp flag to the "add" and "copy" CLIs, along with a
corresponding field in AddAndCopyOptions.

When a timestamp is set, we'll force the timestamp on data copied in to
be the specified value while reading it, so that the content will have
the specified datestamp in the rootfs and when the image is committed.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-05-21 09:51:51 -04:00
Nalin Dahyabhai 26ad103469 Document rw and src options for --mount flag in buildah-run(1)
Per discussion item 6084.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-04-15 17:22:01 -04:00
Aditya R a235033662
build: add support for inherit-labels
Allows users to specify if they want to inherit labels from base image
or not.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-04-14 14:01:00 -07:00
Jan Rodák 7ca9f3464b
Add --parents option for COPY in Dockerfiles
It also includes an implementation of the --parents flag for the buildah copy command.

Fixes: https://issues.redhat.com/browse/RUN-2193
Fixes: https://github.com/containers/buildah/issues/5557

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-03-18 21:58:27 +01:00
H Dub 1547d4f787
buildah-build.1.md: secret examples
Signed-off-by: H Dub <14808878+hdub-tech@users.noreply.github.com>
Helped-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-03-03 21:39:52 -06:00
Zack Zlotnik d694644ae5
fix broken doc link
Signed-off-by: Zack Zlotnik <zzlotnik@redhat.com>
2025-01-22 16:55:43 -05:00
Nalin Dahyabhai 25a3b385af internal/volume.GetBindMount(): discard writes in bind mounts
When handling RUN --mount=type=bind, where the mount is read-write,
instead of a simple bind mount, create an overlay mount with an upper
directory that will be discarded after the overlay mount is unmounted.
This brings us in line with the expected behavior, wherein writes to
bind mounts should be discarded.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-01-17 09:59:55 -05:00
Daniel J Walsh adf54cde0e
Add support for --security-opt mask and unmask
Fixes: https://github.com/containers/buildah/issues/5881

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2025-01-07 08:46:48 -05:00
Nalin Dahyabhai 5f3975333c manifest add: add --artifact-annotation
Add a --artifact-annotation flag to `buildah manifest add` that can be
used to set annotations in the artifact manifest that we generate and
then add to an image index.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-12-12 14:09:32 -05:00
Kir Kolyshkin c2b42c5e4f Fix some codespell errors
[NO NEW TESTS NEEDED]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-11-11 10:49:04 -08:00
Nalin Dahyabhai 6c85740bab Document more buildah build --secret options
Describe the "env" and "type" options in the buildah-build(1) man page.

When parsing the "--secret=" flag for the CLI, instead of ignoring an
option that we don't recognize, return an error.

Even though the set of meaningful "id" values for secrets is passed in
via the command line, don't directly use it to construct a file path.

Change the default mode for SSH agent sockets that we create from 0o620
to 0o600.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-10-17 12:02:29 -04:00
Daniel J Walsh aeb6ffeece
Add support for COPY --exclude and ADD --exclude options
Fixes: https://github.com/containers/buildah/issues/5678

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-10-16 16:30:16 -04:00
openshift-merge-bot[bot] bd0de14c46
Merge pull request #5755 from k9withabone/manifest-push-all
Make `buildah manifest push --all` true by default
2024-10-03 21:17:32 +00:00
Miloslav Trmač 5193f21b0a Document that zstd:chunked is downgraded to zstd when encrypting
A part of https://github.com/containers/common/issues/2117 .

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2024-09-30 21:09:38 +02:00
Reinhard Tartler 03ca93fb01
buildah-manifest-create.1: Fix manpage section
Signed-off-by: Reinhard Tartler <siretart@gmail.com>
2024-09-29 09:22:10 -04:00
Paul Nettleton d0819591d9 Make `buildah manifest push --all` true by default
Changed the `--all` option of `buildah manifest push` to be true by
default. This matches the behavior of the equivalent Podman option
(`podman manifest push --all`), making it easier to switch between
Podman and Buildah.

Updated buildah.manifest.push.1 docs to reflect this change.

Added test "manifest-push-all-default-true" to `tests/lists.bats`.

Closes: #5547
Signed-off-by: Paul Nettleton <k9@k9withabone.dev>
2024-09-25 18:11:14 -05:00
Daniel J Walsh 1f02b65c63
Document how entrypoint is configured in buildah config
Fixes: https://github.com/containers/buildah/issues/5598

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-09-12 16:30:35 -04:00
Nalin Dahyabhai f88579d1fe imagebuildah: make scratch config handling toggleable
The default configuration that `docker build` applies to images built
using "scratch" has changed from classic builds to BuildKit.  Add a
toggle for selecting which behavior to mimic.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-28 10:21:16 -04:00
Nalin Dahyabhai a2629f5287 buildah-build.1.md: expand the --layer-label description
Expand on the description of what --layer-label does.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-21 13:39:59 -04:00
Nalin Dahyabhai 34a7ce99b1 Update to keep up with API changes in storage
* Call storage.DefaultStoreOptions() instead of
  storage.DefaultStoreOptionsAutoDetectUID() in the tutorial.
* Mention installing passt when installing build-time dependencies.
* Include the registry part of examples that use node:12-alpine.
* Use registry.fedoraproject.org for Fedora images.
* Mention Fedora 40 instead of 35 in examples.
* Mount an emptyDir volume in the OpenShift example, so that it can use
  overlay for storage
* Use a more recent buildah image as the base in the OpenShift example.
* Use a ReplicationController instead of a DeploymentConfig in the
  OpenShift example, because DeploymentConfigs are deprecated.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-05 14:56:38 -04:00
Nalin Dahyabhai 5f18ba259a AddAndCopyOptions: add CertPath, InsecureSkipTLSVerify, Retry fields
Add CertPath and InsecureSkipTLSVerify flags to AddAndCopyOptions, and
connect the CLI flag values passed to `buildah add` and `buildah build`
so that Builder.Add() gets those.

Add MaxRetries and RetryDelay fields to AddAndCopyOptions, and connect
them to the values passed on the command line to `buildah add` and
`buildah build`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-07-25 17:39:08 -04:00
Nalin Dahyabhai a7098c776a imagebuildah: make traditional volume handling not the default
Make the traditional handling of volumes (where they're "frozen" and can
only be modified by ADD or COPY, which requires that we cache their
contents and save/restore them before/after RUN instructions) an option
that is not enabled by default.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-07-15 09:38:28 -04:00
Nalin Dahyabhai 14f19e980b buildah copy: preserve owner info with --from= a container or image
When `buildah copy` is invoked with a `--from` flag, default to
preserving ownerships that were set in the source container or image.
Retain the "set it to 0:0 by default" behavior when `--from` is not
being used.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-18 11:22:21 -04:00
Daniel J Walsh 5afd52fd9d
Clarify definition of --pull options
buildah from and buildah build will now default to --pull=missing
as opposed to --pull=always, which they did before. This better
matches to the defaults in docker and podman.

No longer document --pull=true|false

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-06-10 15:58:37 -04:00
flouthoc f552bd57f4
healthcheck: Add support for `--start-interval`
Docker now supports `--start-interval`, start interval
is the time between health checks during the start period.

Ref: https://docs.docker.com/reference/dockerfile/#healthcheck

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2024-06-06 16:02:25 -07:00
flouthoc 5b414ad08f
source-push: add support for --digestfile
Allow writing digest of the pushed source to the specified `digestfile`

Closes: https://github.com/containers/buildah/issues/5399

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2024-04-02 15:13:52 -07:00
Nalin Dahyabhai f812c89496 Man page updates
Describe --device in `buildah from` and `buildah run`, where it's new.
Update the description of --device in `buildah build` to note that the
device nodes are only there while RUN instructions are being run, and
not to imply that they end up in the finished image.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-03-29 16:57:11 -04:00
Philippe Vlérick 547d9bf0e5
Update docs/buildah-add.1.md
Co-authored-by: Tom Sweeney <tsweeney@redhat.com>
Signed-off-by: Philippe Vlérick <pvlerick@gmail.com>
2024-03-18 08:23:50 +01:00
Philippe Vlérick e635558d2a fix links to containerignore doc
Signed-off-by: Philippe Vlérick <pvlerick@gmail.com>
2024-03-14 11:07:47 +01:00
Nalin Dahyabhai aca884a89d `buildah manifest`: add artifact-related options
Add functionality for creating artifact manifests and adding them to
image indexes.  `buildah manifest add` gets a `--artifact` option for
telling it to create artifact manifests, and `--artifact-type`,
`--artifact-config`, `--artifact-config-type`, `--artifact-layer-type`,
`--artifact-exclude-titles`, and `--subject` options to fine-tune the
contents of the artifact manifests it creates.

Add a `--index` flag to `buildah manifest annotate` so that it can be
told to set annotations on the index itself instead of on one of the
entries in the image index.

Add a `--subject` flag to `buildah manifest annotate` for setting the
`subject` field of an image index.

Add a `--annotation` flag to `buildah manifest create` to allow for
adding annotations to the new image index.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-02-07 11:51:58 -05:00
James Fraser a20d5b2a55
docs: correct default authfile path
Signed-off-by: James Fraser <wulfgar.pro@gmail.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-02-05 12:53:24 -05:00
flouthoc 811ee67975
manifest, push: add support for --retry and --retry-delay
Just like `buildah push`, `buildah manifest push` should also support
`--retry` and `--retry-delay` options, see documentation in same commit
for more details.

Closes: https://github.com/containers/buildah/issues/5254

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2024-02-02 10:42:07 -08:00
krumelmonster 13fd5bd2cc docs: move footnotes to where they're applicable
Followthrough on #5221, with thanks to @krumelmonster:

   move footnotes on divisive language to exactly where
   divisive language is used

Signed-off-by: Ed Santiago <santiago@redhat.com>
2024-01-31 06:33:42 -07:00
Daniel J Walsh 34dff20dae
Run codespell on code
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-01-28 07:25:10 -05:00
Nalin Dahyabhai cf69e8a187 build,commit: add --sbom to scan and produce SBOMs when committing
Add a --sbom flag to `buildah build` and `buildah commit` which will
scan the rootfs and specified context directories to build SPDX or
CycloneDX SBOMs and lists of package URLs.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-01-19 13:55:57 -05:00
Nalin Dahyabhai de7c1e1f73 docs: fix a couple of typos
And don't refer to a filename in an example as a directory in
accompanying text.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-01-15 09:51:19 -05:00