Commit Graph

22 Commits

Author SHA1 Message Date
Nalin Dahyabhai 16680a4dfd modernize: use strings.CutPrefix/SplitSeq/FieldsSeq
Use the CutPrefix(), SplitSeq(), and FieldsSeq() functions from the
strings package when chopping up or iterating over parts of strings, per
golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-09-10 13:11:00 -04:00
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
Nalin Dahyabhai b436176d4a Add --transient-store global option
Add another global storage configuration option.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-08-18 15:11:35 -04:00
Nalin Dahyabhai fc748f85a4 Support "--imagestore" global flags
Add the global --imagestore flag to the buildah command and to the copy
and imgtype test helpers.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2025-08-13 21:25:19 -04: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
Lokesh Mandvekar 951dccd3ff
cgroups: reuse version check from c/common
[NO NEW TESTS NEEDED]

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-03-01 09:45:50 -05:00
Aditya R e67bb0904c
refactor: stop using Normalize directly from containerd package
Stop using containerd's `platform.Normalize` instead use libimage's
`NormalizePlatform` which calls containerd's `platform.Normalize` along
with `platform.Parse` internally.

See discussion here: https://github.com/containers/buildah/pull/4286/files#r977389931

Signed-off-by: Aditya R <arajan@redhat.com>
2022-09-28 12:54:16 +05:30
Doug Rabson dc1bc10df6 Add FreeBSD support for 'buildah info'
On non-windows platforms, we can use the uname syscall to get kernel
version information. For uptime, we can use clock_gettime(CLOCK_UPTIME)
on FreeBSD but I don't have a solution for darwin or windows.

Note: the existing code which unconditionally reads from /proc builds
on all platforms but only works on linux since using /proc in this way
is a linux feature.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-07-17 10:58:44 +01:00
Sascha Grunert ce384684c0
Switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-07 11:41:47 +02:00
Nalin Dahyabhai 9f9f32cedd config: support the variant field
Add the variant field, along with methods for setting and querying it,
and expose them in the `buildah config` and `buildah inspect` commands.

When setting an initial architecture for a container based on an image
which doesn't contain an architecture, or from "scratch", normalize the
architecture name we've been given, and set both it and the variant
field at the same time.

Provide normalized architecture+variant values in `buildah info`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-11-05 09:37:00 -04:00
xiadanni 5bc9748bd4 fix spelling mistake in "info" command result display
MenFree -> MemFree

Signed-off-by: xiadanni <xiadanni1@huawei.com>
2020-08-03 19:48:46 +08:00
Brandon Lum 40df1c6e3b Fix errorf conventions
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2020-04-04 01:12:25 +00:00
Daniel J Walsh b2e7110255
vendor in latest containers/storage 1.18.0 and containers/common v0.7.0
This vendor moves containers/common/pkg/unshare to containers/storage/pkg/unshare

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-03-31 09:56:18 -04:00
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
Daniel J Walsh 8fc5b0116f Start using containers/common
We have moved share code from buildah, podman and others into containers/common.

Specifically for this PR we are moving to use containers/common/pkg/unshare and
containers/common/pkg/cgroups.

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

Closes: #2010
Approved by: QiWang19
2019-12-06 14:37:27 +00:00
Nalin Dahyabhai c5244fe0bf info: use util.Runtime()
We have a function that decides what our OCI runtime command is, and
duplicating that logic for `buildah info` isn't necessary.

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

Closes: #1980
Approved by: vrothberg
2019-11-13 19:36:28 +00:00
Mohammed Kamal a88000146d Add OCIRuntime to info
Signed-off-by: Mohammed Kamal <m7mdkamal@live.com>

Closes: #1968
Approved by: rhatdan
2019-11-07 22:45:05 +00:00
Giuseppe Scrivano 4069d6581a
info: add cgroups2
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-30 21:38:46 +02:00
Sascha Grunert 16e301031e Add unparam linter and apply fixes
This commit enabled the `unparam` linter and applies all reported issues.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>

Closes: #1719
Approved by: rhatdan
2019-07-16 21:21:32 +00:00
Giuseppe Scrivano ac66d785d4 unshare: move to pkg/
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1475
Approved by: rhatdan
2019-04-05 03:04:46 +00:00
Daniel J Walsh 3d74031301 Move pkg/chrootuser from libpod to buildah.
We don't want to vendor anything from libpod into Buildah.
We want to switch this around.  Moving pkg content from libpod
to Buildah allows us to fix this.

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

Closes: #1400
Approved by: giuseppe
2019-03-26 15:45:33 +00:00
Zhou Hao e5e4588e4e Add buildah info command
Add info command to display buildah system information.

```
$ buildah info
{
    "host": {
        "Distribution": {
            "distribution": "ubuntu",
            "version": "18.04"
        },
        "MemTotal": 16702980096,
        "MenFree": 309428224,
        "SwapFree": 2146693120,
        "SwapTotal": 2147479552,
        "arch": "amd64",
        "cpus": 4,
        "hostname": "localhost.localdomain",
        "kernel": "4.15.0-36-generic",
        "os": "linux",
        "rootless": false,
        "uptime": "91h 30m 59.9s (Approximately 3.79 days)"
    },
    "store": {
        "ContainerStore": {
            "number": 2
        },
        "GraphDriverName": "overlay",
        "GraphOptions": [
            "overlay.override_kernel_check=true"
        ],
        "GraphRoot": "/var/lib/containers/storage",
        "GraphStatus": {
            "Backing Filesystem": "extfs",
            "Native Overlay Diff": "true",
            "Supports d_type": "true"
        },
        "ImageStore": {
            "number": 1
        },
        "RunRoot": "/var/run/containers/storage"
    }
}
```
Signed-off-by: Zhou Hao <zhouhao@cn.fujitsu.com>

Closes: #1195
Approved by: rhatdan
2018-11-29 14:06:46 +00:00