24900 Commits

Author SHA1 Message Date
f87ab2b7a6 fix network DB desync after failed connect/disconnect
Networks are stored in two ways in the DB, first a static network list
which holds all the network with its option for the container. Second,
the network status which hold the actual network result from netavark
but only when the container is running.

If the container is running they must be in sync and podman inspect has
checks to ensure that as well it errors out of there is a desync between
the two.

As the adding to the db and doing actual networking configuration are
diffeent parts it possible that one worked while the other failed which
triggers the desync. To avoid this make the network connect/disconnect
code more robust against partial failures. When the network calls fail
we update the db again to remove/add the network back.

Fixes: https://issues.redhat.com/browse/RHEL-78037

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-04 14:42:20 +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
951a2ce7bb Merge pull request #25784 from containers/renovate/actions-create-github-app-token-2.x
[skip-ci] Update actions/create-github-app-token action to v2
2025-04-04 09:21:55 +00:00
e65bbab04d Merge pull request #25773 from kolyshkin/freebsd-no-seccomp
Makefile: exclude seccomp build tag for !linux
2025-04-04 02:20:23 +00:00
af7c6f8669 Merge pull request #25742 from mohanboddu/triage
Add documentation describing how to triage issues
2025-04-03 20:10:04 +00:00
5148cf3c14 [skip-ci] Update actions/create-github-app-token action to v2
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-03 19:51:47 +00:00
dced2bf9ef Merge pull request #25769 from Luap99/pasta-doc
docs: update pasta options description
2025-04-03 19:50:53 +00:00
72acbc804a Add documentation describing how to triage issues
This document is to help the maintainers on how to traige new issues.

Adding a link to REVIEWING.md in CONTRIBUTING.md

Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2025-04-03 15:31:00 -04: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
055fc82bd2 Makefile: exclude seccomp build tag for !linux
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 10:09:07 -07:00
a8dd9bc1ed Makefile: use GOOS/NATIVE_GOOS instead of uname -s
Saves a few fork/execs, and unify the code since other places are
already using NATIVE_GOOS or GOOS.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 10:08:49 -07:00
b959ca3577 .cirrus.yml: add golangci-lint cache for freebsd task
This shaves the linting time:
 - from 8 to 2 minutes on Cirrus CI with 4 CPUs and 8 GB RAM;
 - from 11 to 3 minutes on Cirrus CI with 2 CPUs and 4 GB RAM;
when the cache is reused.

The cache size is quite modest (~3MB compressed, ~7MB uncompressed).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 09:25:02 -07:00
c958d5b3ba .cirrus.yml: upsize the freebsd instance
An attempt to speed up golangci-lint.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-03 09:25:02 -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
ed6643761e Merge pull request #25676 from Honny1/override-hc
Fix overwriting the Healthcheck configuration from the image
2025-04-03 15:31:28 +00: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
1f90cc1126 docs: update pasta options description
First, remove wrong sentence that says ports are forwarded dynamically
by default. That is wrong and contradicts what is written below.
Second, document that we also set --dns-forward and --map-guest-addr by
default. And lastly document the containers.conf field so users know
they are not forced to set the options on each command.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-04-03 15:50:59 +02:00
61693432e6 Merge pull request #25732 from kolyshkin/ginkgo
test/tools/vendor: drop ginkgo
2025-04-03 13:21:43 +00:00
05640dc0a9 Merge pull request #25772 from kolyshkin/cache-golangci
cirrus: save/restore golangci-lint cache for linux
2025-04-03 13:13:28 +00:00
e5daf60cf6 Merge pull request #25775 from jankaluza/idmap
Set the IDMappings also when RootfsOverlay is used.
2025-04-03 12:51:36 +00:00
1d312653be Merge pull request #25776 from subrat-lima/docs-introduction
docs: delete the duplicated phrase in introduction page
2025-04-03 12:29:25 +00:00
ed34015474 Merge pull request #25771 from kolyshkin/install-golangci
Assorted minor fixes to hack/install_golangci.sh
2025-04-03 10:14:29 +00:00
64f822f857 docs: delete the duplicated phrase in introduction page
Signed-off-by: Subrat Lima <subrat.k.lima@protonmail.com>
2025-04-03 15:32:45 +05:30
9277643ead Set the IDMappings also when RootfsOverlay is used.
This is related to #23292 and is needed to replace
pause image container with pause container based
on the rootfs.

Without this change, the GIDs and UIDs are not mapped
in the rootfs container which use overlay if --userns=auto
is used. This leads to an error mounting /dev/pts with gid=5,
becuase GID 5 simply does not exist in the pause container
using rootfs.

All the tests pass with this change, but I have to admit
I did not find out why the original code has been introduced.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-04-03 11:55:45 +02:00
fbb118ed7e cirrus: save/restore golangci-lint cache for linux
This shaves off some time from golangci-lint run.

For linux, it's down from 5 to 3 minutes (for the whole task, not just
the golangci-lint runs), and the cache is only ~7MB (according to
golangci-lint, probably uncompressed) or ~2MB (according to cirrus CI,
probably compressed).

For Mac, due to remote build tag we don't lint much so linting takes
less than a minute, so it is not worth optimizing.

For Windows, similar.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 20:09:47 -07:00
403d126ac8 hack/install_golang.sh: revamp
1. Strip leading v from VERSION.

