Commit Graph

3179 Commits

Author SHA1 Message Date
Valentin Rothberg 5e2c484da5 linters: cleanup duplicates
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
Valentin Rothberg d2d7215408 linters: document gocognit
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
Valentin Rothberg 51569ba8b6 linters: document gochecknoinits
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
Valentin Rothberg 5d7e0a74e7 linters: enable gci
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
Valentin Rothberg fd9f0180e9 linters: funlen
Document why funlen is disabled to avoid redundant work in the future
trying to re-enable it.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
Valentin Rothberg 1fa8b65281 linters: enable forbidigo
Selectively disable cases that I cannot touch or don't bother spending
time on.  Future cases will be avoided.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
Valentin Rothberg 9ca6b06f1a linters: enable predeclared
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-09-01 11:08:17 +02:00
OpenShift Merge Robot 20abb433b0 Merge pull request #1631 from vrothberg/linter
golangci.yml: enable all, disable failing linters
2023-08-31 16:50:28 +02:00
Valentin Rothberg a67f0ec096 golangci.yml: enable all, disable failing linters
golangci-lint has a number of helpful linters and new ones are being
continuously added.  Instead of enabling only a minimal subset of these
linters, enable all by default and - for now - disable failing ones.
This allows us to make use of new linters on updates and to selectively
enable those we deem useful.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-31 14:09:52 +02:00
OpenShift Merge Robot 7ffc273928 Merge pull request #1630 from vrothberg/oci-ref
libimage: preserve optional name when pulling from OCI transport
2023-08-30 09:59:33 +02:00
Valentin Rothberg 02a72eb33e libimage: preserve optional name when pulling from OCI transport
When pulling from an OCI source, make sure to preseve the optional name.
For instance, a `podman pull oci:/tmp/foo:quay.io/foo/bar:latest` should
pull the image and name it `quay.io/foo/bar:latest`.

While at it, also fix a bug when pulling an OCI without the optional
name.  Previously, we used the path to name the image which will error
in most cases due to invalid characters (e.g., capital ones).  Hence,
apply the same trick as for the `dir` transport and generate a sha.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-30 09:19:42 +02:00
OpenShift Merge Robot 912c33788e Merge pull request #1625 from containers/TomSweeneyRedHat-patch-1
Update CODE-OF-CONDUCT.md with new mailing list
2023-08-29 17:40:12 +02:00
OpenShift Merge Robot d24aa07e87 Merge pull request #1629 from mtrmac/ManifestListData-no-deps
Move libimage.ManifestList{Descriptor,Data} to libimage/define
2023-08-29 12:40:13 +02:00
OpenShift Merge Robot 1a44667eda Merge pull request #1628 from vrothberg/fix-1533
libimage: close all `ImageCloser`s
2023-08-29 11:53:36 +02:00
Miloslav Trmač a6d079d218 Move libimage.ManifestList{Descriptor,Data} to libimage/define
These structs are (for better or worse) a part of
Podman's API, so podman-remote needs to include the subpackage that
defines them - which is all of libimage (and c/image/v5/copy) right now.

Instead, move them to libimage/define.

Alternatively, maybe Podman's API should not directly depend on (unstable)
c/common types?!

Only moves unchanged code, should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-08-28 23:17:59 +02:00
Valentin Rothberg a60d8bd633 libimage: close all `ImageCloser`s
Make sure to close all `ImageCloser` to avoid potential memory leaks.

Fixes: containers/common#1533
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-28 13:57:36 +02:00
OpenShift Merge Robot 40924835d8 Merge pull request #1627 from containers/renovate/github.com-containerd-containerd-1.x
fix(deps): update module github.com/containerd/containerd to v1.7.5
2023-08-28 12:02:50 +02:00
renovate[bot] 64884e38e6 fix(deps): update module github.com/containerd/containerd to v1.7.5
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-25 17:10:32 +00:00
OpenShift Merge Robot df49a06e92 Merge pull request #1626 from containers/renovate/github.com-containerd-containerd-1.x
fix(deps): update module github.com/containerd/containerd to v1.7.4
2023-08-25 03:49:51 -04:00
renovate[bot] 45662d1c3b fix(deps): update module github.com/containerd/containerd to v1.7.4
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-24 19:25:37 +00:00
Tom Sweeney def8b9f72a Update CODE-OF-CONDUCT.md
Code of conduct update

