Commit Graph

149 Commits

Author SHA1 Message Date
Jan Kaluza a0a9ac6380 Switch common, storage and image to monorepo.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-08-29 15:04:28 +02:00
tomsweeneyredhat cce5f9c32b Bump to Buildah v1.42.0-dev
Bump to the next dev version of Buildah, v1.42.0-dev
for the upstream main branch.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-07-16 21:19:45 -04:00
tomsweeneyredhat 9f185b7777 Bump to Buildah v1.41.0
Bump Buildah to v1.41.0 in preparation for
Podman v5.6.0

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-07-16 21:19:45 -04:00
Patrick Stoeckle 9f809a88ff
chore(typos): fix typos
Signed-off-by: Patrick Stoeckle <patrick.stoeckle@siemens.com>
2025-06-30 15:45:47 +02: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
Nalin Dahyabhai df36bb835a commit: exclude parents of mount targets, too
When RUN requires us to create the target for a mountpoint, make note of
it and any parent directories that needed to be created, and filter them
out when generating a layer diff or --output data.

The exceptions will be directories that the conformance tests confirm
that BuildKit also leaves behind, though for compatibility with the
classic builder, we have to make that conditional.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-06-20 11:19:27 -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
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 3a85df003e build: allow --output to be specified multiple times
Allow --output to be specified multiple times for `buildah build`.
That's of limited usefulness right now, but as exporters get added, it
won't be, and it's better to provide the new multiple-values API field
sooner rather than later.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-05-21 09:53:04 -04:00
tomsweeneyredhat 36adabb2d6 Bump to Buildah v1.41.0-dev
Bump the main Buildah branch to the next dev version,
Buildah v1.41.0-dev

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-04-17 15:21:28 -04:00
tomsweeneyredhat ff62e3e8a5 Bump Buildah to v1.40.0
Bump Buildah to v1.40.0 in preparation
for Podman v5.5.0

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-04-17 15:21:28 -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
Kir Kolyshkin 1ede7ddce7 Use any instead of interface{}
Brought to you by

	gofmt -r 'interface{} -> any' -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-08 10:19:51 -07:00
flouthoc a4bc357820
build: return ExecErrorCodeGeneric when git operation fails
Only propagate error message from git and let buildah reflect error code
`125`.

Reason: Buildah should return predicatable error code from the set of
defined error codes in exec_codes.go at https://github.com/containers/buildah/blob/main/pkg/cli/exec_codes.go#L6
anything other that predefined error codes introduces inconsistency thus making testing difficult in CI and podman.

Users should expect buildah to refect ExecErrorCodeGeneric with error message kept intact from the underlying `git`
commands.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-03-28 07:06:44 -07:00
flouthoc 0c377816a9
add: report error while creating dir for URL source.
Correctly report back error when attempting to create `Tmpdir` for a
given url source.

Also remove superfluous `isGitTag` from define/types.go since `git
fetch` correctly resolves by provided reference.

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

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-03-26 08:10:59 -07:00
flouthoc aadfc5cf30
unit_test: use Parallel test where possible
Add `t.Parallel()` to unit tests whereever its possible without race.

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-02-04 11:07:15 -08:00
tomsweeneyredhat 6c3d7546e3 Bump to Buildah v1.40.0-dev
Bumping back to a dev version.

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-01-31 18:19:08 -05:00
tomsweeneyredhat c15ab104a1 Bump to Buildah v1.39.0
Bump to Buildah v1.39.0 in preparation
for Podman v5.4

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2025-01-31 18:15:22 -05:00
Nalin Dahyabhai c30f5784da define.TempDirForURL(): always use an intermediate subdirectory
Ensure that the temporary directory that we create is never itself the
top-level directory of the content that we're downloading, in case it's
an archive which includes a "." with weird permissions.

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
Giuseppe Scrivano eb7a422176
executor: allow to specify --no-pivot-root
the functionality is already implemented, it must be exposed through
the BuildOptions struct.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-11-13 13:06:37 +01:00
tomsweeneyredhat 147765b45c Bump to Buidah v1.39.0-dev
Bump top of tree back to the next dev version.

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-11-08 16:25:44 -05:00
tomsweeneyredhat 7aa3b5ee04 Bump to Buildah v1.38.0
Bump to Buildah v1.38.0 in preparation of Podman v5.3.0

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-11-08 16:25:44 -05:00
danishprakash 71fc845d0b
tests/bud.bats: add git source
Signed-off-by: Danish Prakash <contact@danishpraka.sh>
2024-09-09 12:45:15 +05:30
danishprakash 47297b3d5c
add: add support for git source
Signed-off-by: Danish Prakash <contact@danishpraka.sh>
2024-09-09 12:45:15 +05:30
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 e8e83bb8bd Update some godocs, use 0o to prefix an octal in a comment
Update some godocs, and update an octal value in a godoc to start with
0o instead of just 0, to match the literal on the next line.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-21 14:22:27 -04:00
Nalin Dahyabhai 8ae99121c1 CI: enable the gofumpt linter
Turn on the gofumpt linter.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-08-15 13:17:44 -04:00
Kir Kolyshkin 24da18800e *: fix build tags
This change is generated by `go1.23rc2 fix ./...`.