This will allow to simplify renovate rule at [1].

2. Fix git branch in the URL.

In golangci-lint v2 they've switched from master to main,
and it's not clear what will happen to master over time,
so let's just switch to main prophylactically.

3. Use -b option instead of undocumented hack.

Instead of relying on an undocumented feature of having BINDIR,
let's use -b option as recommended by the official docs at [2].

4. Avoid stuttering in the output.

Before:

	[kir@kir-tp1 podman]$ VERSION=2.0.2 ./hack/install_golangci.sh
	golangci-lint has version 2.0.2 built with go1.24.1 from 2b224c2c on 2025-03-25T21:36:18Z
	Using existing ./bin/golangci-lint has version 2.0.2 built with go1.24.1 from 2b224c2c on 2025-03-25T21:36:18Z

After:

	[kir@kir-tp1 podman]$ VERSION=2.0.2 ./hack/install_golangci.sh
	golangci-lint has version 2.0.2 built with go1.24.1 from 2b224c2c on 2025-03-25T21:36:18Z
	Using existing ./bin/golangci-lint

5. Fix shellcheck warnings.

6. Also retry when reinstalling.

The code logic to retry install for up to 5 times when installation
fails was introduced by commit dd8574022d ("CI: retry the golangci
install").

For some reason, the above commit only uses the logic when the binary is
not found. In a situation when the binary is found but is of the wrong
version, no retries are done.

Fix that.

7. Add -f option to curl.

As recommended by the official installation docs at [2].

[1]: 16f757f699/renovate/defaults.json5 (L106-L108)
[2]: https://golangci-lint.run/welcome/install/#binaries

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 19:19:05 -07:00
7882de95ff libpod: fix whitespace linter issue on freebsd
> libpod/networking_freebsd.go:228:1: unnecessary trailing newline (whitespace)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
421ee18e18 libpod: add a nolint:wastedassign annotation
TODO: figure this out :)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07: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
8c0c1c8906 libpod: fix wastedassign warning on freebsd
This one:

> libpod/container_internal_freebsd.go:255:2: assigned to foundUTS, but reassigned without using the value (wastedassign)
> 	foundUTS := false
> 	^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
30fd68cb23 libpod: rm some unused freebsd code
This fixes a bunch of "unused" linter warnings on freebsd.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
8754687b55 libpod: move linux-specific code to _linux.go
This fixes a few "unused" linter warnings on freebsd.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
c1c963affe libpod: fix unconvert linter warning
When linting for freebsd, Stat_t Bsize is always uint64, thus the
following warning:

> libpod/info.go:234:21: unnecessary conversion (unconvert)
> 	allocated := uint64(grStats.Bsize) * grStats.Blocks
> 	                   ^

Use an intermediate variable to save on linter annotations.

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
0eea1cb297 libpod: don't capitalize error string
This fixes the following warning:

> libpod/networking_freebsd.go:148:19: ST1005: error strings should not be capitalized (staticcheck)
> 		return "", nil, fmt.Errorf("Failed to create vnet jail %s for container %s: %w", netns, ctr.ID(), err)
> 		                ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
66c7efdb6b libpod: use context.TODO to fix SA1012 on freebsd
This one:

> libpod/container_internal_freebsd.go:393:37: SA1012: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (staticcheck)
> 		inspectData, err := image.Inspect(nil, nil)
> 		                                  ^

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
4165877c58 libpod: gix a govet warning on freebsd
> libpod/networking_freebsd.go:160:4: printf: github.com/sirupsen/logrus.Errorf does not support error-wrapping directive %w (govet)
> 			logrus.Errorf("failed to destroy vnet jail %s: %w", netns, err)
> 			^

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
8fd7143e36 cmd/podman-testing: fix freebsd compilation
This fixes:

cmd/podman-testing/create.go:1: : # github.com/containers/podman/v5/cmd/podman-testing
cmd/podman-testing/main.go:65:12: undefined: storeBefore
cmd/podman-testing/main.go:69:28: undefined: engineMode
cmd/podman-testing/main.go:99:12: undefined: storeAfter (typecheck)

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-04-02 13:35:14 -07:00
c6189c5b51 test/checkseccomp: add linux build tag
This is a linux-only binary.

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
4f75d0be47 Merge pull request #25770 from containers/renovate/github.com-onsi-gomega-1.x
fix(deps): update module github.com/onsi/gomega to v1.37.0
2025-04-02 19:31:33 +00:00
dac6de0f1d Merge pull request #25757 from baude/needsinfo
Add autocomment for `needs-info` label
2025-04-02 19:26:09 +00:00
1d8947965d Merge pull request #25764 from xixishidibei/main
chore: fix function name in comment
2025-04-02 19:09:30 +00:00
d04783ad8e Merge pull request #25398 from mheon/add_governance
Add initial draft of Podman project Governance
2025-04-02 18:44:47 +00:00
f938f0d175 Merge pull request #25768 from baude/updateroadmap2q25
Update roadmap for 2Q 2025
2025-04-02 18:36:23 +00:00
783f0c8076 fix(deps): update module github.com/onsi/gomega to v1.37.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-04-02 18:13:17 +00:00
0d7ffeb1e9 Merge pull request #25767 from plettich/update_documentation
Update links and markup in man pages
2025-04-02 18:11:41 +00:00