[NO NEW TESTS NEEDED]

Signed-off-by: Tom Sweeney <tsweeney@redhat.com>
2023-08-24 14:52:18 -04:00
OpenShift Merge Robot 8612495a83 Merge pull request #1593 from flouthoc/conf-addcompression
containers.conf: add field for `AddCompression` to Engine table
2023-08-24 10:14:45 -04:00
OpenShift Merge Robot e7e6cbe57f Merge pull request #1616 from vrothberg/fix-containers/podman/issues/18353
libimage: pull: increase timeout running under systemd
2023-08-24 10:01:49 -04:00
OpenShift Merge Robot 51fa8c8532 Merge pull request #1624 from containers/renovate/github.com-onsi-ginkgo-v2-2.x
fix(deps): update module github.com/onsi/ginkgo/v2 to v2.12.0
2023-08-24 08:09:19 -04:00
Aditya R 359ff162d0 containers.conf: add field for AddCompression to Engine table
Allows users to set default value of `AddCompression` to Engine table so
users can use https://github.com/containers/buildah/pull/4912 by
default.

Closes: https://github.com/containers/buildah/pull/4912#issuecomment-1661105029

Signed-off-by: Aditya R <arajan@redhat.com>
2023-08-24 17:10:06 +05:30
renovate[bot] 2825958fd4 fix(deps): update module github.com/onsi/ginkgo/v2 to v2.12.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-24 00:44:56 +00:00
Valentin Rothberg 91b87d2bde libimage: pull: increase timeout running under systemd
Set the `EXTEND_TIMEOUT_USEC` over DBUS when pulling an image from a
registry and when running under systemd.  This will prevent a frequent
issue when running Quadlets and exceeding the default systemd start
timeout of 90 seconds when pulling the image takes too long.

Fixes: containers/podman/issues/18353
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-23 14:38:11 +02:00
OpenShift Merge Robot b6841be1ca Merge pull request #1622 from containers/renovate/github.com-containers-storage-1.x
fix(deps): update module github.com/containers/storage to v1.49.0
2023-08-22 16:02:28 -02:30
renovate[bot] 6403701540 fix(deps): update module github.com/containers/storage to v1.49.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-22 17:50:32 +00:00
OpenShift Merge Robot 965da65021 Merge pull request #1621 from containers/renovate/github.com-jinzhu-copier-0.x
fix(deps): update module github.com/jinzhu/copier to v0.4.0
2023-08-21 05:29:02 -02:30
renovate[bot] b41f162c5c fix(deps): update module github.com/jinzhu/copier to v0.4.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-21 04:19:34 +00:00
phoenix 30263987ba Add restore handler for password input
This commit restores the terminal state in case the program is
interrupted while being in password read mode. This ensures the terminal
remains usable, also if the password input is being cancelled.

Signed-off-by: phoenix <felix.niederwanger@suse.com>
2023-08-17 14:54:07 +02:00
OpenShift Merge Robot 597cf48605 Merge pull request #1618 from containers/renovate/major-ci-vm-image
chore(deps): update dependency containers/automation_images to v20230816
2023-08-17 07:03:39 -02:30
renovate[bot] d253c4d0c0 chore(deps): update dependency containers/automation_images to v20230816
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-17 09:08:50 +00:00
OpenShift Merge Robot 568bff99a3 Merge pull request #1619 from dfr/freebsd-cni
libnetwork/cni: use 'ifconfig -j' on FreeBSD if it is supported
2023-08-17 06:37:53 -02:30
OpenShift Merge Robot 54c6b9918a Merge pull request #1620 from vrothberg/revert
Revert #1572
2023-08-17 06:32:55 -02:30
Valentin Rothberg 97f5e708f6 Revert "Change default profile to unconfined; remove CheckProfileAndLoadDefault"
This reverts commit 6d109b95a0 because it
was merged prematurely.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-17 10:17:15 +02:00
Valentin Rothberg ed3ac2cb8e Revert "Revert "Revert "Allow rootless containers to use AppArmor profiles"""
This reverts commit d2e1497ce1 because it
was merged prematurely.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-17 10:16:55 +02:00
Doug Rabson e57cd8cc6c libnetwork/cni: use 'ifconfig -j' on FreeBSD if it is supported
This allows us to use a single jail for containers with networking since
CNI can initialise the network without needing a separate jail to own
the network namespace.

