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>
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>
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>
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>
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>
> 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>
> 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>
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>
> 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>
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>
> 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>
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>
Those are not used since commit 0c587f024 ("refactor(machine,wsl):
improve operations of Windows API").
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>