Had to use go1.23rc2, since all released go versions have a bug
preventing it from working with `go 1.22.0` in go.mod (opened
https://github.com/golang/go/issues/68825,
https://github.com/golang/go/issues/68824 for awareness).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-08-09 17:05:30 -07:00
tomsweeneyredhat 4e78b5723c Bump to Buildah v1.38.0-dev
Bump Buildah's main branch to the next dev release.

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-07-26 09:48:25 -04:00
tomsweeneyredhat f9de1bbd1f Buildah v1.37.0
Bump Buildah to v1.37.0 in preparation for Podman v5.2

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-07-26 09:47:33 -04:00
Nalin Dahyabhai b1dff416b9 Replace libimage.LookupReferenceFunc with the manifests version
Change fields of the
github.com/containers/common/libimage.LookupReferenceFunc type to be of
the github.com/containers/common/libimage/manifests.LookupReferenceFunc
type. The two types are aliases for each other, but the libimage package
refuses to build when podman is using us as a dependency of its remote
client.

Note that the CachePullSourceLookupReferenceFunc,
CachePullDestinationLookupReferenceFunc,
CachePushSourceLookupReferenceFunc, and
CachePushDestinationLookupReferenceFunc callbacks in define.BuildOptions
aren't currently proxied for podman remote clients.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-07-15 16:30:22 -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 21fb5ea4f2 Rework parsing of --pull flags
Rework parsing of --pull flags to add "newer" as an alias for "ifnewer",
and to reject unrecognized values instead of treating them as synonymous
with "ifmissing".

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-24 11:02:12 -04:00
Nalin Dahyabhai 66957cc05e commit: set "parent" for docker format only when requested
Make setting the Parent field in the config blob of a docker format
image optional (yes, we're bringing it back!), since it no longer
appears to be set by newer versions of docker build.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-18 09:55:38 -04:00
Maya Rashish e47ffc831c Add netbsd to lists-of-OSes
Signed-off-by: Maya Rashish <maya@NetBSD.org>
2024-06-01 22:25:08 -04:00
Aaron Lehmann 9521672fdb Document when BlobDirectory is overridden
Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2024-05-27 10:50:27 -07:00
Aaron Lehmann 7ff83d5055 Change to take a types.ImageReference arg
Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2024-05-24 14:27:09 -07:00
Aaron Lehmann e6c7949aa7 imagebuildah: Support custom image reference lookup for cache push/pull
This allows callers to provide custom SourceLookupReferenceFunc and
DestinationLookupReferenceFunc for cache pull/push. These can be used to
implement custom blob caches, and to wrap the reference being
pushed/pulled to influence the copy behavior.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2024-05-24 14:27:01 -07:00
tomsweeneyredhat f39d5fba25 Bump to v1.37.0-dev
As the title says.  Setting to v1.37.0-dev after
creatings Buildah v1.36.0 for release with Podman v5.1

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-05-23 16:31:33 -04:00
tomsweeneyredhat 6ceba8838d Bump to v1.36.0
[NO TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-05-23 16:31:28 -04:00
Nalin Dahyabhai 5198af7d7c Add support for passing CDI specs to --device
Add support for using CDI to resolve `--device` devices for RUN
instructions during `buildah build`, `buildah from`, and `buildah run`,
as `podman run` does.

This generally requires that we stop resolving device specifications
(arguments passed to --device) earlier and deferring that until it's
time to run a process, because CDI wants to pick over those values,
modify a runtime spec to set up the ones that it knows about, and then
hand back the list of values that it doesn't know about.

We don't want to do a dry run of this during CLI processing because that
would create a window where the underlying hardware state could change,
and that could produce some hard-to-diagnose errors.

Being able to test this is going to require that we add the `--device`
flag to `buildah run` (`--security-opt` affects how we build the
container's layer, so it has to be done at `buildah from`).

The default configured devices list is pulled in by CLI flag processing
during `buildah from` and `buildah build`, so it doesn't also need to be
explicitly passed to `buildah run` or the internal Run() method.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-03-29 16:57:10 -04:00
Nalin Dahyabhai 14bf3db27a Update comments on some API objects
Avoid generically referring to "the container" where it can be ambiguous
that we're actually talking about the environment we set up for running
a command for a RUN instruction or Run() call.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-03-28 17:24:38 -04:00
tomsweeneyredhat da81d2e2b4 Bump to v1.36.0-dev
As the title says.  Bumping back to the next dev
version.

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-03-06 23:47:45 -05:00
tomsweeneyredhat fedbd79676 Bump v1.35.0
Bump to Buildah v1.35.0 in preparation of Podman v5.0.

[NO NEW TESTS NEEDED]

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-03-06 23:47:45 -05:00
tomsweeneyredhat d73e211205 Bump main to v1.35.0-dev
There have been a number of breaking changes added
since v1.34 to the main branch.  We'll create a new
release branch for v1.34 and will set the version in
main to 1.35.0-dev.

The intended target for Buildah v1.35 is Fedora 40.

[NO NEW TESTS NEEDED]
Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-02-08 10:42:20 -05:00
Daniel J Walsh 79fb3c2135
Make buildah match podman for handling of ulimits
Podman currently sets the ulimits of nofile and nproc
to max in rootless mode, if the user does not override.

Buildah on the other hand just passes in the current defaults.

Podman build should match podman run, and this will fix that problem.

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

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-01-31 15:28:51 -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