Signed-off-by: Doug Rabson <dfr@rabson.org>
2023-08-17 07:54:34 +01:00
OpenShift Merge Robot f3a694b216 Merge pull request #1572 from kernelmethod/rootless_apparmor
Allow rootless AppArmor
2023-08-16 16:13:23 -02:30
Giuseppe Scrivano fe73ae9fad Merge pull request #1615 from jontte75/fix-resource-leak-in-linux
cgroups_linux: use SessionBusPrivateNoAutoStartup
2023-08-16 17:47:34 +02:00
OpenShift Merge Robot 995c27c688 Merge pull request #1614 from containers/renovate/github.com-containers-ocicrypt-1.x
fix(deps): update module github.com/containers/ocicrypt to v1.1.8
2023-08-16 10:15:25 -02:30
Joni Korhonen 6ea33b815f cgroups_linux: use SessionBusPrivateNoAutoStartup
port Commit 10d63bf089 (cgroups: use SessionBusPrivateNoAutoStartup)
from cgroups.go to cgroups_linux.go

do not start up a dbus daemon if it is not already running.

[NO NEW TESTS NEEDED] the fix is in a dependency.

Signed-off-by: Joni Korhonen <joni.korhonen@gmail.com>
2023-08-15 12:20:06 +03:00
renovate[bot] 7983e89efc fix(deps): update module github.com/containers/ocicrypt to v1.1.8
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-15 03:56:41 +00:00
OpenShift Merge Robot e693e33085 Merge pull request #1599 from vrothberg/RUN-1873
containers.conf: implement modules
2023-08-14 12:15:08 -04:00
Valentin Rothberg 163f808bdb pkg/config: add (*Config).LoadedModules()
To return absolute paths to modules a config was loaded with.
Knowing the modules is required for conmon's callback to
Podman's cleanup.  Returning them as absolute paths makes
loading the modules a bit faster as it avoids the lookup.

Also drop the attempted performance tune in `Default()` to
accommodate for go's memory model.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-14 09:54:50 +02:00
Valentin Rothberg 6847ea48a2 containers.conf: implement modules
Add a new concept to containers.conf called "modules".  A "module" is
a containers.conf file located at a specific directory.  More than one
module can be loaded in the specified order, following existing
override semantics.

There are three directories to load modules from:
 - $CONFIG_HOME/containers/containers.conf.modules
 - /etc/containers/containers.conf.modules
 - /usr/share/containers/containers.conf.modules

With CONFIG_HOME pointing to $HOME/.config or, if set, $XDG_CONFIG_HOME.
Absolute paths will be loaded as is, relative paths will be resolved
relative to the three directories above allowing for admin configs
(/etc/) to override system configs (/usr/share/) and user configs
($CONFIG_HOME) to override admin configs.

Also move some functions from config.go for locality.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-14 09:40:27 +02:00
Valentin Rothberg 9e659206ec pkg/config: add a new API to create a Config
Add `New()` function to create a Config and deprecate `NewConfig` which is
a) not extensible and b) broken in the sense that no external caller was
actually using the argument.

Many call sites use `Default()` which now has improved documentation and
allows for interacting with `New().  Most call sites just need to access
a pro-loaded config (via `Default()`).  This config can overridden by
`New()` if the caller sets the specific option - a requirement for an
upcoming feature for Podman allowing to load user-specified configs via
CLI flags.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-14 09:40:27 +02:00
Valentin Rothberg 961863eab1 pkg/config: tests: do not load default config before each test
It's wasteful and `sut` was not a name I would now understand. Change
the tests that need a default config.  The diff also shows that the
tests would benefit a lot from a rewrite into a table-driven form but I
do not want to shave the entire Yak.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-14 09:40:27 +02:00
Valentin Rothberg e00d7e3560 pkg/config: unexport DefaultConfig
It has no external user and should not be exported to avoid any API
misuse; built-in defaults are an implementation detail.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2023-08-14 09:40:27 +02:00