Commit Graph

4069 Commits

Author SHA1 Message Date
openshift-merge-bot[bot] e7905122d7
Merge pull request #23679 from ruihe774/pod-userns
quadlet: support user mapping in pod unit
2024-08-22 12:33:43 +00:00
Misaki Kasumi 4fbfa7de6e quadlet: support user mapping in pod unit
Signed-off-by: Misaki Kasumi <misakikasumi@outlook.com>
2024-08-22 09:41:06 +08:00
Daniel J Walsh 29071ac498
command is not optional to podman exec
Fixes: https://github.com/containers/podman/issues/22849

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-08-21 08:45:50 -04:00
Matt Heon 458ba5a8af Fix `podman stop` and `podman run --rmi`
This started off as an attempt to make `podman stop` on a
container started with `--rm` actually remove the container,
instead of just cleaning it up and waiting for the cleanup
process to finish the removal.

In the process, I realized that `podman run --rmi` was rather
broken. It was only done as part of the Podman CLI, not the
cleanup process (meaning it only worked with attached containers)
and the way it was wired meant that I was fairly confident that
it wouldn't work if I did a `podman stop` on an attached
container run with `--rmi`. I rewired it to use the same
mechanism that `podman run --rm` uses, so it should be a lot more
durable now, and I also wired it into `podman inspect` so you can
tell that a container will remove its image.

Tests have been added for the changes to `podman run --rmi`. No
tests for `stop` on a `run --rm` container as that would be racy.

Fixes #22852
Fixes RHEL-39513

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-08-20 09:51:18 -04:00
Paul Holzinger 942f789a88
set !remote build tags where needed
The new golangci-lint version 1.60.1 has problems with typecheck when
linting remote files. We have certain pakcages that should never be
inlcuded in remote but the typecheck tries to compile all of them but
this never works and it seems to ignore the exclude files we gave it.

To fix this the proper way is to mark all packages we only use locally
with !remote tags. This is a bit ugly but more correct. I also moved the
DecodeChanges() code around as it is called from the client so the
handles package which should only be remote doesn't really fit anyway.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-08-19 11:41:28 +02:00
Paul Holzinger c17daf2b09
update golangci-lint to 1.60.1
Fixes new spotted issues around printf() formats and using os.Setenv()
in tests.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-08-19 11:41:28 +02:00
Chad Dougherty 478b262f9b
remove trailing comma in example
Signed-off-by: Chad Dougherty <crd@acm.org>
2024-08-15 11:21:27 -04:00
openshift-merge-bot[bot] 708d6c5e2b
Merge pull request #23449 from ygalblum/quadlet-override-service-name
Quadlet override service name
2024-08-12 13:56:48 +00:00
openshift-merge-bot[bot] 7acaf714ca
Merge pull request #23496 from rhatdan/manifest
Should not force conversion of manifest type to DockerV2ListMediaType
2024-08-12 13:36:30 +00:00
Uzinn Kagurazaka b0948a5cd0
Quadlet: fix filters failure when the search paths are symlinks
Rootless units placed in `users` would be loaded for root when
`/etc/containers/systemd` is a symlink. In this case, since
`UnitDirAdmin` is hardcoded, `userLevelFilter` always returns `true`.
If `/etc/containers/systemd/users` is a symlink, any user would load
other users' units.
Fix the above two problems.

Fixes: #23483

