6991 Commits

Author SHA1 Message Date
fd8ed0b2f2 Merge pull request #25796 from Luap99/kube-pod-empty
quadlet kube: consider empty pod as running
2025-04-08 14:07:42 +00:00
c89aa95560 Merge pull request #25828 from IAmJSD/patch-1
Make Go not panic on a partial update
2025-04-08 13:45:06 +00:00
20e1b9db3a Merge pull request #24791 from arsenalzp/issue_24664
Allow filtering containers by command
2025-04-08 12:55:09 +00:00
9cc7c2b4ab Make Go not panic on a partial container update
Right now, if you call Update with only part of the options struct added, it panics. This fixes that by only adding them if they are not nil.

Signed-off-by: Astrid Gealer <astrid@gealer.email>
2025-04-08 13:38:48 +01:00
8d1c373475 quadlet kube: consider empty pod as running
Since commit 945aade38b we do tear down the kube units if all pods
failed to start. This however broke the use case of an empty pod as we
did not consider that being starting successfully which is wrong and
caused a regression for at least one user.

To fix this special case the empty pod and consider that running.

Fixes: #25786
Fixes: 945aade38b ("quadlet kube: correctly mark unit as failed")

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-04 19:19:00 +02:00
0a0d05b3e3 Merge pull request #25781 from kolyshkin/rm-goimports
Use golangci-lint fmt for pkg/bindings
2025-04-04 09:38:25 +00:00
76eea47fb3 Merge pull request #25743 from kolyshkin/freebsd-golangci-lint
Add freebsd golangci lint run; fix remaining freebsd warnings
2025-04-03 18:30:54 +00:00
9d4e820264 Use golangci-lint fmt for pkg/bindings
golangci-lint v2 introduced a new command, fmt, which runs configured
formatters (see formatters in .golangci.yml).

Use this for generated files. Drop separate goimports binary.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 10:41:14 -07:00
f18c917ef8 ci: run golangci-lint on freebsd
This could have been done by simply running

	GOOS=freebsd ./bin/golangci-lint run [options] ./...

on Linux, but some freebsd code is using cgo (i.e. is linked to C
libraries), so real freebsd environment is required.

This also fixes the issue of ignoring linter errors for Windows and
Darwin (exit 0), introduced by commit c9b108d5b38.

Fixes: c9b108d5b38 ("Bump golangci-lint to v2.0.2")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 09:24:58 -07:00
b5a1b512c9 Fix overwriting the Healthcheck configuration from the image
If the --health-cmd flag is not specified, other flags such as --health-interval, --health-timeout, --health-retries, and --health-start-period are ignored if the image contains a Healthcheck. This makes it impossible to modify these Healthcheck configuration when a container is created.

Fixes: https://github.com/containers/podman/issues/20212
Fixes: https://issues.redhat.com/browse/RUN-2629

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-04-03 15:52:05 +02:00
5f582e9f11 pkg/emulation: add linux build tag for elf
Otherwise, golangci-lint on freebsd complains:

> pkg/emulation/elf.go:14:6: type elfPlatform is unused (unused)
> type elfPlatform struct {
>      ^
> pkg/emulation/elf.go:28:2: var knownELFPlatformHeaders is unused (unused)
> 	knownELFPlatformHeaders     = make(map[string][][]byte)
> 	^
> pkg/emulation/elf.go:29:2: var knownELFPlatformHeadersOnce is unused (unused)
> 	knownELFPlatformHeadersOnce sync.Once
> 	^
> pkg/emulation/elf.go:33:2: var knownELFPlatforms is unused (unused)
> 	knownELFPlatforms = []elfPlatform{
> 	^
> pkg/emulation/elf.go:157:23: func (*elfPlatform).header is unused (unused)
> func (e *elfPlatform) header() ([][]byte, error) {
>                       ^
> pkg/emulation/elf.go:208:6: func getKnownELFPlatformHeaders is unused (unused)
> func getKnownELFPlatformHeaders() map[string][][]byte {
>      ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
6bf1923f3e pkg/specgen: fix ST1019 on freebsd
> pkg/specgen/generate/oci_freebsd.go:15:2: ST1019: package "github.com/opencontainers/runtime-spec/specs-go" is being imported more than once (staticcheck)
> 	"github.com/opencontainers/runtime-spec/specs-go"
> 	^
> pkg/specgen/generate/oci_freebsd.go:16:2: ST1019(related information): other import of "github.com/opencontainers/runtime-spec/specs-go" (staticcheck)
> 	spec "github.com/opencontainers/runtime-spec/specs-go"
> 	^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
118670b31f pkg/specgen/generate: fix S1002 on freebsd
> pkg/specgen/generate/namespaces_freebsd.go:60:9: S1002: should omit comparison to bool constant, can be simplified to !jail.NeedVnetJail() (staticcheck)
> 	return jail.NeedVnetJail() == false
> 	       ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
851bd141af Fix errcheck warnings on freebsd
These two:

> libpod/container_internal_freebsd.go:183:33: Error return value of `c.runtime.state.UpdateContainer` is not checked (errcheck)
> 	c.runtime.state.UpdateContainer(nsCtr)
> 	                               ^
> pkg/specgen/generate/config_freebsd.go:51:12: Error return value is not checked (errcheck)
> 		addDevice(g, resolvedDevicePath)
> 		         ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
f589811073 pkg/rootless: fix ST1005 warning for freebsd
> pkg/rootless/rootless_freebsd.go:24:20: ST1005: error strings should not be capitalized (staticcheck)
> 	return false, -1, errors.New("Rootless mode is not supported on FreeBSD - run podman as root")
> 	                  ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
6c950bdb40 Remove unused code and data structures
No change in functionality.

I might be missing something here, but it appears to be unfinished and
unused.

Fixes: bbd085ad1e ("Podman Pod Create --cpus and --cpuset-cpus flags")
Fixes: 2d86051893 ("Pod Device-Read-BPS support")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-01 16:24:02 -07:00
4b2472595c Merge pull request #25753 from flouthoc/vendor-common
vendor: bump c/common to `9b0d134f392`
2025-04-01 19:09:00 +00:00
51bb71d1b3 vendor: bump c/common to 9b0d134f392
Bump common to 9b0d134f392f41de3f3065aad162e73a3904168e

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2025-04-01 09:58:43 -07:00
dac3fa2f97 pkg/specgen/generate: fix unused warning on freebsd
> pkg/specgen/generate/validate_freebsd.go:6:6: func verifyContainerResources is unused (unused)
> func verifyContainerResources(s *specgen.SpecGenerator) ([]string, error) {
>      ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:30:43 -07:00
18fdbaee80 pkg/machine/qemu: fix ST1016 linter warning on freebsd
> pkg/machine/qemu/stubber.go:92:23: ST1016: methods on the same type should have the same receiver name (seen 1x "v", 25x "q") (staticcheck)
> func (q *QEMUStubber) CreateVM(opts define.CreateVMOpts, mc *vmconfigs.MachineConfig, builder *ignition.IgnitionBuilder) error {
>                       ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:30:43 -07:00
061e1a17a9 pkg/rctl: fix fprintf statement
While at it, rename the file to have freebsd suffix instead of using
a go:build annotation.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
1739b7170e pkg/systemd/quadlet: rm splitPorts
Usage of splitPorts was removed by commit abc4cfb04 ("quadlet: allow
variables in PublishPort") but the function remained, as well as its
tests.

Drop those.

Found by running golangci-lint with --tests=false option.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
8bd73b7d2c pkg/machine/wsl: rm unused structures
Those are not used since commit 0c587f024 ("refactor(machine,wsl):
improve operations of Windows API").

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
2861bc3702 pkg/machine/qemu: rm unused code
Looks like this is a forgotten part of commit 9bb191df5
("[CI:MACHINE]Podman5 QEMU refactor"). The reason is,
linters for Windows skip pkg/machine/qemu, and linters
for freebsd are not run at all.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
9f0032d3fd pkg/machine/shim: fix unused warnings on windows
These:

> pkg/machine/shim/claim_unsupported.go:9:6: func dockerClaimHelperInstalled is unused (unused)
> func dockerClaimHelperInstalled() bool {
>      ^
> pkg/machine/shim/claim_unsupported.go:13:6: func claimDockerSock is unused (unused)
> func claimDockerSock() bool {
>      ^
> pkg/machine/shim/claim_unsupported.go:17:6: func dockerClaimSupported is unused (unused)
> func dockerClaimSupported() bool {
>      ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
d9090645c3 pkg/machine: fix various linter warnings
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
4638d434bc pkg/machine/wsl/wutil: fix imports formatting
Otherwise goimports linter complains.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
c1f9c0b127 pkg/machine/e2e: fix unparam warnings
This one:

> pkg/machine/e2e/config_windows_test.go:42:56: runSystemCommand - timeout always receives defaultTimeout (600000000000) (unparam)
> func runSystemCommand(binary string, cmdArgs []string, timeout time.Duration, wait bool) (*machineSession, error) {
>                                                        ^

and, subsequently, this one:

> pkg/machine/e2e/config_windows_test.go:41:56: runSystemCommand - wait always receives true (unparam)
> func runSystemCommand(binary string, cmdArgs []string, wait bool) (*machineSession, error) {
>                                                        ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
032250a478 pkg/binding/images: rm dead code
Here err is always nil, so the check is useless.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
486327e2b9 pkg/bindings/images: fix linter warning on Darwin
With GOOS=darwin, golangci-lint complains:

> pkg/bindings/images/build_unix.go:13:24: directive `//nolint:unconvert` is unused for linter "unconvert" (nolintlint)
> 		Dev: uint64(st.Dev), //nolint:unconvert
> 		                     ^

Indeed, Stat_t.Dev is always uint64 on darwin

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
0f975f8526 ci: rm allow-unused from nolintlint settings
This was added by commit 84e42877a ("make lint: re-enable revive"),
making nolintlint became almost useless.

Remove the ungodly amount of unused nolint annotations.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
bed6ee6bb7 pkg/machine/e2e: move windows-specific function to windows file
This allows to remove the 'nolint' annotation.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
cc4d904dd2 Fix QF1012 staticcheck warnings
> QF1012: Use fmt.Fprintf(...) instead of WriteString

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
f4f2580b0d ci: remove stylecheck linter
It is to be merged into staticcheck linter in golangci-lint v2.0.0.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
0105131b5c Fix QF1003: could use tagged switch" staticcheck warning
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
0dddc5e3c0 Apply De Morgan's law
This fixes a bunch of "QF1001: could apply De Morgan's law" warnings
from staticcheck linter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-31 12:27:55 -07:00
af19eeaeb4 add additional external container fiters
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
2025-03-31 20:18:16 +03:00
4264bf6876 remove github.com/google/gofuzz dependency
It is unused in our code and is archived upstream so get rid of it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 17:40:40 +02:00
ea1eeb523f remove github.com/crc-org/crc/v2 dependency
There is one user in the code and one in the tests.
First the test is testing an external function that doesn't seem to make
a lot of sense.

Second when we pull the machine image and renmae doesn't work it would
mean it is on a different disk. That should never happen.
The oci pull is to
~/.local/share/containers/podman/machine/<provider>/cache/<sha>/...
and then it gets moved to
~/.local/share/containers/podman/machine/qemu/cache/<sha>.<extension>

These can under normal circumstances never be on different disk as it
would mean the pulled sha is known ahead of time and then that the blob
path is a mount point which is unrealistic and not something we have to
support.

It also removes three transitive dependencies.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 14:39:51 +02:00
49c42d06dc pkg/machine/apple: simplify restNewEndpointToCmdLine()
We only use the http URL endpoint so we can remove the other code. There
is the question if we should not use direct unix sockets instead as this
seems much safer but that seems like a larger change that might need
more discussion.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 14:39:51 +02:00
5ad70c9c56 Don't depend on github.com/crc-org/vfkit/pkg/rest
Via github.com/gin-gonic/gin , this depends on _several_
large encoding / decoding packages, including a JIT
compiler. Maintaining <60 lines of code ourselves
seems well worth it.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-03-31 14:39:51 +02:00
60692ca350 Remove exclude_graphdriver_devicemapper build tag
As of commit d4c7ca39f ("update c/{buildah,common,image,storage} to
latest main") no dependencies use exclude_graphdriver_devicemapper tag.

This (hopefully) concludes the work of removing devicemapper graph
driver.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-30 00:30:03 -07:00
12ccbea1aa remove unused method references
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
2025-03-29 19:25:13 +02:00
a776c1d82a pkg/machine/vmconfigs: simplify IsFirstBoot
This is faster and, to my best knowledge, is equivalent to the old code.

Remove the error return (as we don't guarantee stable API here), and
simplify callers.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-28 17:55:53 -07:00
490eb476a8 Merge pull request #25717 from jankaluza/cdi-spec-dir
Add cdi-spec-dir option to top level options
2025-03-28 13:52:20 +00:00
dce36131ae Add cdi-spec-dir option to top level options.
This commit adds new --cdi-spec-dir global option. This
option is used to add additional CDI spec paths.

Signed-off-by: Micah Chambers (eos) <mchambers@anduril.com>
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-03-28 11:24:57 +01:00
71c747422e Merge pull request #25323 from axel7083/fix/single-character-volume
fix: mounting issue with single character volume on windows
2025-03-27 14:47:34 +00:00
44cbefff5d fix remove unnecessary err check
Signed-off-by: sianao <me@sianao.site>
2025-03-27 15:27:52 +08:00
71ed3f0fa9 Merge pull request #25673 from Luap99/hyperv-ci
CI: use z1d instance for windows machine testing
2025-03-26 17:24:42 +00:00
ea5ed2a875 fix: mounting issue with single character volume on windows
fixes https://github.com/containers/podman/issues/25218

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
2025-03-26 17:57:52 +01:00