Signed-off-by: Uzinn Kagurazaka <uzinn.kagurazaka@11555511.xyz>
2024-08-11 18:01:13 +08:00
Ygal Blum 795851edd3 Quadlet - Allow the user to override the default service name
Add support for the ServiceName key for all unit types
Extend the PodInfo struct into UnitInfo to consolidate all prepopulated data into a single map
Use the NodesInfo map instead of the resourceName
Update the UnitInfo in the convert function instead of returning it
No need to replace extension anymore just remove it
All e2e tests with dependencies on other Quadlet files moved to a separate section
Add the capability of overriding the service name in the test
Add e2e tests for the new functionality
Adjust integration tests
Update the MAN page

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
2024-08-07 17:50:49 +03:00
Daniel J Walsh a06a7d7ba8
Should not force conversion of manifest type to DockerV2ListMediaType
Fixes: https://github.com/containers/podman/issues/23163

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-08-07 06:07:46 -04:00
tomsweeneyredhat b8a9b184af Add --compat-volumes option to build and farm build
Add the `--compat-volumes option from Buildah v1.37 into
Podman in preparation of Podman v5.2

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
2024-07-30 18:26:13 -04:00
Petter Mikkelsen cfac059d14 Disable compose-warning-logs if PODMAN_COMPOSE_WARNING_LOGS=false
Fixes: e62c928642 ("Make podman-compose refer to podman-compose(1) when using an external provider")

- test: add coverage for PODMAN_COMPOSE_WARNING_LOGS

Signed-off-by: Petter Mikkelsen <43xhyr9m@anonaddy.me>
2024-07-30 12:06:11 +00:00
Daniel J Walsh ce7dded38b
Add /run/containers/systemd, ${XDG_RUNTIME_DIR}/containers/systemd quadlet dirs
Fixes: https://github.com/containers/podman/issues/23363

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-07-24 09:28:00 -04:00
Paul Holzinger 85f4f89810
system connection remove: use Args function to validate
Using the ExactArgs(1) function is better because we have less
duplication of the error text and the ValidArgsFunction uses that to
suggest shell completion. The command before this commit would suggest
connection names even if there was already one arg on the cli set.

However because there is the --all option we still must exclude that
first.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-07-18 16:37:37 +02:00
openshift-merge-bot[bot] eecdba4009
Merge pull request #23304 from rhatdan/gpus
Remove references and checks for --gpus
2024-07-18 12:21:10 +00:00
benniekiss 3c52ef43f5 Expand drop-in search paths
* top-level (pod.d)
* truncated (unit-.container.d)

Signed-off-by: Bennie Milburn-Town <63211101+benniekiss@users.noreply.github.com>
2024-07-17 17:43:02 -04:00
Daniel J Walsh 5666100c2e
Remove references and checks for --gpus
No way to test this unless running on a nvidia platform.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-07-17 12:02:51 -04:00
openshift-merge-bot[bot] e225cae781
Merge pull request #23145 from afbjorklund/remove-machine-volume-driver
Remove the unused machine volume-driver
2024-07-15 20:36:19 +00:00
Anders F Björklund f3e945c86e Keep the volume-driver flag deprecated
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2024-07-15 21:41:34 +02:00
Giuseppe Scrivano 317a88ee4e
cmd: call shutdown handler stop function
it is needed to wait for the handlers if they are currently being processed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-07-14 20:06:46 +02:00
openshift-merge-bot[bot] e62c928642
Merge pull request #23074 from marinmo/podman-compose-providerfix
Make podman-compose refer to podman-compose(1) when using an external provider
2024-07-12 13:48:33 +00:00
marinmo 02af4f8bd6 Update warning message when using external compose provider
Change the warning message at runtime to refer to the man page of podman-compose instead of "the documentation"

Add instructions in the man page on how to disable the warning emitted by podman-compose when using an external compose provider

Signed-off-by: marinmo <bugzilla@marinmo.org>
2024-07-12 07:12:32 +02:00
openshift-merge-bot[bot] 46840fa854
Merge pull request #23170 from Luap99/events
podman events: fix error race
2024-07-05 07:02:47 +00:00
openshift-merge-bot[bot] b3dab682b1
Merge pull request #22972 from BlackHole1/improve-error
refactor(build): improve err when file specified by -f does not exist
2024-07-03 12:59:16 +00:00
Paul Holzinger d00e68e550
podman events: fix error race
The events code makes use of two channels, one for the events and one
for the resulting error. Then in the main file we have a loop reading
from both channels that should exit on first error it gets.

However in case the event channel is closed before the error channel
cotains the error it could caused an early exit as it looked like all
events were done. Commit c46884aa93 fixed that somewhat by checking for
an error in the error channel before exiting. This however was still
racy as it added a default case in the select which means the channel
check is non blocking. Thus the error was not yet send into the channel.

To fix this we should make it a blocking read to wait for the error in
the channel. Also the err != nil check can be removed as we either
return err or nil anyway.

And as last step make sure the error channel is closed, that prevents us
from blocking forever in case the main select already processed the nil
error.

Fixes #23165

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-07-03 11:21:30 +02:00
openshift-merge-bot[bot] 3a41bccf7d
Merge pull request #22941 from ashley-cui/machreset
Podman machine resets all providers
2024-07-01 19:24:18 +00:00
Anders F Björklund fa75599569 Remove the unused machine volume-driver
The driver is now hardcoded again, and there can only be
one type of mounts at a time (which one changes over time)

Revert "Make it possible to select the volume driver"
This reverts commit 6630e5cf66.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2024-06-30 20:25:59 +02:00
Brent Baude 786ea01a64 Error when machine memory exceeds system memory
Close loophole that would allow you to assign more memory than the
system has to a podman machine

Fixes: #18206

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-06-28 10:02:11 -05:00
Ashley Cui 069eace84b Podman machine resets all providers
Podman machine reset now removes and resets machines from all providers availabe on the platform.

On windows, if the user is does not have admin privs, machine will only reset WSL, but will emit a warning that it is unable to remove hyperV machines without elevated privs.

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-06-27 13:14:29 -04:00
Kevin Cui 3703cbf1d7
refactor(build): improve err when file specified by -f does not exist
When the user specifies a Containerfile or Dockfile with the -f flag in podman build, if the file does not exist, the error should be intuitive to the user.

Fixed: #22940

Signed-off-by: Kevin Cui <bh@bugs.cc>
2024-06-27 14:12:20 +08:00
Paul Holzinger a158eae7ff
podman run use pod userns even with --pod-id-file
The pod was set after we checked the namespace and the namespace code
only checked the --pod flag but didn't consider --pod-id-file option.
As such fix the check to first set the pod option on the spec then use
that for the namespace. Also make sure we always use an empty default
otherwise it would be impossible in the backend to know if a user
requested a specific userns or not, i.e. even in case of a set
PODMAN_USERNS env a container should still get the userns from the pod
and not use the var in this case. Therefore unset it from the default
cli value.

There are more issues here around --pod-id-file and cli validation that
does not consider the option as conflicting with --userns like --pod
does but I decided to fix the bug at hand and don't try to fix the
entire mess which most likely would take days.

Fixes #22931

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-24 17:18:08 +02:00
openshift-merge-bot[bot] 673dde9ec5
Merge pull request #23043 from miyamo2/feat/issues#23038
fix(diff): do not suggest `--latest` when runs on remote with no args
2024-06-24 07:24:55 +00:00
miyamo2 5d009715f6 added check for `registry.IsRemote()`. and correct error message.
Signed-off-by: miyamo2 <miyamo2@outlook.com>
2024-06-23 15:45:41 +00:00
openshift-merge-bot[bot] 42a01c0f0c
Merge pull request #22967 from rhatdan/build
Remove references to --pull=true and --pull=false
2024-06-21 19:27:36 +00:00
Paul Holzinger 4b3890ccac
remote: fix incorrect CONTAINER_CONNECTION parsing
When a user specifies a invalid connection in CONTAINER_CONNECTION then
podman should return a proper error saying so. Currently it ignored the
error and in rootFlags() just exited early with defining any flags. This
caused a panic then when trying to use the flags later.

In order to address this first store the connection error in the
PodmanConfig struct and not abort right away during flag setup. This is
important as the user might have specified a flag with a valid remote
connection. As such we check all flags and only when none were given we
return the connection error.

Also while at it I noticed that the default connection reported via
podman --help was wrong as it only used the old containers.conf field
for it and did not consider the podman-connections.json default.

New regression tests have been added to make sure it behaves correctly.

This fixes the problem reported in the PR #22997.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-21 14:01:22 +02:00
openshift-merge-bot[bot] 00bcd9aa81
Merge pull request #22733 from nalind/system-check
Add `podman system check`
2024-06-13 10:35:56 +00:00
Daniel J Walsh 64091777fe
Remove references to --pull=true and --pull=false
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-06-12 18:16:29 +02:00
Giuseppe Scrivano 730a215025
podman: add new hidden flag --pull-option
add a new flag that allows to override the pull options configured in
the storage.conf file.

e.g.: --pull-option="enable_partial_images=false" can be specified to
Podman to disable partial pulls even if enabled.

Leave it as a hidden configuration flag for now since the API itself
is marked as experimental in c/storage.

Currently c/storage doesn't honor the overrides, being fixed with
https://github.com/containers/storage/pull/1966

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-06-12 15:48:36 +02:00
openshift-merge-bot[bot] 798beb47ec
Merge pull request #22694 from jmaibaum/quadlet-build
Quadlet: Add support for .build files
2024-06-11 20:41:28 +00:00
openshift-merge-bot[bot] e0a7adec68
Merge pull request #22957 from rhatdan/squash
--squash --layers=false should be allowed
2024-06-11 19:16:12 +00:00
Daniel J Walsh ad8fc6a74b
--squash --layers=false should be allowed
This is the same as what --squash-all is doing, and we already support
--squash with --layers=true since this is the default.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-06-10 13:24:05 -04:00
Paul Holzinger fa4f11facc
update golangci-lint to v1.59.1
Includes fixes for new lint warnings from unparam and usestdlibvars.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-06-10 14:57:45 +02:00
Nalin Dahyabhai 2e70d4201f System tests: add `podman system check` tests
Testing `podman system check` requires that we have a way to
intentionally introduce storage corruptions.  Add a hidden `podman
testing` command that provides the necessary internal logic in
subcommands.  Stub out the tunnel implementation for now.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-04 10:00:37 -04:00
Nalin Dahyabhai fec58a4571 Add `podman system check` for checking storage consistency
Add a `podman system check` that performs consistency checks on local
storage, optionally removing damaged items so that they can be
recreated.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-06-04 10:00:37 -04:00
openshift-merge-bot[bot] 6417fa7b0f
Merge pull request #22850 from giuseppe/do-not-move-podman-cgroups-disabled
libpod: do not move podman with --cgroups=disabled
2024-05-30 20:32:57 +00:00
Giuseppe Scrivano 900e29549a
libpod: do not move podman with --cgroups=disabled
The expectation with --cgroups=disabled is that the current cgroup is
used by the container.

Currently the --cgroups=disabled is passed directly to the OCI
runtime, but it doesn't stop Podman from creating a new cgroup when it
doesn't own the current one.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-05-30 16:59:30 +02:00
openshift-merge-bot[bot] 8b15ec9b29
Merge pull request #22643 from qianxi0410/duplicate-isremote
Remove duplicate `IsRemote`  call
2024-05-30 12:47:53 +00:00
Johannes Maibaum 9f823ecb25 Quadlet: Add support for .build files
.build files allow to build an image via Quadlet. The keys from a .build
file are translated to arguments of a `podman build` command by Quadlet.

Minimal keys for .build files are `ImageTag=` and a context directory,
see `SetWorkingDirectory=`, or a `File=` pointing to a Containerfile.

After sorting .build files into the Quadlet dependency order, there
remains a possible dependency cycle issue between .volume and .build
files: A .volume can have `Image=some.build`, and a .build can have
`Volume=some.volume:/some/volume`.

We solve this dependency cycle by prefilling resourceNames with all
image names from .build files before converting all the unit files.

This results in an issue for the test suite though: For .volume's
depending on *.image or *.build, we need to copy these additional
dependencies to the test's quadletDir, otherwise the test will fail.
This is necessary, because `handleImageSource()` actually needs to know
the image name defined in the referenced *.{build,image} file. It cannot
fall back on the default names, as it is done for networks or volumes,
for example.

Signed-off-by: Johannes Maibaum <jmaibaum@gmail.com>
2024-05-27 16:59:39 +02:00