From 3ca3c1d456dae3d0b99bb5a74d4991058785a52e Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 14 Aug 2024 13:14:02 +0200 Subject: [PATCH 1/7] [v5.2] 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 Signed-off-by: tomsweeneyredhat --- Makefile | 2 +- cmd/podman/containers/create.go | 2 +- libpod/container_top_linux.go | 2 +- pkg/annotations/validate.go | 3 ++- pkg/autoupdate/autoupdate.go | 2 +- pkg/machine/ignition/ignition.go | 2 +- pkg/specgen/generate/config_linux.go | 2 +- pkg/specgen/generate/pod_create.go | 2 +- pkg/systemd/activation_test.go | 10 +++++----- pkg/systemd/quadlet/quadlet.go | 4 ++-- 10 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 1ed758f0ce..5b4adf4c88 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ BUILDTAGS += ${EXTRA_BUILDTAGS} # N/B: This value is managed by Renovate, manual changes are # possible, as long as they don't disturb the formatting # (i.e. DO NOT ADD A 'v' prefix!) -GOLANGCI_LINT_VERSION := 1.59.1 +GOLANGCI_LINT_VERSION := 1.60.1 PYTHON ?= $(shell command -v python3 python|head -n1) PKG_MANAGER ?= $(shell command -v dnf yum|head -n1) # ~/.local/bin is not in PATH on all systems diff --git a/cmd/podman/containers/create.go b/cmd/podman/containers/create.go index 5edeb2afac..15e714b342 100644 --- a/cmd/podman/containers/create.go +++ b/cmd/podman/containers/create.go @@ -314,7 +314,7 @@ func CreateInit(c *cobra.Command, vals entities.ContainerCreateOptions, isInfra vals.ShmSizeSystemd = c.Flag("shm-size-systemd").Value.String() } if (c.Flag("dns").Changed || c.Flag("dns-option").Changed || c.Flag("dns-search").Changed) && vals.Net != nil && (vals.Net.Network.NSMode == specgen.NoNetwork || vals.Net.Network.IsContainer()) { - return vals, fmt.Errorf("conflicting options: dns and the network mode: " + string(vals.Net.Network.NSMode)) + return vals, errors.New("conflicting options: dns and the network mode: " + string(vals.Net.Network.NSMode)) } noHosts, err := c.Flags().GetBool("no-hosts") if err != nil { diff --git a/libpod/container_top_linux.go b/libpod/container_top_linux.go index 0b85a5a705..bc8ed2511b 100644 --- a/libpod/container_top_linux.go +++ b/libpod/container_top_linux.go @@ -411,7 +411,7 @@ func (c *Container) execPSinContainer(args []string) ([]string, error) { if logrus.GetLevel() >= logrus.DebugLevel { // If we're running in debug mode or higher, we might want to have a // look at stderr which includes debug logs from conmon. - logrus.Debugf(errBuf.String()) + logrus.Debug(errBuf.String()) } if err := <-outErrChan; err != nil { diff --git a/pkg/annotations/validate.go b/pkg/annotations/validate.go index 4ddeea30ed..1e9c3bf866 100644 --- a/pkg/annotations/validate.go +++ b/pkg/annotations/validate.go @@ -1,6 +1,7 @@ package annotations import ( + "errors" "fmt" "regexp" "strings" @@ -41,7 +42,7 @@ func isDNS1123Subdomain(value string) error { } if !dns1123SubdomainRegexp.MatchString(value) { - return fmt.Errorf(regexErrorMsg(dns1123SubdomainErrorMsg, dns1123SubdomainFmt, "example.com")) + return errors.New(regexErrorMsg(dns1123SubdomainErrorMsg, dns1123SubdomainFmt, "example.com")) } return nil diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go index df6627e378..f82090399f 100644 --- a/pkg/autoupdate/autoupdate.go +++ b/pkg/autoupdate/autoupdate.go @@ -131,7 +131,7 @@ func AutoUpdate(ctx context.Context, runtime *libpod.Runtime, options entities.A // Connect to DBUS. conn, err := systemd.ConnectToDBUS() if err != nil { - logrus.Errorf(err.Error()) + logrus.Error(err.Error()) allErrors = append(allErrors, err) return nil, allErrors } diff --git a/pkg/machine/ignition/ignition.go b/pkg/machine/ignition/ignition.go index 58e7b622f1..62bf7a872f 100644 --- a/pkg/machine/ignition/ignition.go +++ b/pkg/machine/ignition/ignition.go @@ -303,7 +303,7 @@ func getFiles(usrName string, uid int, rootful bool, vmtype define.VMType, _ boo lingerExample.Add("Service", "ExecStart", "/usr/bin/sleep infinity") lingerExampleFile, err := lingerExample.ToString() if err != nil { - logrus.Warnf(err.Error()) + logrus.Warn(err.Error()) } containers := `[containers] diff --git a/pkg/specgen/generate/config_linux.go b/pkg/specgen/generate/config_linux.go index ddca2b151c..5954b78c22 100644 --- a/pkg/specgen/generate/config_linux.go +++ b/pkg/specgen/generate/config_linux.go @@ -176,7 +176,7 @@ func shouldMask(mask string, unmask []string) bool { for _, m1 := range strings.Split(m, ":") { match, err := filepath.Match(m1, mask) if err != nil { - logrus.Errorf(err.Error()) + logrus.Error(err.Error()) } if match { return false diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 79348aec8b..c4c8dc4511 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -268,7 +268,7 @@ func MapSpec(p *specgen.PodSpecGenerator) (*specgen.SpecGenerator, error) { spec.ConmonPidFile = p.InfraConmonPidFile } - if p.Sysctl != nil && len(p.Sysctl) > 0 { + if len(p.Sysctl) > 0 { spec.Sysctl = p.Sysctl } diff --git a/pkg/systemd/activation_test.go b/pkg/systemd/activation_test.go index 687472206f..0a411bcaa0 100644 --- a/pkg/systemd/activation_test.go +++ b/pkg/systemd/activation_test.go @@ -14,19 +14,19 @@ func TestSocketActivated(t *testing.T) { assert.False(SocketActivated()) // different pid - assert.NoError(os.Setenv("LISTEN_PID", "1")) + t.Setenv("LISTEN_PID", "1") assert.False(SocketActivated()) // same pid no fds - assert.NoError(os.Setenv("LISTEN_PID", strconv.Itoa(os.Getpid()))) - assert.NoError(os.Setenv("LISTEN_FDS", "0")) + t.Setenv("LISTEN_PID", strconv.Itoa(os.Getpid())) + t.Setenv("LISTEN_FDS", "0") assert.False(SocketActivated()) // same pid some fds - assert.NoError(os.Setenv("LISTEN_FDS", "1")) + t.Setenv("LISTEN_FDS", "1") assert.True(SocketActivated()) // FDNAME is ok too (but not required) - assert.NoError(os.Setenv("LISTEN_FDNAMES", "/meshuggah/rocks")) + t.Setenv("LISTEN_FDNAMES", "/meshuggah/rocks") assert.True(SocketActivated()) } diff --git a/pkg/systemd/quadlet/quadlet.go b/pkg/systemd/quadlet/quadlet.go index c21ec2a151..611d98c14c 100644 --- a/pkg/systemd/quadlet/quadlet.go +++ b/pkg/systemd/quadlet/quadlet.go @@ -1678,7 +1678,7 @@ func handleUserRemap(unitFile *parser.UnitFile, groupName string, podman *Podman autoOpts = append(autoOpts, fmt.Sprintf("size=%v", uidSize)) } - podman.addf("--userns=" + usernsOpts("auto", autoOpts)) + podman.add("--userns=" + usernsOpts("auto", autoOpts)) case "keep-id": if !isUser { return fmt.Errorf("RemapUsers=keep-id is unsupported for system units") @@ -1698,7 +1698,7 @@ func handleUserRemap(unitFile *parser.UnitFile, groupName string, podman *Podman keepidOpts = append(keepidOpts, "gid="+gidMaps[0]) } - podman.addf("--userns=" + usernsOpts("keep-id", keepidOpts)) + podman.add("--userns=" + usernsOpts("keep-id", keepidOpts)) default: return fmt.Errorf("unsupported RemapUsers option '%s'", remapUsers) From 35290c9b324e17290700660a0c91ac1a7a245641 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 15 Aug 2024 13:15:59 +0200 Subject: [PATCH 2/7] [v5.2] 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 Signed-off-by: tomsweeneyredhat --- cmd/podman-testing/create.go | 2 ++ cmd/podman-testing/data.go | 2 ++ cmd/podman-testing/layer.go | 2 ++ cmd/podman-testing/main.go | 2 ++ cmd/podman-testing/remove.go | 2 ++ cmd/podman-testing/store_supported.go | 1 - cmd/podman-testing/store_unsupported.go | 16 ------------ cmd/podman/containers/commit.go | 4 --- internal/domain/entities/engine_testing.go | 2 ++ internal/domain/entities/testing.go | 2 ++ internal/domain/infra/abi/testing.go | 2 ++ internal/domain/infra/abi/testing_test.go | 2 ++ internal/domain/infra/runtime_tunnel.go | 25 ------------------- internal/domain/infra/tunnel/testing.go | 2 ++ internal/domain/infra/tunnel/testing_test.go | 2 ++ pkg/api/handlers/compat/auth.go | 2 ++ pkg/api/handlers/compat/changes.go | 2 ++ pkg/api/handlers/compat/containers.go | 2 ++ pkg/api/handlers/compat/containers_archive.go | 2 ++ pkg/api/handlers/compat/containers_attach.go | 2 ++ pkg/api/handlers/compat/containers_create.go | 2 ++ pkg/api/handlers/compat/containers_export.go | 2 ++ pkg/api/handlers/compat/containers_logs.go | 2 ++ pkg/api/handlers/compat/containers_pause.go | 2 ++ pkg/api/handlers/compat/containers_prune.go | 2 ++ pkg/api/handlers/compat/containers_restart.go | 2 ++ pkg/api/handlers/compat/containers_start.go | 2 ++ .../compat/containers_stats_freebsd.go | 2 ++ .../handlers/compat/containers_stats_linux.go | 2 ++ pkg/api/handlers/compat/containers_stop.go | 2 ++ pkg/api/handlers/compat/containers_top.go | 2 ++ pkg/api/handlers/compat/containers_unpause.go | 2 ++ pkg/api/handlers/compat/events.go | 2 ++ pkg/api/handlers/compat/exec.go | 2 ++ pkg/api/handlers/compat/images.go | 4 ++- pkg/api/handlers/compat/images_build.go | 2 ++ pkg/api/handlers/compat/images_history.go | 2 ++ pkg/api/handlers/compat/images_prune.go | 2 ++ pkg/api/handlers/compat/images_push.go | 2 ++ pkg/api/handlers/compat/images_remove.go | 2 ++ pkg/api/handlers/compat/images_save.go | 2 ++ pkg/api/handlers/compat/images_search.go | 2 ++ pkg/api/handlers/compat/images_tag.go | 2 ++ pkg/api/handlers/compat/info.go | 2 ++ pkg/api/handlers/compat/networks.go | 2 ++ pkg/api/handlers/compat/ping.go | 2 ++ pkg/api/handlers/compat/resize.go | 2 ++ pkg/api/handlers/compat/secrets.go | 2 ++ pkg/api/handlers/compat/system.go | 2 ++ pkg/api/handlers/compat/types.go | 2 ++ pkg/api/handlers/compat/unsupported.go | 2 ++ pkg/api/handlers/compat/version.go | 2 ++ pkg/api/handlers/compat/volumes.go | 2 ++ pkg/api/handlers/decoder.go | 2 ++ pkg/api/handlers/libpod/containers.go | 2 ++ pkg/api/handlers/libpod/containers_create.go | 2 ++ pkg/api/handlers/libpod/containers_stats.go | 2 ++ pkg/api/handlers/libpod/generate.go | 2 ++ pkg/api/handlers/libpod/healthcheck.go | 2 ++ pkg/api/handlers/libpod/images.go | 4 ++- pkg/api/handlers/libpod/images_pull.go | 2 ++ pkg/api/handlers/libpod/images_push.go | 2 ++ pkg/api/handlers/libpod/info.go | 2 ++ pkg/api/handlers/libpod/kube.go | 2 ++ pkg/api/handlers/libpod/manifests.go | 2 ++ pkg/api/handlers/libpod/networks.go | 2 ++ pkg/api/handlers/libpod/play.go | 2 ++ pkg/api/handlers/libpod/pods.go | 2 ++ pkg/api/handlers/libpod/secrets.go | 2 ++ pkg/api/handlers/libpod/swagger_spec.go | 2 ++ pkg/api/handlers/libpod/system.go | 2 ++ pkg/api/handlers/libpod/volumes.go | 2 ++ pkg/api/handlers/swagger/doc.go | 2 ++ pkg/api/handlers/swagger/errors.go | 2 ++ pkg/api/handlers/swagger/models.go | 2 ++ pkg/api/handlers/swagger/responses.go | 2 ++ pkg/api/handlers/utils/apiutil/apiutil.go | 2 ++ .../handlers/utils/apiutil/apiutil_test.go | 2 ++ pkg/api/handlers/utils/containers.go | 2 ++ pkg/api/handlers/utils/errors.go | 2 ++ pkg/api/handlers/utils/handler.go | 2 ++ pkg/api/handlers/utils/handler_test.go | 2 ++ pkg/api/handlers/utils/images.go | 2 ++ pkg/api/server/doc.go | 2 ++ pkg/api/server/handler_api.go | 2 ++ pkg/api/server/handler_logging.go | 2 ++ pkg/api/server/handler_panic.go | 2 ++ pkg/api/server/handler_rid.go | 2 ++ pkg/api/server/idle/tracker.go | 2 ++ pkg/api/server/listener_api.go | 2 ++ pkg/api/server/register_archive.go | 2 ++ pkg/api/server/register_auth.go | 2 ++ pkg/api/server/register_containers.go | 2 ++ pkg/api/server/register_distribution.go | 2 ++ pkg/api/server/register_events.go | 2 ++ pkg/api/server/register_exec.go | 2 ++ pkg/api/server/register_generate.go | 2 ++ pkg/api/server/register_healthcheck.go | 2 ++ pkg/api/server/register_images.go | 2 ++ pkg/api/server/register_info.go | 2 ++ pkg/api/server/register_kube.go | 2 ++ pkg/api/server/register_manifest.go | 2 ++ pkg/api/server/register_monitor.go | 2 ++ pkg/api/server/register_networks.go | 2 ++ pkg/api/server/register_ping.go | 2 ++ pkg/api/server/register_plugins.go | 2 ++ pkg/api/server/register_pods.go | 2 ++ pkg/api/server/register_secrets.go | 2 ++ pkg/api/server/register_swagger.go | 2 ++ pkg/api/server/register_swarm.go | 2 ++ pkg/api/server/register_system.go | 2 ++ pkg/api/server/register_version.go | 2 ++ pkg/api/server/register_volumes.go | 2 ++ pkg/api/server/server.go | 2 ++ pkg/api/types/types.go | 2 ++ pkg/domain/infra/abi/apply.go | 2 ++ pkg/domain/infra/abi/archive.go | 2 ++ pkg/domain/infra/abi/auto-update.go | 2 ++ pkg/domain/infra/abi/config.go | 2 ++ pkg/domain/infra/abi/config_test.go | 2 ++ pkg/domain/infra/abi/containers.go | 5 ++-- pkg/domain/infra/abi/containers_freebsd.go | 2 ++ pkg/domain/infra/abi/containers_linux.go | 2 ++ pkg/domain/infra/abi/containers_runlabel.go | 2 ++ .../infra/abi/containers_runlabel_test.go | 2 ++ pkg/domain/infra/abi/containers_stat.go | 2 ++ pkg/domain/infra/abi/events.go | 2 ++ pkg/domain/infra/abi/generate.go | 2 ++ pkg/domain/infra/abi/healthcheck.go | 2 ++ pkg/domain/infra/abi/images.go | 2 ++ pkg/domain/infra/abi/images_list.go | 2 ++ pkg/domain/infra/abi/images_test.go | 2 ++ .../infra/abi/internal/expansion/expand.go | 2 ++ .../abi/internal/expansion/expand_test.go | 2 ++ pkg/domain/infra/abi/manifest.go | 2 ++ pkg/domain/infra/abi/network.go | 2 ++ pkg/domain/infra/abi/parse/parse.go | 2 ++ pkg/domain/infra/abi/play.go | 2 ++ pkg/domain/infra/abi/play_test.go | 2 ++ pkg/domain/infra/abi/play_utils.go | 2 ++ pkg/domain/infra/abi/play_utils_test.go | 2 ++ pkg/domain/infra/abi/pods.go | 2 ++ pkg/domain/infra/abi/pods_stats.go | 2 ++ pkg/domain/infra/abi/runtime.go | 2 ++ pkg/domain/infra/abi/secrets.go | 2 ++ pkg/domain/infra/abi/secrets_test.go | 2 ++ pkg/domain/infra/abi/system.go | 2 ++ pkg/domain/infra/abi/system_freebsd.go | 2 ++ pkg/domain/infra/abi/system_linux.go | 2 ++ .../infra/abi/terminal/sigproxy_commn.go | 2 +- pkg/domain/infra/abi/terminal/terminal.go | 2 ++ .../infra/abi/terminal/terminal_common.go | 2 +- .../abi/terminal/terminal_unsupported.go | 2 +- pkg/domain/infra/abi/trust.go | 2 ++ pkg/domain/infra/abi/volumes.go | 2 ++ pkg/domain/infra/tunnel/containers.go | 2 +- pkg/{api/handlers => util}/changes.go | 2 +- pkg/{api/handlers => util}/changes_test.go | 2 +- 158 files changed, 305 insertions(+), 56 deletions(-) delete mode 100644 cmd/podman-testing/store_unsupported.go delete mode 100644 internal/domain/infra/runtime_tunnel.go rename pkg/{api/handlers => util}/changes.go (98%) rename pkg/{api/handlers => util}/changes_test.go (98%) diff --git a/cmd/podman-testing/create.go b/cmd/podman-testing/create.go index 1bdd14c5f9..99cb291771 100644 --- a/cmd/podman-testing/create.go +++ b/cmd/podman-testing/create.go @@ -1,3 +1,5 @@ +//go:build !remote + package main import ( diff --git a/cmd/podman-testing/data.go b/cmd/podman-testing/data.go index 6fe2099c00..81333cba3f 100644 --- a/cmd/podman-testing/data.go +++ b/cmd/podman-testing/data.go @@ -1,3 +1,5 @@ +//go:build !remote + package main import ( diff --git a/cmd/podman-testing/layer.go b/cmd/podman-testing/layer.go index ae4de28ca1..2b21ae2f6d 100644 --- a/cmd/podman-testing/layer.go +++ b/cmd/podman-testing/layer.go @@ -1,3 +1,5 @@ +//go:build !remote + package main import ( diff --git a/cmd/podman-testing/main.go b/cmd/podman-testing/main.go index ccc1ff7454..e883a6b84e 100644 --- a/cmd/podman-testing/main.go +++ b/cmd/podman-testing/main.go @@ -1,3 +1,5 @@ +//go:build !remote + package main import ( diff --git a/cmd/podman-testing/remove.go b/cmd/podman-testing/remove.go index 59dadfd2d0..90efefa587 100644 --- a/cmd/podman-testing/remove.go +++ b/cmd/podman-testing/remove.go @@ -1,3 +1,5 @@ +//go:build !remote + package main import ( diff --git a/cmd/podman-testing/store_supported.go b/cmd/podman-testing/store_supported.go index b8e2fac5a7..8931930e13 100644 --- a/cmd/podman-testing/store_supported.go +++ b/cmd/podman-testing/store_supported.go @@ -1,5 +1,4 @@ //go:build linux && !remote -// +build linux,!remote package main diff --git a/cmd/podman-testing/store_unsupported.go b/cmd/podman-testing/store_unsupported.go deleted file mode 100644 index de79ed88b0..0000000000 --- a/cmd/podman-testing/store_unsupported.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !linux || remote -// +build !linux remote - -package main - -import "github.com/containers/podman/v5/pkg/domain/entities" - -const engineMode = entities.TunnelMode - -func storeBefore() error { - return nil -} - -func storeAfter() error { - return nil -} diff --git a/cmd/podman/containers/commit.go b/cmd/podman/containers/commit.go index b0cf44fe6d..40e816f650 100644 --- a/cmd/podman/containers/commit.go +++ b/cmd/podman/containers/commit.go @@ -9,7 +9,6 @@ import ( "github.com/containers/common/pkg/completion" "github.com/containers/podman/v5/cmd/podman/common" "github.com/containers/podman/v5/cmd/podman/registry" - "github.com/containers/podman/v5/pkg/api/handlers" "github.com/containers/podman/v5/pkg/domain/entities" "github.com/spf13/cobra" ) @@ -105,9 +104,6 @@ func commit(cmd *cobra.Command, args []string) error { if !commitOptions.Quiet { commitOptions.Writer = os.Stderr } - if len(commitOptions.Changes) > 0 { - commitOptions.Changes = handlers.DecodeChanges(commitOptions.Changes) - } if len(configFile) > 0 { cfg, err := os.ReadFile(configFile) if err != nil { diff --git a/internal/domain/entities/engine_testing.go b/internal/domain/entities/engine_testing.go index 9ad9ee18bb..28c78a46a5 100644 --- a/internal/domain/entities/engine_testing.go +++ b/internal/domain/entities/engine_testing.go @@ -1,3 +1,5 @@ +//go:build !remote + package entities import ( diff --git a/internal/domain/entities/testing.go b/internal/domain/entities/testing.go index 754c4927e7..caba5e61ef 100644 --- a/internal/domain/entities/testing.go +++ b/internal/domain/entities/testing.go @@ -1,3 +1,5 @@ +//go:build !remote + package entities type CreateStorageLayerOptions struct { diff --git a/internal/domain/infra/abi/testing.go b/internal/domain/infra/abi/testing.go index 4cf49d0801..f617656dbd 100644 --- a/internal/domain/infra/abi/testing.go +++ b/internal/domain/infra/abi/testing.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/internal/domain/infra/abi/testing_test.go b/internal/domain/infra/abi/testing_test.go index 75c6f4f542..dbad5489d6 100644 --- a/internal/domain/infra/abi/testing_test.go +++ b/internal/domain/infra/abi/testing_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import "github.com/containers/podman/v5/internal/domain/entities" diff --git a/internal/domain/infra/runtime_tunnel.go b/internal/domain/infra/runtime_tunnel.go deleted file mode 100644 index 5bade4eddc..0000000000 --- a/internal/domain/infra/runtime_tunnel.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build remote - -package infra - -import ( - "context" - "fmt" - - ientities "github.com/containers/podman/v5/internal/domain/entities" - "github.com/containers/podman/v5/internal/domain/infra/tunnel" - "github.com/containers/podman/v5/pkg/bindings" - "github.com/containers/podman/v5/pkg/domain/entities" -) - -// NewTestingEngine factory provides a libpod runtime for testing-specific operations -func NewTestingEngine(facts *entities.PodmanConfig) (ientities.TestingEngine, error) { - switch facts.EngineMode { - case entities.ABIMode: - return nil, fmt.Errorf("direct image runtime not supported") - case entities.TunnelMode: - ctx, err := bindings.NewConnectionWithIdentity(context.Background(), facts.URI, facts.Identity, facts.MachineMode) - return &tunnel.TestingEngine{ClientCtx: ctx}, err - } - return nil, fmt.Errorf("runtime mode '%v' is not supported", facts.EngineMode) -} diff --git a/internal/domain/infra/tunnel/testing.go b/internal/domain/infra/tunnel/testing.go index 8efc6c3727..66d62633ad 100644 --- a/internal/domain/infra/tunnel/testing.go +++ b/internal/domain/infra/tunnel/testing.go @@ -1,3 +1,5 @@ +//go:build !remote + package tunnel import ( diff --git a/internal/domain/infra/tunnel/testing_test.go b/internal/domain/infra/tunnel/testing_test.go index d8cfa120f4..f803e77a1a 100644 --- a/internal/domain/infra/tunnel/testing_test.go +++ b/internal/domain/infra/tunnel/testing_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package tunnel import "github.com/containers/podman/v5/internal/domain/entities" diff --git a/pkg/api/handlers/compat/auth.go b/pkg/api/handlers/compat/auth.go index 9364d4c6d9..162f7d6520 100644 --- a/pkg/api/handlers/compat/auth.go +++ b/pkg/api/handlers/compat/auth.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/changes.go b/pkg/api/handlers/compat/changes.go index 5b74ae07c3..cfcb0990f6 100644 --- a/pkg/api/handlers/compat/changes.go +++ b/pkg/api/handlers/compat/changes.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index dfaf6fbe73..bd883bf6f2 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go index 044ec6455e..8849641525 100644 --- a/pkg/api/handlers/compat/containers_archive.go +++ b/pkg/api/handlers/compat/containers_archive.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_attach.go b/pkg/api/handlers/compat/containers_attach.go index 6d7295cdf2..301be134b1 100644 --- a/pkg/api/handlers/compat/containers_attach.go +++ b/pkg/api/handlers/compat/containers_attach.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go index cef33d37dd..404c117bb6 100644 --- a/pkg/api/handlers/compat/containers_create.go +++ b/pkg/api/handlers/compat/containers_create.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_export.go b/pkg/api/handlers/compat/containers_export.go index a95406ab7a..9cc4fd9f99 100644 --- a/pkg/api/handlers/compat/containers_export.go +++ b/pkg/api/handlers/compat/containers_export.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_logs.go b/pkg/api/handlers/compat/containers_logs.go index 3f5f75406c..b1440ff9dd 100644 --- a/pkg/api/handlers/compat/containers_logs.go +++ b/pkg/api/handlers/compat/containers_logs.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_pause.go b/pkg/api/handlers/compat/containers_pause.go index acd06ae420..b002d6bac8 100644 --- a/pkg/api/handlers/compat/containers_pause.go +++ b/pkg/api/handlers/compat/containers_pause.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_prune.go b/pkg/api/handlers/compat/containers_prune.go index 30b38403b0..fe2de39358 100644 --- a/pkg/api/handlers/compat/containers_prune.go +++ b/pkg/api/handlers/compat/containers_prune.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_restart.go b/pkg/api/handlers/compat/containers_restart.go index 3681993dde..91e8573f5f 100644 --- a/pkg/api/handlers/compat/containers_restart.go +++ b/pkg/api/handlers/compat/containers_restart.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_start.go b/pkg/api/handlers/compat/containers_start.go index 813f5e1f1d..ef4d7c5f82 100644 --- a/pkg/api/handlers/compat/containers_start.go +++ b/pkg/api/handlers/compat/containers_start.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_stats_freebsd.go b/pkg/api/handlers/compat/containers_stats_freebsd.go index 06490bbe90..ad48739fb9 100644 --- a/pkg/api/handlers/compat/containers_stats_freebsd.go +++ b/pkg/api/handlers/compat/containers_stats_freebsd.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_stats_linux.go b/pkg/api/handlers/compat/containers_stats_linux.go index 6c4d5f2fbf..ccb48dc3b4 100644 --- a/pkg/api/handlers/compat/containers_stats_linux.go +++ b/pkg/api/handlers/compat/containers_stats_linux.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_stop.go b/pkg/api/handlers/compat/containers_stop.go index b801508335..208c33f043 100644 --- a/pkg/api/handlers/compat/containers_stop.go +++ b/pkg/api/handlers/compat/containers_stop.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_top.go b/pkg/api/handlers/compat/containers_top.go index ea72919dfc..9653906277 100644 --- a/pkg/api/handlers/compat/containers_top.go +++ b/pkg/api/handlers/compat/containers_top.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/containers_unpause.go b/pkg/api/handlers/compat/containers_unpause.go index 7533c5a905..70205d258e 100644 --- a/pkg/api/handlers/compat/containers_unpause.go +++ b/pkg/api/handlers/compat/containers_unpause.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/events.go b/pkg/api/handlers/compat/events.go index 4ab12eb022..e449aa0cab 100644 --- a/pkg/api/handlers/compat/events.go +++ b/pkg/api/handlers/compat/events.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/exec.go b/pkg/api/handlers/compat/exec.go index 88ccffa9f4..e7f29d727a 100644 --- a/pkg/api/handlers/compat/exec.go +++ b/pkg/api/handlers/compat/exec.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images.go b/pkg/api/handlers/compat/images.go index 8dde5f1f61..a7e2701cb1 100644 --- a/pkg/api/handlers/compat/images.go +++ b/pkg/api/handlers/compat/images.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( @@ -137,7 +139,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { options.Author = query.Author options.Pause = query.Pause options.Squash = query.Squash - options.Changes = handlers.DecodeChanges(query.Changes) + options.Changes = util.DecodeChanges(query.Changes) if r.Body != nil { defer r.Body.Close() if options.CommitOptions.OverrideConfig, err = abi.DecodeOverrideConfig(r.Body); err != nil { diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go index 898c6ff732..baf94637c3 100644 --- a/pkg/api/handlers/compat/images_build.go +++ b/pkg/api/handlers/compat/images_build.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_history.go b/pkg/api/handlers/compat/images_history.go index 4ed97cdbe8..4d55ff4a6b 100644 --- a/pkg/api/handlers/compat/images_history.go +++ b/pkg/api/handlers/compat/images_history.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_prune.go b/pkg/api/handlers/compat/images_prune.go index 8cc303a6e2..35dbe290e0 100644 --- a/pkg/api/handlers/compat/images_prune.go +++ b/pkg/api/handlers/compat/images_prune.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go index 1710006c67..319dc98a27 100644 --- a/pkg/api/handlers/compat/images_push.go +++ b/pkg/api/handlers/compat/images_push.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_remove.go b/pkg/api/handlers/compat/images_remove.go index 957a87c5ad..5dd7a56958 100644 --- a/pkg/api/handlers/compat/images_remove.go +++ b/pkg/api/handlers/compat/images_remove.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_save.go b/pkg/api/handlers/compat/images_save.go index 6314756f6b..c3022348a8 100644 --- a/pkg/api/handlers/compat/images_save.go +++ b/pkg/api/handlers/compat/images_save.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_search.go b/pkg/api/handlers/compat/images_search.go index d918929f6d..93f2c47870 100644 --- a/pkg/api/handlers/compat/images_search.go +++ b/pkg/api/handlers/compat/images_search.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/images_tag.go b/pkg/api/handlers/compat/images_tag.go index d210b70764..9e5dc09d0c 100644 --- a/pkg/api/handlers/compat/images_tag.go +++ b/pkg/api/handlers/compat/images_tag.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/info.go b/pkg/api/handlers/compat/info.go index d4c2f5f649..1f6e249b74 100644 --- a/pkg/api/handlers/compat/info.go +++ b/pkg/api/handlers/compat/info.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/networks.go b/pkg/api/handlers/compat/networks.go index 598645bfc0..4d31cfd2e9 100644 --- a/pkg/api/handlers/compat/networks.go +++ b/pkg/api/handlers/compat/networks.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/ping.go b/pkg/api/handlers/compat/ping.go index 94d2099cdd..2601788143 100644 --- a/pkg/api/handlers/compat/ping.go +++ b/pkg/api/handlers/compat/ping.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/resize.go b/pkg/api/handlers/compat/resize.go index 8d13d9b70c..19ce87929c 100644 --- a/pkg/api/handlers/compat/resize.go +++ b/pkg/api/handlers/compat/resize.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/secrets.go b/pkg/api/handlers/compat/secrets.go index 13f7508ca2..bf1cdca0f3 100644 --- a/pkg/api/handlers/compat/secrets.go +++ b/pkg/api/handlers/compat/secrets.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/system.go b/pkg/api/handlers/compat/system.go index d53e9c3012..e22920cbc1 100644 --- a/pkg/api/handlers/compat/system.go +++ b/pkg/api/handlers/compat/system.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/types.go b/pkg/api/handlers/compat/types.go index 3c42190932..2402fe7b45 100644 --- a/pkg/api/handlers/compat/types.go +++ b/pkg/api/handlers/compat/types.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/unsupported.go b/pkg/api/handlers/compat/unsupported.go index 31afb85bad..476502fe06 100644 --- a/pkg/api/handlers/compat/unsupported.go +++ b/pkg/api/handlers/compat/unsupported.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/version.go b/pkg/api/handlers/compat/version.go index 4b0af7bf79..e1c40007e7 100644 --- a/pkg/api/handlers/compat/version.go +++ b/pkg/api/handlers/compat/version.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go index 4bb0a16807..943190841b 100644 --- a/pkg/api/handlers/compat/volumes.go +++ b/pkg/api/handlers/compat/volumes.go @@ -1,3 +1,5 @@ +//go:build !remote + package compat import ( diff --git a/pkg/api/handlers/decoder.go b/pkg/api/handlers/decoder.go index 4750fa1c54..6904f4f21e 100644 --- a/pkg/api/handlers/decoder.go +++ b/pkg/api/handlers/decoder.go @@ -1,3 +1,5 @@ +//go:build !remote + package handlers import ( diff --git a/pkg/api/handlers/libpod/containers.go b/pkg/api/handlers/libpod/containers.go index 0dabd649bb..726c30b2e7 100644 --- a/pkg/api/handlers/libpod/containers.go +++ b/pkg/api/handlers/libpod/containers.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/containers_create.go b/pkg/api/handlers/libpod/containers_create.go index 1df0bb2a40..1a12942226 100644 --- a/pkg/api/handlers/libpod/containers_create.go +++ b/pkg/api/handlers/libpod/containers_create.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/containers_stats.go b/pkg/api/handlers/libpod/containers_stats.go index 2ed2006c91..d595e3d607 100644 --- a/pkg/api/handlers/libpod/containers_stats.go +++ b/pkg/api/handlers/libpod/containers_stats.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/generate.go b/pkg/api/handlers/libpod/generate.go index 9c9ea458a9..5751369376 100644 --- a/pkg/api/handlers/libpod/generate.go +++ b/pkg/api/handlers/libpod/generate.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/healthcheck.go b/pkg/api/handlers/libpod/healthcheck.go index e5e9214051..c5ccdbac38 100644 --- a/pkg/api/handlers/libpod/healthcheck.go +++ b/pkg/api/handlers/libpod/healthcheck.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index aa12e5976b..91d2b7377a 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( @@ -499,7 +501,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) { options.Author = query.Author options.Pause = query.Pause options.Squash = query.Squash - options.Changes = handlers.DecodeChanges(query.Changes) + options.Changes = util.DecodeChanges(query.Changes) ctr, err := runtime.LookupContainer(query.Container) if err != nil { utils.Error(w, http.StatusNotFound, err) diff --git a/pkg/api/handlers/libpod/images_pull.go b/pkg/api/handlers/libpod/images_pull.go index 7075b98b64..317e33d64e 100644 --- a/pkg/api/handlers/libpod/images_pull.go +++ b/pkg/api/handlers/libpod/images_pull.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/images_push.go b/pkg/api/handlers/libpod/images_push.go index ce9d5d19e1..576f25cf64 100644 --- a/pkg/api/handlers/libpod/images_push.go +++ b/pkg/api/handlers/libpod/images_push.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/info.go b/pkg/api/handlers/libpod/info.go index 536cd51d8f..546991699b 100644 --- a/pkg/api/handlers/libpod/info.go +++ b/pkg/api/handlers/libpod/info.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/kube.go b/pkg/api/handlers/libpod/kube.go index 8d6d096ca1..7068074f3b 100644 --- a/pkg/api/handlers/libpod/kube.go +++ b/pkg/api/handlers/libpod/kube.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/manifests.go b/pkg/api/handlers/libpod/manifests.go index ee97aa1f12..124f94ba82 100644 --- a/pkg/api/handlers/libpod/manifests.go +++ b/pkg/api/handlers/libpod/manifests.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go index e427cb94f6..1bbcfa9f5e 100644 --- a/pkg/api/handlers/libpod/networks.go +++ b/pkg/api/handlers/libpod/networks.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/play.go b/pkg/api/handlers/libpod/play.go index 74830badbf..0e7625c5ff 100644 --- a/pkg/api/handlers/libpod/play.go +++ b/pkg/api/handlers/libpod/play.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/pods.go b/pkg/api/handlers/libpod/pods.go index 8bc081f160..6b318d070d 100644 --- a/pkg/api/handlers/libpod/pods.go +++ b/pkg/api/handlers/libpod/pods.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/secrets.go b/pkg/api/handlers/libpod/secrets.go index 56d27778c5..068ebecb76 100644 --- a/pkg/api/handlers/libpod/secrets.go +++ b/pkg/api/handlers/libpod/secrets.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/swagger_spec.go b/pkg/api/handlers/libpod/swagger_spec.go index 3ba2cb4d35..bcfb407e38 100644 --- a/pkg/api/handlers/libpod/swagger_spec.go +++ b/pkg/api/handlers/libpod/swagger_spec.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/system.go b/pkg/api/handlers/libpod/system.go index c6444fd901..a658d20d90 100644 --- a/pkg/api/handlers/libpod/system.go +++ b/pkg/api/handlers/libpod/system.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/libpod/volumes.go b/pkg/api/handlers/libpod/volumes.go index b3b3ce27ae..986052e924 100644 --- a/pkg/api/handlers/libpod/volumes.go +++ b/pkg/api/handlers/libpod/volumes.go @@ -1,3 +1,5 @@ +//go:build !remote + package libpod import ( diff --git a/pkg/api/handlers/swagger/doc.go b/pkg/api/handlers/swagger/doc.go index 7e535ea298..8b1c557c6c 100644 --- a/pkg/api/handlers/swagger/doc.go +++ b/pkg/api/handlers/swagger/doc.go @@ -1,3 +1,5 @@ +//go:build !remote + // Package swagger defines the payloads used by the Podman API // // - errors.go: declares the errors used in the API. By embedding errors.ErrorModel, more meaningful diff --git a/pkg/api/handlers/swagger/errors.go b/pkg/api/handlers/swagger/errors.go index 176fa3c18c..2fac8b36fa 100644 --- a/pkg/api/handlers/swagger/errors.go +++ b/pkg/api/handlers/swagger/errors.go @@ -1,3 +1,5 @@ +//go:build !remote + //nolint:unused // these types are used to wire generated swagger to API code package swagger diff --git a/pkg/api/handlers/swagger/models.go b/pkg/api/handlers/swagger/models.go index d792c41072..56fd5d8b56 100644 --- a/pkg/api/handlers/swagger/models.go +++ b/pkg/api/handlers/swagger/models.go @@ -1,3 +1,5 @@ +//go:build !remote + //nolint:unused // these types are used to wire generated swagger to API code package swagger diff --git a/pkg/api/handlers/swagger/responses.go b/pkg/api/handlers/swagger/responses.go index 5c0192f919..f3fe133342 100644 --- a/pkg/api/handlers/swagger/responses.go +++ b/pkg/api/handlers/swagger/responses.go @@ -1,3 +1,5 @@ +//go:build !remote + //nolint:unused // these types are used to wire generated swagger to API code package swagger diff --git a/pkg/api/handlers/utils/apiutil/apiutil.go b/pkg/api/handlers/utils/apiutil/apiutil.go index 48f4dfba5d..f5fde780b4 100644 --- a/pkg/api/handlers/utils/apiutil/apiutil.go +++ b/pkg/api/handlers/utils/apiutil/apiutil.go @@ -1,3 +1,5 @@ +//go:build !remote + package apiutil import ( diff --git a/pkg/api/handlers/utils/apiutil/apiutil_test.go b/pkg/api/handlers/utils/apiutil/apiutil_test.go index 377c0ef84a..02a1194d06 100644 --- a/pkg/api/handlers/utils/apiutil/apiutil_test.go +++ b/pkg/api/handlers/utils/apiutil/apiutil_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package apiutil import ( diff --git a/pkg/api/handlers/utils/containers.go b/pkg/api/handlers/utils/containers.go index 383505cabb..62af4b45d1 100644 --- a/pkg/api/handlers/utils/containers.go +++ b/pkg/api/handlers/utils/containers.go @@ -1,3 +1,5 @@ +//go:build !remote + package utils import ( diff --git a/pkg/api/handlers/utils/errors.go b/pkg/api/handlers/utils/errors.go index f659aa06cc..82255ac410 100644 --- a/pkg/api/handlers/utils/errors.go +++ b/pkg/api/handlers/utils/errors.go @@ -1,3 +1,5 @@ +//go:build !remote + package utils import ( diff --git a/pkg/api/handlers/utils/handler.go b/pkg/api/handlers/utils/handler.go index 49bbf4c0cf..dc425ce656 100644 --- a/pkg/api/handlers/utils/handler.go +++ b/pkg/api/handlers/utils/handler.go @@ -1,3 +1,5 @@ +//go:build !remote + package utils import ( diff --git a/pkg/api/handlers/utils/handler_test.go b/pkg/api/handlers/utils/handler_test.go index 099f4169b9..4df0f08042 100644 --- a/pkg/api/handlers/utils/handler_test.go +++ b/pkg/api/handlers/utils/handler_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package utils import ( diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go index c330e45e55..f97f493972 100644 --- a/pkg/api/handlers/utils/images.go +++ b/pkg/api/handlers/utils/images.go @@ -1,3 +1,5 @@ +//go:build !remote + package utils import ( diff --git a/pkg/api/server/doc.go b/pkg/api/server/doc.go index b7f31fffa9..63a9bc0a3a 100644 --- a/pkg/api/server/doc.go +++ b/pkg/api/server/doc.go @@ -1,3 +1,5 @@ +//go:build !remote + // Package server supports a RESTful API for the Libpod library // // This documentation describes the Podman v2.x+ RESTful API. It consists of a Docker-compatible diff --git a/pkg/api/server/handler_api.go b/pkg/api/server/handler_api.go index 7696db4eec..9a895f0814 100644 --- a/pkg/api/server/handler_api.go +++ b/pkg/api/server/handler_api.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/handler_logging.go b/pkg/api/server/handler_logging.go index 2f62a28fd3..1fd75e233f 100644 --- a/pkg/api/server/handler_logging.go +++ b/pkg/api/server/handler_logging.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/handler_panic.go b/pkg/api/server/handler_panic.go index 5bab6eff83..e654c0047a 100644 --- a/pkg/api/server/handler_panic.go +++ b/pkg/api/server/handler_panic.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/handler_rid.go b/pkg/api/server/handler_rid.go index 7869cc1a14..1acd47823b 100644 --- a/pkg/api/server/handler_rid.go +++ b/pkg/api/server/handler_rid.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/idle/tracker.go b/pkg/api/server/idle/tracker.go index fe815f6138..c192d13e11 100644 --- a/pkg/api/server/idle/tracker.go +++ b/pkg/api/server/idle/tracker.go @@ -1,3 +1,5 @@ +//go:build !remote + package idle import ( diff --git a/pkg/api/server/listener_api.go b/pkg/api/server/listener_api.go index 38abe27431..a657396922 100644 --- a/pkg/api/server/listener_api.go +++ b/pkg/api/server/listener_api.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_archive.go b/pkg/api/server/register_archive.go index 6e031a074e..b21983a241 100644 --- a/pkg/api/server/register_archive.go +++ b/pkg/api/server/register_archive.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_auth.go b/pkg/api/server/register_auth.go index 6fabd65fe0..d199f4cfae 100644 --- a/pkg/api/server/register_auth.go +++ b/pkg/api/server/register_auth.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go index b3a603af95..cc1cc5e74d 100644 --- a/pkg/api/server/register_containers.go +++ b/pkg/api/server/register_containers.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_distribution.go b/pkg/api/server/register_distribution.go index d85480d090..90607bb99f 100644 --- a/pkg/api/server/register_distribution.go +++ b/pkg/api/server/register_distribution.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_events.go b/pkg/api/server/register_events.go index aa8b3d0d9a..5f8090fc8b 100644 --- a/pkg/api/server/register_events.go +++ b/pkg/api/server/register_events.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_exec.go b/pkg/api/server/register_exec.go index 56228ae1aa..f1eaaeaf01 100644 --- a/pkg/api/server/register_exec.go +++ b/pkg/api/server/register_exec.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_generate.go b/pkg/api/server/register_generate.go index 2d1d517cf8..c5299a5754 100644 --- a/pkg/api/server/register_generate.go +++ b/pkg/api/server/register_generate.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_healthcheck.go b/pkg/api/server/register_healthcheck.go index b3643af6df..1535f984ce 100644 --- a/pkg/api/server/register_healthcheck.go +++ b/pkg/api/server/register_healthcheck.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go index 68ab63cc1d..fa01634b5c 100644 --- a/pkg/api/server/register_images.go +++ b/pkg/api/server/register_images.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_info.go b/pkg/api/server/register_info.go index 5f6a114326..6252ac57c2 100644 --- a/pkg/api/server/register_info.go +++ b/pkg/api/server/register_info.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_kube.go b/pkg/api/server/register_kube.go index 5678746669..b50bafecab 100644 --- a/pkg/api/server/register_kube.go +++ b/pkg/api/server/register_kube.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go index a7bd4efc11..a6de54d0b6 100644 --- a/pkg/api/server/register_manifest.go +++ b/pkg/api/server/register_manifest.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_monitor.go b/pkg/api/server/register_monitor.go index b892442bd2..7bcfafa813 100644 --- a/pkg/api/server/register_monitor.go +++ b/pkg/api/server/register_monitor.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_networks.go b/pkg/api/server/register_networks.go index 38075e93b5..c324b4c73b 100644 --- a/pkg/api/server/register_networks.go +++ b/pkg/api/server/register_networks.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_ping.go b/pkg/api/server/register_ping.go index 041fbf301a..ee0098e9af 100644 --- a/pkg/api/server/register_ping.go +++ b/pkg/api/server/register_ping.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_plugins.go b/pkg/api/server/register_plugins.go index 2e4aca8d4a..8ea03d7376 100644 --- a/pkg/api/server/register_plugins.go +++ b/pkg/api/server/register_plugins.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_pods.go b/pkg/api/server/register_pods.go index 0eb7e79a80..842e1588fc 100644 --- a/pkg/api/server/register_pods.go +++ b/pkg/api/server/register_pods.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_secrets.go b/pkg/api/server/register_secrets.go index deb0fc2492..0540abf356 100644 --- a/pkg/api/server/register_secrets.go +++ b/pkg/api/server/register_secrets.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_swagger.go b/pkg/api/server/register_swagger.go index ceb9d87426..db5c6709e4 100644 --- a/pkg/api/server/register_swagger.go +++ b/pkg/api/server/register_swagger.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_swarm.go b/pkg/api/server/register_swarm.go index 4dcb63cf32..af819ebb34 100644 --- a/pkg/api/server/register_swarm.go +++ b/pkg/api/server/register_swarm.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_system.go b/pkg/api/server/register_system.go index 4010dfb0e0..91d31a86d3 100644 --- a/pkg/api/server/register_system.go +++ b/pkg/api/server/register_system.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_version.go b/pkg/api/server/register_version.go index 1a62e51d83..1d1ca0eef0 100644 --- a/pkg/api/server/register_version.go +++ b/pkg/api/server/register_version.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/register_volumes.go b/pkg/api/server/register_volumes.go index 7ad71e58cb..867325d24e 100644 --- a/pkg/api/server/register_volumes.go +++ b/pkg/api/server/register_volumes.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index 8c5b73872a..4c07390d0d 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -1,3 +1,5 @@ +//go:build !remote + package server import ( diff --git a/pkg/api/types/types.go b/pkg/api/types/types.go index a01ded0111..eb4d89e0f2 100644 --- a/pkg/api/types/types.go +++ b/pkg/api/types/types.go @@ -1,3 +1,5 @@ +//go:build !remote + package types type APIContextKey int diff --git a/pkg/domain/infra/abi/apply.go b/pkg/domain/infra/abi/apply.go index 9031546365..2c3986b4e1 100644 --- a/pkg/domain/infra/abi/apply.go +++ b/pkg/domain/infra/abi/apply.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/archive.go b/pkg/domain/infra/abi/archive.go index 49dc9f3f04..711d54f93d 100644 --- a/pkg/domain/infra/abi/archive.go +++ b/pkg/domain/infra/abi/archive.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/auto-update.go b/pkg/domain/infra/abi/auto-update.go index 57504e92a1..f8f14169da 100644 --- a/pkg/domain/infra/abi/auto-update.go +++ b/pkg/domain/infra/abi/auto-update.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/config.go b/pkg/domain/infra/abi/config.go index ae564cf442..bc41498a8e 100644 --- a/pkg/domain/infra/abi/config.go +++ b/pkg/domain/infra/abi/config.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/config_test.go b/pkg/domain/infra/abi/config_test.go index 4a9af42e43..6ac29276ca 100644 --- a/pkg/domain/infra/abi/config_test.go +++ b/pkg/domain/infra/abi/config_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index e2356e9d6b..3cbeb2cd65 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( @@ -18,7 +20,6 @@ import ( "github.com/containers/podman/v5/libpod" "github.com/containers/podman/v5/libpod/define" "github.com/containers/podman/v5/libpod/logs" - "github.com/containers/podman/v5/pkg/api/handlers" "github.com/containers/podman/v5/pkg/checkpoint" "github.com/containers/podman/v5/pkg/domain/entities" "github.com/containers/podman/v5/pkg/domain/entities/reports" @@ -585,7 +586,7 @@ func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, sc := ic.Libpod.SystemContext() var changes []string if len(options.Changes) > 0 { - changes = handlers.DecodeChanges(options.Changes) + changes = util.DecodeChanges(options.Changes) } var overrideConfig *manifest.Schema2Config if len(options.Config) > 0 { diff --git a/pkg/domain/infra/abi/containers_freebsd.go b/pkg/domain/infra/abi/containers_freebsd.go index a095a87cb7..cb47418399 100644 --- a/pkg/domain/infra/abi/containers_freebsd.go +++ b/pkg/domain/infra/abi/containers_freebsd.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi const processFileDescriptorsPath = "/dev/fd" diff --git a/pkg/domain/infra/abi/containers_linux.go b/pkg/domain/infra/abi/containers_linux.go index 10b3d33a49..927aaa611e 100644 --- a/pkg/domain/infra/abi/containers_linux.go +++ b/pkg/domain/infra/abi/containers_linux.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi const processFileDescriptorsPath = "/proc/self/fd" diff --git a/pkg/domain/infra/abi/containers_runlabel.go b/pkg/domain/infra/abi/containers_runlabel.go index 2a4119996f..d27ea0ec7d 100644 --- a/pkg/domain/infra/abi/containers_runlabel.go +++ b/pkg/domain/infra/abi/containers_runlabel.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/containers_runlabel_test.go b/pkg/domain/infra/abi/containers_runlabel_test.go index 10f9ae0040..3b12b54f7d 100644 --- a/pkg/domain/infra/abi/containers_runlabel_test.go +++ b/pkg/domain/infra/abi/containers_runlabel_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/containers_stat.go b/pkg/domain/infra/abi/containers_stat.go index 99cde00350..aed498fe01 100644 --- a/pkg/domain/infra/abi/containers_stat.go +++ b/pkg/domain/infra/abi/containers_stat.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/events.go b/pkg/domain/infra/abi/events.go index ffbd119f1c..ad2bf5313f 100644 --- a/pkg/domain/infra/abi/events.go +++ b/pkg/domain/infra/abi/events.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go index e424500fbd..d58fb03238 100644 --- a/pkg/domain/infra/abi/generate.go +++ b/pkg/domain/infra/abi/generate.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/healthcheck.go b/pkg/domain/infra/abi/healthcheck.go index b464c88c4b..6c61dfa4fe 100644 --- a/pkg/domain/infra/abi/healthcheck.go +++ b/pkg/domain/infra/abi/healthcheck.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index f7d5356aed..16b8b662a1 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/images_list.go b/pkg/domain/infra/abi/images_list.go index 6f6d575711..9fa855035a 100644 --- a/pkg/domain/infra/abi/images_list.go +++ b/pkg/domain/infra/abi/images_list.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/images_test.go b/pkg/domain/infra/abi/images_test.go index 3999de4578..f24a11cd0e 100644 --- a/pkg/domain/infra/abi/images_test.go +++ b/pkg/domain/infra/abi/images_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/internal/expansion/expand.go b/pkg/domain/infra/abi/internal/expansion/expand.go index 6bf0ea8ce0..293679380a 100644 --- a/pkg/domain/infra/abi/internal/expansion/expand.go +++ b/pkg/domain/infra/abi/internal/expansion/expand.go @@ -1,3 +1,5 @@ +//go:build !remote + package expansion import ( diff --git a/pkg/domain/infra/abi/internal/expansion/expand_test.go b/pkg/domain/infra/abi/internal/expansion/expand_test.go index 45f32edfc6..e432ceee66 100644 --- a/pkg/domain/infra/abi/internal/expansion/expand_test.go +++ b/pkg/domain/infra/abi/internal/expansion/expand_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package expansion import ( diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 144740ec88..812c8e1ae3 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go index c39b9c600b..5dc3963ba1 100644 --- a/pkg/domain/infra/abi/network.go +++ b/pkg/domain/infra/abi/network.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go index 571e52a951..268610716c 100644 --- a/pkg/domain/infra/abi/parse/parse.go +++ b/pkg/domain/infra/abi/parse/parse.go @@ -1,3 +1,5 @@ +//go:build !remote + package parse import ( diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index ec5c1a1fc3..e5c24b1d2a 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/play_test.go b/pkg/domain/infra/abi/play_test.go index 4661763e28..ef6207f127 100644 --- a/pkg/domain/infra/abi/play_test.go +++ b/pkg/domain/infra/abi/play_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/play_utils.go b/pkg/domain/infra/abi/play_utils.go index 16d30acd16..7285d9c9b9 100644 --- a/pkg/domain/infra/abi/play_utils.go +++ b/pkg/domain/infra/abi/play_utils.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import "github.com/containers/podman/v5/libpod/define" diff --git a/pkg/domain/infra/abi/play_utils_test.go b/pkg/domain/infra/abi/play_utils_test.go index 8bc56e234b..fa4b6010c0 100644 --- a/pkg/domain/infra/abi/play_utils_test.go +++ b/pkg/domain/infra/abi/play_utils_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 8d44532023..d402421cc8 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/pods_stats.go b/pkg/domain/infra/abi/pods_stats.go index 26d070344e..3b76407f7d 100644 --- a/pkg/domain/infra/abi/pods_stats.go +++ b/pkg/domain/infra/abi/pods_stats.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/runtime.go b/pkg/domain/infra/abi/runtime.go index bfa182f243..6e5f3240ef 100644 --- a/pkg/domain/infra/abi/runtime.go +++ b/pkg/domain/infra/abi/runtime.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/secrets.go b/pkg/domain/infra/abi/secrets.go index 02fbc94269..5f5cfdc19b 100644 --- a/pkg/domain/infra/abi/secrets.go +++ b/pkg/domain/infra/abi/secrets.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/secrets_test.go b/pkg/domain/infra/abi/secrets_test.go index 6b3a745e25..fb6157d9c5 100644 --- a/pkg/domain/infra/abi/secrets_test.go +++ b/pkg/domain/infra/abi/secrets_test.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go index 5da8aba326..440d81e48b 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/system_freebsd.go b/pkg/domain/infra/abi/system_freebsd.go index 1521a7e1a8..9f17df7828 100644 --- a/pkg/domain/infra/abi/system_freebsd.go +++ b/pkg/domain/infra/abi/system_freebsd.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/system_linux.go b/pkg/domain/infra/abi/system_linux.go index 6dd99554cd..50e4632408 100644 --- a/pkg/domain/infra/abi/system_linux.go +++ b/pkg/domain/infra/abi/system_linux.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/terminal/sigproxy_commn.go b/pkg/domain/infra/abi/terminal/sigproxy_commn.go index e4a601f93d..df9aee00ad 100644 --- a/pkg/domain/infra/abi/terminal/sigproxy_commn.go +++ b/pkg/domain/infra/abi/terminal/sigproxy_commn.go @@ -1,4 +1,4 @@ -//go:build linux || freebsd +//go:build (linux || freebsd) && !remote package terminal diff --git a/pkg/domain/infra/abi/terminal/terminal.go b/pkg/domain/infra/abi/terminal/terminal.go index c7b75c6c29..954997c095 100644 --- a/pkg/domain/infra/abi/terminal/terminal.go +++ b/pkg/domain/infra/abi/terminal/terminal.go @@ -1,3 +1,5 @@ +//go:build !remote + package terminal import ( diff --git a/pkg/domain/infra/abi/terminal/terminal_common.go b/pkg/domain/infra/abi/terminal/terminal_common.go index 5ca0d8d2c4..065ac3012d 100644 --- a/pkg/domain/infra/abi/terminal/terminal_common.go +++ b/pkg/domain/infra/abi/terminal/terminal_common.go @@ -1,4 +1,4 @@ -//go:build linux || freebsd +//go:build (linux || freebsd) && !remote package terminal diff --git a/pkg/domain/infra/abi/terminal/terminal_unsupported.go b/pkg/domain/infra/abi/terminal/terminal_unsupported.go index a1b5ac37d1..b67c738751 100644 --- a/pkg/domain/infra/abi/terminal/terminal_unsupported.go +++ b/pkg/domain/infra/abi/terminal/terminal_unsupported.go @@ -1,4 +1,4 @@ -//go:build !linux && !freebsd +//go:build !linux && !freebsd && !remote package terminal diff --git a/pkg/domain/infra/abi/trust.go b/pkg/domain/infra/abi/trust.go index e23ed4bd57..5b617b1154 100644 --- a/pkg/domain/infra/abi/trust.go +++ b/pkg/domain/infra/abi/trust.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/abi/volumes.go b/pkg/domain/infra/abi/volumes.go index d99ab0f992..7ecc29324f 100644 --- a/pkg/domain/infra/abi/volumes.go +++ b/pkg/domain/infra/abi/volumes.go @@ -1,3 +1,5 @@ +//go:build !remote + package abi import ( diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 9c81fb2197..6e8c6fea44 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -350,7 +350,7 @@ func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, } var changes []string if len(opts.Changes) > 0 { - changes = handlers.DecodeChanges(opts.Changes) + changes = util.DecodeChanges(opts.Changes) } var configReader io.Reader if len(opts.Config) > 0 { diff --git a/pkg/api/handlers/changes.go b/pkg/util/changes.go similarity index 98% rename from pkg/api/handlers/changes.go rename to pkg/util/changes.go index 58e3a739ad..86f418c335 100644 --- a/pkg/api/handlers/changes.go +++ b/pkg/util/changes.go @@ -1,4 +1,4 @@ -package handlers +package util import ( "strings" diff --git a/pkg/api/handlers/changes_test.go b/pkg/util/changes_test.go similarity index 98% rename from pkg/api/handlers/changes_test.go rename to pkg/util/changes_test.go index 03ff1523e7..2b635c5d64 100644 --- a/pkg/api/handlers/changes_test.go +++ b/pkg/util/changes_test.go @@ -1,4 +1,4 @@ -package handlers +package util import ( "testing" From 462c1c6d8e9da4b346ecca64e58e45f9da68ee14 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 15 Aug 2024 13:22:59 +0200 Subject: [PATCH 3/7] [v5.2] golangci-lint: remove most skip dirs Now that we have propert !remote tags set everywhere we can just rely on that and do not need to skip any dirs. Also on linux do not lint three times, one remote run is enough. We still have to skip the test dir for windows/macos though or we need to add linux build tags there everywhere as well. This seems simpler. Signed-off-by: Paul Holzinger Signed-off-by: tomsweeneyredhat --- hack/golangci-lint.sh | 6 +++--- libpod/events/logfile_test.go | 2 ++ pkg/bindings/test/resource_test.go | 2 ++ test/e2e/run_networking_test.go | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hack/golangci-lint.sh b/hack/golangci-lint.sh index 8803b68bd3..70a371ad86 100755 --- a/hack/golangci-lint.sh +++ b/hack/golangci-lint.sh @@ -18,11 +18,11 @@ BUILD_TAGS_TUNNEL="$BUILD_TAGS_DEFAULT,remote" BUILD_TAGS_REMOTE="remote,containers_image_openpgp" SKIP_DIRS_ABI="" -SKIP_DIRS_TUNNEL="pkg/api,pkg/domain/infra/abi,internal/domain/infra/abi" -SKIP_DIRS_REMOTE="libpod/events,pkg/api,pkg/domain/infra/abi,internal/domain/infra/abi,pkg/machine/qemu,pkg/trust,test" +SKIP_DIRS_TUNNEL="" +SKIP_DIRS_REMOTE="libpod/events,test" declare -a to_lint -to_lint=(ABI TUNNEL REMOTE) +to_lint=(ABI TUNNEL) # Special-case, for Darwin and Windows only "remote" linting is possible and required. if [[ "$GOOS" == "windows" ]] || [[ "$GOOS" == "darwin" ]]; then diff --git a/libpod/events/logfile_test.go b/libpod/events/logfile_test.go index 0fb344177c..f391ef2277 100644 --- a/libpod/events/logfile_test.go +++ b/libpod/events/logfile_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package events import ( diff --git a/pkg/bindings/test/resource_test.go b/pkg/bindings/test/resource_test.go index 3a2421c8a3..1afca1d788 100644 --- a/pkg/bindings/test/resource_test.go +++ b/pkg/bindings/test/resource_test.go @@ -1,3 +1,5 @@ +//go:build linux + package bindings_test import ( diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go index 813de9f737..010c8f17c6 100644 --- a/test/e2e/run_networking_test.go +++ b/test/e2e/run_networking_test.go @@ -1,3 +1,5 @@ +//go:build linux + package integration import ( From b96312af0ffc880360cb79ea11fd32b387250c23 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 15 Aug 2024 14:59:22 +0200 Subject: [PATCH 4/7] [v5.2] test/e2e: remove kernel version check We need something newer than 4.14 anyway now for most Podman functions. This is breaking liniting on windows as the function doesn't work there. Signed-off-by: Paul Holzinger Signed-off-by: tomsweeneyredhat --- test/e2e/run_privileged_test.go | 7 -- test/utils/common_function_test.go | 12 --- test/utils/utils.go | 22 ----- .../storage/pkg/parsers/kernel/kernel.go | 90 ------------------- .../pkg/parsers/kernel/kernel_darwin.go | 57 ------------ .../storage/pkg/parsers/kernel/kernel_unix.go | 20 ----- .../pkg/parsers/kernel/kernel_windows.go | 70 --------------- vendor/modules.txt | 1 - 8 files changed, 279 deletions(-) delete mode 100644 vendor/github.com/containers/storage/pkg/parsers/kernel/kernel.go delete mode 100644 vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_darwin.go delete mode 100644 vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_unix.go delete mode 100644 vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_windows.go diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go index 5e6c5fb51d..2a30138c09 100644 --- a/test/e2e/run_privileged_test.go +++ b/test/e2e/run_privileged_test.go @@ -137,13 +137,6 @@ var _ = Describe("Podman privileged container tests", func() { }) It("run no-new-privileges test", func() { - // Check if our kernel is new enough - k, err := IsKernelNewerThan("4.14") - Expect(err).ToNot(HaveOccurred()) - if !k { - Skip("Kernel is not new enough to test this feature") - } - cap := SystemExec("grep", []string{"NoNewPrivs", "/proc/self/status"}) if cap.ExitCode() != 0 { Skip("Can't determine NoNewPrivs") diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go index 6d6c49dcb7..988e83b1b2 100644 --- a/test/utils/common_function_test.go +++ b/test/utils/common_function_test.go @@ -56,18 +56,6 @@ var _ = Describe("Common functions test", func() { Entry("Item empty with and without \"", "/tmp/os-release.test", "", "\"\"", false), ) - DescribeTable("Test IsKernelNewerThan", - func(kv string, expect, isNil bool) { - newer, err := IsKernelNewerThan(kv) - Expect(newer).To(Equal(expect), "Version compare results is not as expect.") - Expect(err == nil).To(Equal(isNil), "Error is not as expect.") - }, - Entry("Invalid kernel version: 0", "0", false, false), - Entry("Older kernel version:0.0", "0.0", true, true), - Entry("Newer kernel version: 100.17.14", "100.17.14", false, true), - Entry("Invalid kernel version: I am not a kernel version", "I am not a kernel version", false, false), - ) - DescribeTable("Test TestIsCommandAvailable", func(cmd string, expect bool) { cmdExist := IsCommandAvailable(cmd) diff --git a/test/utils/utils.go b/test/utils/utils.go index 72af69d555..9961fdde95 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -18,7 +18,6 @@ import ( "github.com/sirupsen/logrus" - "github.com/containers/storage/pkg/parsers/kernel" . "github.com/onsi/ginkgo/v2" //nolint:revive,stylecheck . "github.com/onsi/gomega" //nolint:revive,stylecheck . "github.com/onsi/gomega/gexec" //nolint:revive,stylecheck @@ -448,27 +447,6 @@ func GetHostDistributionInfo() HostOS { return host } -// IsKernelNewerThan compares the current kernel version to one provided. If -// the kernel is equal to or greater, returns true -func IsKernelNewerThan(version string) (bool, error) { - inputVersion, err := kernel.ParseRelease(version) - if err != nil { - return false, err - } - kv, err := kernel.GetKernelVersion() - if err != nil { - return false, err - } - - // CompareKernelVersion compares two kernel.VersionInfo structs. - // Returns -1 if a < b, 0 if a == b, 1 it a > b - result := kernel.CompareKernelVersion(*kv, *inputVersion) - if result >= 0 { - return true, nil - } - return false, nil -} - // IsCommandAvailable check if command exist func IsCommandAvailable(command string) bool { check := exec.Command("bash", "-c", strings.Join([]string{"command -v", command}, " ")) diff --git a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel.go b/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel.go deleted file mode 100644 index 5cee2693ad..0000000000 --- a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build !windows -// +build !windows - -// Package kernel provides helper function to get, parse and compare kernel -// versions for different platforms. -package kernel - -import ( - "errors" - "fmt" - - "github.com/sirupsen/logrus" -) - -// VersionInfo holds information about the kernel. -type VersionInfo struct { - Kernel int // Version of the kernel (e.g. 4.1.2-generic -> 4) - Major int // Major part of the kernel version (e.g. 4.1.2-generic -> 1) - Minor int // Minor part of the kernel version (e.g. 4.1.2-generic -> 2) - Flavor string // Flavor of the kernel version (e.g. 4.1.2-generic -> generic) -} - -func (k *VersionInfo) String() string { - return fmt.Sprintf("%d.%d.%d%s", k.Kernel, k.Major, k.Minor, k.Flavor) -} - -// CompareKernelVersion compares two kernel.VersionInfo structs. -// Returns -1 if a < b, 0 if a == b, 1 it a > b -func CompareKernelVersion(a, b VersionInfo) int { - if a.Kernel < b.Kernel { - return -1 - } else if a.Kernel > b.Kernel { - return 1 - } - - if a.Major < b.Major { - return -1 - } else if a.Major > b.Major { - return 1 - } - - if a.Minor < b.Minor { - return -1 - } else if a.Minor > b.Minor { - return 1 - } - - return 0 -} - -// CheckKernelVersion checks if current kernel is newer than (or equal to) -// the given version. -func CheckKernelVersion(k, major, minor int) bool { - if v, err := GetKernelVersion(); err != nil { - logrus.Warnf("Error getting kernel version: %s", err) - } else { - if CompareKernelVersion(*v, VersionInfo{Kernel: k, Major: major, Minor: minor}) < 0 { - return false - } - } - return true -} - -// ParseRelease parses a string and creates a VersionInfo based on it. -func ParseRelease(release string) (*VersionInfo, error) { - var ( - kernel, major, minor, parsed int - flavor, partial string - ) - - // Ignore error from Sscanf to allow an empty flavor. Instead, just - // make sure we got all the version numbers. - parsed, _ = fmt.Sscanf(release, "%d.%d%s", &kernel, &major, &partial) - if parsed < 2 { - return nil, errors.New("Can't parse kernel version " + release) - } - - // sometimes we have 3.12.25-gentoo, but sometimes we just have 3.12-1-amd64 - parsed, _ = fmt.Sscanf(partial, ".%d%s", &minor, &flavor) - if parsed < 1 { - flavor = partial - } - - return &VersionInfo{ - Kernel: kernel, - Major: major, - Minor: minor, - Flavor: flavor, - }, nil -} diff --git a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_darwin.go b/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_darwin.go deleted file mode 100644 index 645790da64..0000000000 --- a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_darwin.go +++ /dev/null @@ -1,57 +0,0 @@ -//go:build darwin -// +build darwin - -// Package kernel provides helper function to get, parse and compare kernel -// versions for different platforms. -package kernel - -import ( - "fmt" - "os/exec" - "strings" - - "github.com/mattn/go-shellwords" -) - -// GetKernelVersion gets the current kernel version. -func GetKernelVersion() (*VersionInfo, error) { - release, err := getRelease() - if err != nil { - return nil, err - } - - return ParseRelease(release) -} - -// getRelease uses `system_profiler SPSoftwareDataType` to get OSX kernel version -func getRelease() (string, error) { - cmd := exec.Command("system_profiler", "SPSoftwareDataType") - osName, err := cmd.Output() - if err != nil { - return "", err - } - - var release string - data := strings.Split(string(osName), "\n") - for _, line := range data { - if strings.Contains(line, "Kernel Version") { - // It has the format like ' Kernel Version: Darwin 14.5.0' - content := strings.SplitN(line, ":", 2) - if len(content) != 2 { - return "", fmt.Errorf("kernel version is invalid") - } - - prettyNames, err := shellwords.Parse(content[1]) - if err != nil { - return "", fmt.Errorf("kernel version is invalid: %w", err) - } - - if len(prettyNames) != 2 { - return "", fmt.Errorf("kernel version needs to be 'Darwin x.x.x' ") - } - release = prettyNames[1] - } - } - - return release, nil -} diff --git a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_unix.go b/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_unix.go deleted file mode 100644 index 48a8b12cf1..0000000000 --- a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_unix.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build unix && !darwin - -// Package kernel provides helper function to get, parse and compare kernel -// versions for different platforms. -package kernel - -import ( - "golang.org/x/sys/unix" -) - -// GetKernelVersion gets the current kernel version. -func GetKernelVersion() (*VersionInfo, error) { - uts := &unix.Utsname{} - - if err := unix.Uname(uts); err != nil { - return nil, err - } - - return ParseRelease(unix.ByteSliceToString(uts.Release[:])) -} diff --git a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_windows.go b/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_windows.go deleted file mode 100644 index 4b7fdee830..0000000000 --- a/vendor/github.com/containers/storage/pkg/parsers/kernel/kernel_windows.go +++ /dev/null @@ -1,70 +0,0 @@ -//go:build windows -// +build windows - -package kernel - -import ( - "fmt" - "unsafe" - - "golang.org/x/sys/windows" -) - -// VersionInfo holds information about the kernel. -type VersionInfo struct { - kvi string // Version of the kernel (e.g. 6.1.7601.17592 -> 6) - major int // Major part of the kernel version (e.g. 6.1.7601.17592 -> 1) - minor int // Minor part of the kernel version (e.g. 6.1.7601.17592 -> 7601) - build int // Build number of the kernel version (e.g. 6.1.7601.17592 -> 17592) -} - -func (k *VersionInfo) String() string { - return fmt.Sprintf("%d.%d %d (%s)", k.major, k.minor, k.build, k.kvi) -} - -// GetKernelVersion gets the current kernel version. -func GetKernelVersion() (*VersionInfo, error) { - var ( - h windows.Handle - dwVersion uint32 - err error - ) - - KVI := &VersionInfo{"Unknown", 0, 0, 0} - - if err = windows.RegOpenKeyEx(windows.HKEY_LOCAL_MACHINE, - windows.StringToUTF16Ptr(`SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\`), - 0, - windows.KEY_READ, - &h); err != nil { - return KVI, err - } - defer windows.RegCloseKey(h) - - var buf [1 << 10]uint16 - var typ uint32 - n := uint32(len(buf) * 2) // api expects array of bytes, not uint16 - - if err = windows.RegQueryValueEx(h, - windows.StringToUTF16Ptr("BuildLabEx"), - nil, - &typ, - (*byte)(unsafe.Pointer(&buf[0])), - &n); err != nil { - return KVI, err - } - - KVI.kvi = windows.UTF16ToString(buf[:]) - - // Important - docker.exe MUST be manifested for this API to return - // the correct information. - if dwVersion, err = windows.GetVersion(); err != nil { - return KVI, err - } - - KVI.major = int(dwVersion & 0xFF) - KVI.minor = int((dwVersion & 0xFF00) >> 8) - KVI.build = int((dwVersion & 0xFFFF0000) >> 16) - - return KVI, nil -} diff --git a/vendor/modules.txt b/vendor/modules.txt index e7f28c740b..346d3c73de 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -390,7 +390,6 @@ github.com/containers/storage/pkg/longpath github.com/containers/storage/pkg/loopback github.com/containers/storage/pkg/mount github.com/containers/storage/pkg/parsers -github.com/containers/storage/pkg/parsers/kernel github.com/containers/storage/pkg/pools github.com/containers/storage/pkg/promise github.com/containers/storage/pkg/reexec From faf3edb5f40257074bd1a8456d6eaac87e0eb89b Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 15 Aug 2024 15:12:37 +0200 Subject: [PATCH 5/7] [v5.2] golangci-lint: make windows linting happy It qemu cannot be compiled anyway so make sure we do not try to compile parts where the typechecker complains about on windows. Also all the e2e test files are only used on linux as well. pkg/machine/wsl also reports some error but to many for me to fix them now. One minor problem was fixed in pkg/machine/machine_windows.go. Signed-off-by: Paul Holzinger Signed-off-by: tomsweeneyredhat --- hack/golangci-lint.sh | 2 +- pkg/machine/machine_windows.go | 4 ++-- pkg/machine/qemu/config.go | 2 +- test/e2e/attach_test.go | 2 ++ test/e2e/build_test.go | 2 ++ test/e2e/checkpoint_image_test.go | 2 ++ test/e2e/checkpoint_test.go | 2 ++ test/e2e/cleanup_test.go | 2 ++ test/e2e/commit_test.go | 2 ++ test/e2e/common_test.go | 2 ++ test/e2e/config.go | 2 ++ test/e2e/config_amd64.go | 2 ++ test/e2e/config_arm64.go | 2 ++ test/e2e/config_ppc64le.go | 2 ++ test/e2e/container_clone_test.go | 2 ++ test/e2e/container_create_volume_test.go | 2 ++ test/e2e/container_iface_name_test.go | 2 ++ test/e2e/container_inspect_test.go | 2 ++ test/e2e/containers_conf_test.go | 2 ++ test/e2e/cp_test.go | 2 ++ test/e2e/create_staticip_test.go | 2 ++ test/e2e/create_staticmac_test.go | 2 ++ test/e2e/create_test.go | 2 ++ test/e2e/diff_test.go | 2 ++ test/e2e/events_test.go | 2 ++ test/e2e/exec_test.go | 2 ++ test/e2e/exists_test.go | 2 ++ test/e2e/export_test.go | 2 ++ test/e2e/farm_test.go | 2 ++ test/e2e/generate_kube_test.go | 2 ++ test/e2e/generate_spec_test.go | 2 ++ test/e2e/generate_systemd_test.go | 2 ++ test/e2e/healthcheck_run_test.go | 2 ++ test/e2e/history_test.go | 2 ++ test/e2e/image_scp_test.go | 2 ++ test/e2e/image_sign_test.go | 2 ++ test/e2e/images_test.go | 2 ++ test/e2e/import_test.go | 2 ++ test/e2e/info_test.go | 2 ++ test/e2e/init_test.go | 2 ++ test/e2e/inspect_test.go | 2 ++ test/e2e/kill_test.go | 2 ++ test/e2e/libpod_suite_remote_test.go | 2 +- test/e2e/libpod_suite_test.go | 2 +- test/e2e/load_test.go | 2 ++ test/e2e/login_logout_test.go | 2 ++ test/e2e/logs_test.go | 2 ++ test/e2e/manifest_test.go | 2 ++ test/e2e/mount_rootless_test.go | 2 ++ test/e2e/mount_test.go | 2 ++ test/e2e/negative_test.go | 2 ++ test/e2e/network_connect_disconnect_test.go | 2 ++ test/e2e/network_create_test.go | 2 ++ test/e2e/network_test.go | 2 ++ test/e2e/pause_test.go | 2 ++ test/e2e/play_build_test.go | 2 +- test/e2e/play_kube_test.go | 2 ++ test/e2e/pod_clone_test.go | 2 ++ test/e2e/pod_create_test.go | 2 ++ test/e2e/pod_infra_container_test.go | 2 ++ test/e2e/pod_initcontainers_test.go | 2 ++ test/e2e/pod_inspect_test.go | 2 ++ test/e2e/pod_kill_test.go | 2 ++ test/e2e/pod_pause_test.go | 2 ++ test/e2e/pod_pod_namespaces_test.go | 2 ++ test/e2e/pod_prune_test.go | 2 ++ test/e2e/pod_ps_test.go | 2 ++ test/e2e/pod_restart_test.go | 2 ++ test/e2e/pod_rm_test.go | 2 ++ test/e2e/pod_start_test.go | 2 ++ test/e2e/pod_stats_test.go | 2 ++ test/e2e/pod_stop_test.go | 2 ++ test/e2e/pod_top_test.go | 2 ++ test/e2e/port_test.go | 2 ++ test/e2e/prune_test.go | 2 ++ test/e2e/ps_test.go | 2 ++ test/e2e/pull_test.go | 2 ++ test/e2e/push_test.go | 2 ++ test/e2e/quadlet_test.go | 2 ++ test/e2e/rename_test.go | 2 ++ test/e2e/restart_test.go | 2 ++ test/e2e/rm_test.go | 2 ++ test/e2e/rmi_test.go | 2 ++ test/e2e/run_aardvark_test.go | 2 ++ test/e2e/run_apparmor_test.go | 2 +- test/e2e/run_cgroup_parent_test.go | 2 ++ test/e2e/run_cleanup_test.go | 2 ++ test/e2e/run_cpu_test.go | 2 ++ test/e2e/run_device_test.go | 2 ++ test/e2e/run_dns_test.go | 2 ++ test/e2e/run_entrypoint_test.go | 2 ++ test/e2e/run_env_test.go | 2 ++ test/e2e/run_exit_test.go | 2 ++ test/e2e/run_memory_test.go | 2 ++ test/e2e/run_ns_test.go | 2 ++ test/e2e/run_passwd_test.go | 2 ++ test/e2e/run_privileged_test.go | 2 ++ test/e2e/run_restart_test.go | 2 ++ test/e2e/run_seccomp_test.go | 2 ++ test/e2e/run_security_labels_test.go | 2 ++ test/e2e/run_selinux_test.go | 2 ++ test/e2e/run_signal_test.go | 2 ++ test/e2e/run_staticip_test.go | 2 ++ test/e2e/run_test.go | 2 ++ test/e2e/run_transient_test.go | 2 ++ test/e2e/run_userns_test.go | 2 ++ test/e2e/run_volume_test.go | 2 ++ test/e2e/run_working_dir_test.go | 2 ++ test/e2e/runlabel_test.go | 2 ++ test/e2e/save_test.go | 2 ++ test/e2e/search_test.go | 2 ++ test/e2e/secret_test.go | 2 ++ test/e2e/start_test.go | 2 ++ test/e2e/stats_test.go | 2 ++ test/e2e/stop_test.go | 2 ++ test/e2e/system_connection_test.go | 2 ++ test/e2e/system_df_test.go | 2 ++ test/e2e/system_dial_stdio_test.go | 2 ++ test/e2e/system_reset_test.go | 2 ++ test/e2e/systemd_activate_test.go | 2 ++ test/e2e/systemd_test.go | 2 ++ test/e2e/tag_test.go | 2 ++ test/e2e/toolbox_test.go | 2 ++ test/e2e/top_test.go | 2 ++ test/e2e/tree_test.go | 2 ++ test/e2e/trust_test.go | 2 ++ test/e2e/unshare_test.go | 2 ++ test/e2e/untag_test.go | 2 ++ test/e2e/update_test.go | 2 ++ test/e2e/version_test.go | 2 ++ test/e2e/volume_create_test.go | 2 ++ test/e2e/volume_exists_test.go | 2 ++ test/e2e/volume_inspect_test.go | 2 ++ test/e2e/volume_ls_test.go | 2 ++ test/e2e/volume_plugin_test.go | 2 ++ test/e2e/volume_prune_test.go | 2 ++ test/e2e/volume_rm_test.go | 2 ++ test/e2e/wait_test.go | 2 ++ 138 files changed, 270 insertions(+), 8 deletions(-) diff --git a/hack/golangci-lint.sh b/hack/golangci-lint.sh index 70a371ad86..17d1e00758 100755 --- a/hack/golangci-lint.sh +++ b/hack/golangci-lint.sh @@ -19,7 +19,7 @@ BUILD_TAGS_REMOTE="remote,containers_image_openpgp" SKIP_DIRS_ABI="" SKIP_DIRS_TUNNEL="" -SKIP_DIRS_REMOTE="libpod/events,test" +SKIP_DIRS_REMOTE="libpod/events,pkg/machine/qemu,pkg/machine/wsl,test" declare -a to_lint to_lint=(ABI TUNNEL) diff --git a/pkg/machine/machine_windows.go b/pkg/machine/machine_windows.go index 7d39795bc5..d6c23e64f8 100644 --- a/pkg/machine/machine_windows.go +++ b/pkg/machine/machine_windows.go @@ -207,8 +207,8 @@ func readWinProxyTid(name string, vmtype define.VMType) (uint32, uint32, string, } var pid, tid uint32 - fmt.Sscanf(string(contents), "%d:%d", &pid, &tid) - return pid, tid, tidFile, nil + _, err = fmt.Sscanf(string(contents), "%d:%d", &pid, &tid) + return pid, tid, tidFile, err } func waitTimeout(proc *os.Process, timeout time.Duration) bool { diff --git a/pkg/machine/qemu/config.go b/pkg/machine/qemu/config.go index 760df18ead..7d86bb6349 100644 --- a/pkg/machine/qemu/config.go +++ b/pkg/machine/qemu/config.go @@ -1,4 +1,4 @@ -//go:build !darwin +//go:build !darwin && !windows package qemu diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go index 1f22559023..c8570da187 100644 --- a/test/e2e/attach_test.go +++ b/test/e2e/attach_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go index d2d50d49c6..20462d457a 100644 --- a/test/e2e/build_test.go +++ b/test/e2e/build_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/checkpoint_image_test.go b/test/e2e/checkpoint_image_test.go index 093c873092..2481e2226e 100644 --- a/test/e2e/checkpoint_image_test.go +++ b/test/e2e/checkpoint_image_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index 58198fe37e..8b2f13e55e 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/cleanup_test.go b/test/e2e/cleanup_test.go index 10bdd9d92c..7f0a89b59d 100644 --- a/test/e2e/cleanup_test.go +++ b/test/e2e/cleanup_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go index 4ab55303b7..45c2bea13d 100644 --- a/test/e2e/commit_test.go +++ b/test/e2e/commit_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 5e0d1df72b..79868413b4 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/config.go b/test/e2e/config.go index 6cadae2a14..af9364502d 100644 --- a/test/e2e/config.go +++ b/test/e2e/config.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration var ( diff --git a/test/e2e/config_amd64.go b/test/e2e/config_amd64.go index f5c1b69198..b00d7bfc5b 100644 --- a/test/e2e/config_amd64.go +++ b/test/e2e/config_amd64.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration var ( diff --git a/test/e2e/config_arm64.go b/test/e2e/config_arm64.go index 1bf29d7816..785c772c25 100644 --- a/test/e2e/config_arm64.go +++ b/test/e2e/config_arm64.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration var ( diff --git a/test/e2e/config_ppc64le.go b/test/e2e/config_ppc64le.go index d89bf1d4f7..1b7b5e2961 100644 --- a/test/e2e/config_ppc64le.go +++ b/test/e2e/config_ppc64le.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration var ( diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go index 343be45164..1f5677b51a 100644 --- a/test/e2e/container_clone_test.go +++ b/test/e2e/container_clone_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go index 493d08ab39..e7cc8aa36a 100644 --- a/test/e2e/container_create_volume_test.go +++ b/test/e2e/container_create_volume_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/container_iface_name_test.go b/test/e2e/container_iface_name_test.go index a0030b94e8..74d5d91e15 100644 --- a/test/e2e/container_iface_name_test.go +++ b/test/e2e/container_iface_name_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go index 2a3861ff86..8e26eb0f25 100644 --- a/test/e2e/container_inspect_test.go +++ b/test/e2e/container_inspect_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index 129c889bcf..469558b718 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go index 4a2c7a5108..f71963a811 100644 --- a/test/e2e/cp_test.go +++ b/test/e2e/cp_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go index fba85cbf72..32a72b7880 100644 --- a/test/e2e/create_staticip_test.go +++ b/test/e2e/create_staticip_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/create_staticmac_test.go b/test/e2e/create_staticmac_test.go index d020e16530..9d9e3457df 100644 --- a/test/e2e/create_staticmac_test.go +++ b/test/e2e/create_staticmac_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index 646ff679d9..ca59962f96 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go index 7507f35def..a9c20fadc8 100644 --- a/test/e2e/diff_test.go +++ b/test/e2e/diff_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index 63ca8f239c..c16df55398 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index dcb7ff23f8..2b5b411d5b 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go index 3da48b8088..579bacda0e 100644 --- a/test/e2e/exists_test.go +++ b/test/e2e/exists_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go index efebd9f8ed..18ae177e0a 100644 --- a/test/e2e/export_test.go +++ b/test/e2e/export_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/farm_test.go b/test/e2e/farm_test.go index ede6d2d94d..556746990f 100644 --- a/test/e2e/farm_test.go +++ b/test/e2e/farm_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go index bb8800a8db..9603af245a 100644 --- a/test/e2e/generate_kube_test.go +++ b/test/e2e/generate_kube_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/generate_spec_test.go b/test/e2e/generate_spec_test.go index b4641ae57c..981f912e46 100644 --- a/test/e2e/generate_spec_test.go +++ b/test/e2e/generate_spec_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go index 81483223f5..c1c5844352 100644 --- a/test/e2e/generate_systemd_test.go +++ b/test/e2e/generate_systemd_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index de71a38ca0..5a9e444eef 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go index b5251c1c09..a69a59103f 100644 --- a/test/e2e/history_test.go +++ b/test/e2e/history_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go index e19da2d09e..917363fd70 100644 --- a/test/e2e/image_scp_test.go +++ b/test/e2e/image_scp_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/image_sign_test.go b/test/e2e/image_sign_test.go index 026a2e40e7..5940aaf4a2 100644 --- a/test/e2e/image_sign_test.go +++ b/test/e2e/image_sign_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index ddde5a27bc..7d6a12a77c 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go index fb85182e8f..eac9596a33 100644 --- a/test/e2e/import_test.go +++ b/test/e2e/import_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go index 6e5ae8722e..87c8902621 100644 --- a/test/e2e/info_test.go +++ b/test/e2e/info_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/init_test.go b/test/e2e/init_test.go index dae57b6c88..c8c544ad62 100644 --- a/test/e2e/init_test.go +++ b/test/e2e/init_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go index 72b3c8b5cc..be7809bd32 100644 --- a/test/e2e/inspect_test.go +++ b/test/e2e/inspect_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go index 981cf8d760..86e12857ee 100644 --- a/test/e2e/kill_test.go +++ b/test/e2e/kill_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go index 44a79eaf36..ceaa5851ea 100644 --- a/test/e2e/libpod_suite_remote_test.go +++ b/test/e2e/libpod_suite_remote_test.go @@ -1,4 +1,4 @@ -//go:build remote_testing +//go:build remote_testing && (linux || freebsd) package integration diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 549777e796..3b11b3952b 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -1,4 +1,4 @@ -//go:build !remote_testing +//go:build !remote_testing && (linux || freebsd) package integration diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index 9cade0294e..edfad48fb0 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index f860f94436..d0b5bb940e 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index 16392fbbd9..1dc0eb2887 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index dba357c18b..22bf064b4e 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/mount_rootless_test.go b/test/e2e/mount_rootless_test.go index 7e4af2eb68..9844f260f9 100644 --- a/test/e2e/mount_rootless_test.go +++ b/test/e2e/mount_rootless_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go index aba488528f..961e027f09 100644 --- a/test/e2e/mount_test.go +++ b/test/e2e/mount_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/negative_test.go b/test/e2e/negative_test.go index f6cae5352a..2c097bd6e4 100644 --- a/test/e2e/negative_test.go +++ b/test/e2e/negative_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go index 3764b44bc7..3b2059b244 100644 --- a/test/e2e/network_connect_disconnect_test.go +++ b/test/e2e/network_connect_disconnect_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go index 0ce6be1a52..b9fcec6431 100644 --- a/test/e2e/network_create_test.go +++ b/test/e2e/network_create_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go index 5072eeee0e..8ce85305cb 100644 --- a/test/e2e/network_test.go +++ b/test/e2e/network_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index 0b474b3ad3..bf9132a49a 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go index 80157104f5..a18f2dbb52 100644 --- a/test/e2e/play_build_test.go +++ b/test/e2e/play_build_test.go @@ -1,4 +1,4 @@ -//go:build !remote_testing +//go:build !remote_testing && (linux || freebsd) // build for play kube is not supported on remote yet. diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index cc051137d1..8291cbdb4d 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_clone_test.go b/test/e2e/pod_clone_test.go index fb240c279b..a2ddd46ac4 100644 --- a/test/e2e/pod_clone_test.go +++ b/test/e2e/pod_clone_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index c5d7ff6bb6..a84f640b8f 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go index adc0303b7d..83aff3680b 100644 --- a/test/e2e/pod_infra_container_test.go +++ b/test/e2e/pod_infra_container_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_initcontainers_test.go b/test/e2e/pod_initcontainers_test.go index 5aa291ed6f..a8458e8ea0 100644 --- a/test/e2e/pod_initcontainers_test.go +++ b/test/e2e/pod_initcontainers_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go index 8a17a59f2d..e946811187 100644 --- a/test/e2e/pod_inspect_test.go +++ b/test/e2e/pod_inspect_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index 7aa1c88cb1..7ae98d6e62 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go index b4e7c05a84..3e673dcc7f 100644 --- a/test/e2e/pod_pause_test.go +++ b/test/e2e/pod_pause_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go index a1597bca61..21409f5055 100644 --- a/test/e2e/pod_pod_namespaces_test.go +++ b/test/e2e/pod_pod_namespaces_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_prune_test.go b/test/e2e/pod_prune_test.go index 851dccabb5..cb772a397e 100644 --- a/test/e2e/pod_prune_test.go +++ b/test/e2e/pod_prune_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go index e347fd5757..0fb18d3038 100644 --- a/test/e2e/pod_ps_test.go +++ b/test/e2e/pod_ps_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go index 8a07533872..568147a27a 100644 --- a/test/e2e/pod_restart_test.go +++ b/test/e2e/pod_restart_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index cc00d68f98..a847a53414 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go index 640ff48462..9ec7bb59b4 100644 --- a/test/e2e/pod_start_test.go +++ b/test/e2e/pod_start_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go index 6dd760d1bb..f2259b9136 100644 --- a/test/e2e/pod_stats_test.go +++ b/test/e2e/pod_stats_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go index d68621d3f2..ab9f79482a 100644 --- a/test/e2e/pod_stop_test.go +++ b/test/e2e/pod_stop_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go index e104902e57..b42b50720f 100644 --- a/test/e2e/pod_top_test.go +++ b/test/e2e/pod_top_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go index 591fd9eebf..5f2a71ac0b 100644 --- a/test/e2e/port_test.go +++ b/test/e2e/port_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 7943d7cfde..dd893fc9b9 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 280f1b7af6..c79e1e55e1 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 79f26411dd..04fd63728d 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index 8a9d2827cb..d4f6df9e39 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index 7ba4e6269b..922b7a8f74 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/rename_test.go b/test/e2e/rename_test.go index 27698e937c..abd34abf12 100644 --- a/test/e2e/rename_test.go +++ b/test/e2e/rename_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go index 53872b1818..21090a337a 100644 --- a/test/e2e/restart_test.go +++ b/test/e2e/restart_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go index 7a734c9285..8b4cc4d06c 100644 --- a/test/e2e/rm_test.go +++ b/test/e2e/rm_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index bc5d2d1fa2..b4ed4bad11 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_aardvark_test.go b/test/e2e/run_aardvark_test.go index 4283639a98..6f99743eff 100644 --- a/test/e2e/run_aardvark_test.go +++ b/test/e2e/run_aardvark_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go index 152efec8f6..5f44473a9b 100644 --- a/test/e2e/run_apparmor_test.go +++ b/test/e2e/run_apparmor_test.go @@ -1,4 +1,4 @@ -//go:build !remote_testing +//go:build !remote_testing && (linux || freebsd) package integration diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go index f590087ff0..8ebcf86126 100644 --- a/test/e2e/run_cgroup_parent_test.go +++ b/test/e2e/run_cgroup_parent_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go index b484f586be..4629ddee00 100644 --- a/test/e2e/run_cleanup_test.go +++ b/test/e2e/run_cleanup_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go index 13e5586baa..956e99f5aa 100644 --- a/test/e2e/run_cpu_test.go +++ b/test/e2e/run_cpu_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go index ef6fe8b486..230eaa6635 100644 --- a/test/e2e/run_device_test.go +++ b/test/e2e/run_device_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go index 126c17a741..21b347d677 100644 --- a/test/e2e/run_dns_test.go +++ b/test/e2e/run_dns_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go index 687847c1f3..6fe07cf9ef 100644 --- a/test/e2e/run_entrypoint_test.go +++ b/test/e2e/run_entrypoint_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go index bc459b7475..f7a2851fd0 100644 --- a/test/e2e/run_env_test.go +++ b/test/e2e/run_env_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go index b300567ce5..412bd6df11 100644 --- a/test/e2e/run_exit_test.go +++ b/test/e2e/run_exit_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go index e535e6bba7..77cc748c58 100644 --- a/test/e2e/run_memory_test.go +++ b/test/e2e/run_memory_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go index 80f463a941..3cae4592ab 100644 --- a/test/e2e/run_ns_test.go +++ b/test/e2e/run_ns_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go index 3ce00b0bdc..8381ca1bdb 100644 --- a/test/e2e/run_passwd_test.go +++ b/test/e2e/run_passwd_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go index 2a30138c09..f3d571ebe6 100644 --- a/test/e2e/run_privileged_test.go +++ b/test/e2e/run_privileged_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go index 1fcaf9b191..f4a62a3b95 100644 --- a/test/e2e/run_restart_test.go +++ b/test/e2e/run_restart_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_seccomp_test.go b/test/e2e/run_seccomp_test.go index c55a8033e2..82a7a42831 100644 --- a/test/e2e/run_seccomp_test.go +++ b/test/e2e/run_seccomp_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_security_labels_test.go b/test/e2e/run_security_labels_test.go index 380beb8e92..1d13460673 100644 --- a/test/e2e/run_security_labels_test.go +++ b/test/e2e/run_security_labels_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go index 50ac5b58ca..dad1eb4e4f 100644 --- a/test/e2e/run_selinux_test.go +++ b/test/e2e/run_selinux_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go index 8f81186aa8..2f1cb18ef1 100644 --- a/test/e2e/run_signal_test.go +++ b/test/e2e/run_signal_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index 9fda9f4a4e..fd727dac08 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 95a2ab61e1..3d5007c273 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_transient_test.go b/test/e2e/run_transient_test.go index 990024cf14..46a9643e49 100644 --- a/test/e2e/run_transient_test.go +++ b/test/e2e/run_transient_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go index ffb0ef11d8..2d09ae2aef 100644 --- a/test/e2e/run_userns_test.go +++ b/test/e2e/run_userns_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index f8dc22b1ed..4a4a7078e1 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/run_working_dir_test.go b/test/e2e/run_working_dir_test.go index bc5deaff64..b002af7885 100644 --- a/test/e2e/run_working_dir_test.go +++ b/test/e2e/run_working_dir_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go index db1a6d0929..c2eac029e8 100644 --- a/test/e2e/runlabel_test.go +++ b/test/e2e/runlabel_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index 7e7cdcb406..b4dbecc54c 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 16bbe87a52..4d9f296d0a 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go index 71d5fc34bf..bf373eeebe 100644 --- a/test/e2e/secret_test.go +++ b/test/e2e/secret_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go index 773de2ffb5..0be4403580 100644 --- a/test/e2e/start_test.go +++ b/test/e2e/start_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go index 3f0d4a8f16..4a4fc460c0 100644 --- a/test/e2e/stats_test.go +++ b/test/e2e/stats_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go index 74b2b63d2c..5cd14d119b 100644 --- a/test/e2e/stop_test.go +++ b/test/e2e/stop_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go index 5757c83d36..adf8d1f131 100644 --- a/test/e2e/system_connection_test.go +++ b/test/e2e/system_connection_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go index 45945f605b..dd1d715fd2 100644 --- a/test/e2e/system_df_test.go +++ b/test/e2e/system_df_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/system_dial_stdio_test.go b/test/e2e/system_dial_stdio_test.go index 35dfd5efee..7c278f2d96 100644 --- a/test/e2e/system_dial_stdio_test.go +++ b/test/e2e/system_dial_stdio_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/system_reset_test.go b/test/e2e/system_reset_test.go index 0e641e99e2..679c4ccb3e 100644 --- a/test/e2e/system_reset_test.go +++ b/test/e2e/system_reset_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/systemd_activate_test.go b/test/e2e/systemd_activate_test.go index 51344964c3..72f539a3ed 100644 --- a/test/e2e/systemd_activate_test.go +++ b/test/e2e/systemd_activate_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go index 2b835b3059..99e454799c 100644 --- a/test/e2e/systemd_test.go +++ b/test/e2e/systemd_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go index 47b931e9bb..81c692b0f1 100644 --- a/test/e2e/tag_test.go +++ b/test/e2e/tag_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index 73b1b54ab8..b24650b56c 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration /* diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go index 262b62111a..2fbac24a97 100644 --- a/test/e2e/top_test.go +++ b/test/e2e/top_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go index 86d07f978f..03aa72e06d 100644 --- a/test/e2e/tree_test.go +++ b/test/e2e/tree_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go index db4bf25464..7f565044f9 100644 --- a/test/e2e/trust_test.go +++ b/test/e2e/trust_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/unshare_test.go b/test/e2e/unshare_test.go index 9fc5c6d79a..1d5e6cf23c 100644 --- a/test/e2e/unshare_test.go +++ b/test/e2e/unshare_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go index 0e7ba94aae..5aa8cf91ec 100644 --- a/test/e2e/untag_test.go +++ b/test/e2e/untag_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/update_test.go b/test/e2e/update_test.go index 27c091da17..04a8532209 100644 --- a/test/e2e/update_test.go +++ b/test/e2e/update_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go index ea17b01b95..d14a672825 100644 --- a/test/e2e/version_test.go +++ b/test/e2e/version_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go index 71b042a9d5..7ea3e893bd 100644 --- a/test/e2e/volume_create_test.go +++ b/test/e2e/volume_create_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_exists_test.go b/test/e2e/volume_exists_test.go index d0709048db..1a19f51699 100644 --- a/test/e2e/volume_exists_test.go +++ b/test/e2e/volume_exists_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go index f5866ccbc6..c78f2429c9 100644 --- a/test/e2e/volume_inspect_test.go +++ b/test/e2e/volume_inspect_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go index ecd31550b0..d9454c015d 100644 --- a/test/e2e/volume_ls_test.go +++ b/test/e2e/volume_ls_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go index 939e3a5e3c..6ca55b5546 100644 --- a/test/e2e/volume_plugin_test.go +++ b/test/e2e/volume_plugin_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go index aeeffe933a..d8add183f7 100644 --- a/test/e2e/volume_prune_test.go +++ b/test/e2e/volume_prune_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go index 59f611f131..8009a748bb 100644 --- a/test/e2e/volume_rm_test.go +++ b/test/e2e/volume_rm_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go index 205c4d33dd..a2f3a13175 100644 --- a/test/e2e/wait_test.go +++ b/test/e2e/wait_test.go @@ -1,3 +1,5 @@ +//go:build linux || freebsd + package integration import ( From 458d15cf5d2f77284d6290e19b59a40df9221a50 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 15 Aug 2024 15:22:53 +0200 Subject: [PATCH 6/7] [v5.2] golangci-lint: make darwin linting happy Fix one minor issue with vfkit error handling. First checking if err != nil OR errors.Is() is pointless as the err != is already true. Second nilerr complains because we return nil when we hit an error branch, in this case this is correct because an error means VM is stopped. Signed-off-by: Paul Holzinger Signed-off-by: tomsweeneyredhat --- pkg/machine/apple/vfkit/helper.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/machine/apple/vfkit/helper.go b/pkg/machine/apple/vfkit/helper.go index f971129b16..47a3c98bf6 100644 --- a/pkg/machine/apple/vfkit/helper.go +++ b/pkg/machine/apple/vfkit/helper.go @@ -102,7 +102,8 @@ func (vf *Helper) Stop(force, wait bool) error { // Wait up to 90s then hard force off for i := 0; i < 180; i++ { _, err := vf.getRawState() - if err != nil || errors.Is(err, unix.ECONNREFUSED) { + if err != nil { + //nolint:nilerr // error means vfkit is gone so machine is stopped return nil } time.Sleep(waitDuration) From 570fbc49aac2603593bf0966cdb768f52a5390d5 Mon Sep 17 00:00:00 2001 From: tomsweeneyredhat Date: Wed, 21 Aug 2024 08:42:58 -0400 Subject: [PATCH 7/7] [v5.2] Bump Buildah to v1.37.2, c/common v0.60.2, c/image v5.32.2 As the title says. Finishes the vendor dance for Podman v5.2.2 Signed-off-by: tomsweeneyredhat --- go.mod | 6 +- go.sum | 12 +- .../containers/buildah/CHANGELOG.md | 4 + .../containers/buildah/changelog.txt | 3 + .../containers/buildah/define/types.go | 2 +- .../containers/common/version/version.go | 2 +- .../image/v5/signature/fulcio_cert.go | 4 +- .../image/v5/signature/internal/rekor_set.go | 11 +- .../v5/signature/internal/sigstore_payload.go | 61 ++++-- .../v5/signature/policy_config_sigstore.go | 133 +++++++++++-- .../v5/signature/policy_eval_signedby.go | 38 ++-- .../v5/signature/policy_eval_sigstore.go | 184 ++++++++++++------ .../image/v5/signature/policy_types.go | 29 ++- .../containers/image/v5/version/version.go | 4 +- vendor/modules.txt | 6 +- 15 files changed, 358 insertions(+), 141 deletions(-) diff --git a/go.mod b/go.mod index eb65bdad9f..22a06ceb17 100644 --- a/go.mod +++ b/go.mod @@ -12,11 +12,11 @@ require ( github.com/checkpoint-restore/checkpointctl v1.2.1 github.com/checkpoint-restore/go-criu/v7 v7.1.0 github.com/containernetworking/plugins v1.5.1 - github.com/containers/buildah v1.37.1 - github.com/containers/common v0.60.1 + github.com/containers/buildah v1.37.2 + github.com/containers/common v0.60.2 github.com/containers/conmon v2.0.20+incompatible github.com/containers/gvisor-tap-vsock v0.7.4 - github.com/containers/image/v5 v5.32.1 + github.com/containers/image/v5 v5.32.2 github.com/containers/libhvee v0.7.1 github.com/containers/ocicrypt v1.2.0 github.com/containers/psgo v1.9.0 diff --git a/go.sum b/go.sum index 04086f013f..f5f406fd67 100644 --- a/go.sum +++ b/go.sum @@ -77,16 +77,16 @@ github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8F github.com/containernetworking/cni v1.2.3/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M= github.com/containernetworking/plugins v1.5.1 h1:T5ji+LPYjjgW0QM+KyrigZbLsZ8jaX+E5J/EcKOE4gQ= github.com/containernetworking/plugins v1.5.1/go.mod h1:MIQfgMayGuHYs0XdNudf31cLLAC+i242hNm6KuDGqCM= -github.com/containers/buildah v1.37.1 h1:BZ3vESqzmqGuj9kGqyjitdn9o0hD7owdZM699qtfMTc= -github.com/containers/buildah v1.37.1/go.mod h1:p/qfxznBMSn9YGYNBh0Sf2k4modfjD3us4rVqvmyeZM= -github.com/containers/common v0.60.1 h1:hMJNKfDxfXY91zD7mr4t/Ybe8JbAsTq5nkrUaCqTKsA= -github.com/containers/common v0.60.1/go.mod h1:tB0DRxznmHviECVHnqgWbl+8AVCSMZLA8qe7+U7KD6k= +github.com/containers/buildah v1.37.2 h1:KiJ3jVNUvdtGORxDz8fjjLkR81ZHQZIfnGWJWavks40= +github.com/containers/buildah v1.37.2/go.mod h1:alFCM3X0xfhE6ZjsFQkUlOMyKzOnbv9FL9fe1Ho48PA= +github.com/containers/common v0.60.2 h1:utcwp2YkO8c0mNlwRxsxfOiqfj157FRrBjxgjR6f+7o= +github.com/containers/common v0.60.2/go.mod h1:I0upBi1qJX3QmzGbUOBN1LVP6RvkKhd3qQpZbQT+Q54= github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg= github.com/containers/conmon v2.0.20+incompatible/go.mod h1:hgwZ2mtuDrppv78a/cOBNiCm6O0UMWGx1mu7P00nu5I= github.com/containers/gvisor-tap-vsock v0.7.4 h1:iOtr/KEi+r599OOx1+9Qbss91jD5yxh1HO35MKTdths= github.com/containers/gvisor-tap-vsock v0.7.4/go.mod h1:orUOSdxU/IGEOxhecu2i7EzV7k7e2TgQlyCBfUngS0A= -github.com/containers/image/v5 v5.32.1 h1:fVa7GxRC4BCPGsfSRs4JY12WyeY26SUYQ0NuANaCFrI= -github.com/containers/image/v5 v5.32.1/go.mod h1:v1l73VeMugfj/QtKI+jhYbwnwFCFnNGckvbST3rQ5Hk= +github.com/containers/image/v5 v5.32.2 h1:SzNE2Y6sf9b1GJoC8qjCuMBXwQrACFp4p0RK15+4gmQ= +github.com/containers/image/v5 v5.32.2/go.mod h1:v1l73VeMugfj/QtKI+jhYbwnwFCFnNGckvbST3rQ5Hk= github.com/containers/libhvee v0.7.1 h1:dWGF5GLq9DZvXo3P8aDp3cNieL5eCaSell4UmeA/jY4= github.com/containers/libhvee v0.7.1/go.mod h1:fRKB3AyIqHMvq6xaeYhTpckM2cdoq0oecolyoiuLP7M= github.com/containers/libtrust v0.0.0-20230121012942-c1716e8a8d01 h1:Qzk5C6cYglewc+UyGf6lc8Mj2UaPTHy/iF2De0/77CA= diff --git a/vendor/github.com/containers/buildah/CHANGELOG.md b/vendor/github.com/containers/buildah/CHANGELOG.md index e714c53121..8434e6aeae 100644 --- a/vendor/github.com/containers/buildah/CHANGELOG.md +++ b/vendor/github.com/containers/buildah/CHANGELOG.md @@ -2,6 +2,10 @@ # Changelog +## v1.37.2 (2024-08-20) + + [release-1.37] Bump c/common to v0.60.2, c/image to v5.32.2 + ## v1.37.1 (2024-08-12) [release-1.37] Bump c/common v0.60.1, c/image v5.32.1 diff --git a/vendor/github.com/containers/buildah/changelog.txt b/vendor/github.com/containers/buildah/changelog.txt index aedba23504..0d3b012275 100644 --- a/vendor/github.com/containers/buildah/changelog.txt +++ b/vendor/github.com/containers/buildah/changelog.txt @@ -1,3 +1,6 @@ +- Changelog for v1.37.2 (2024-08-20) + * [release-1.37] Bump c/common to v0.60.2, c/image to v5.32.2 + - Changelog for v1.37.1 (2024-08-12) * [release-1.37] Bump c/common v0.60.1, c/image v5.32.1 diff --git a/vendor/github.com/containers/buildah/define/types.go b/vendor/github.com/containers/buildah/define/types.go index 735c2391a8..8e2615eba6 100644 --- a/vendor/github.com/containers/buildah/define/types.go +++ b/vendor/github.com/containers/buildah/define/types.go @@ -29,7 +29,7 @@ const ( // identify working containers. Package = "buildah" // Version for the Package. Also used by .packit.sh for Packit builds. - Version = "1.37.1" + Version = "1.37.2" // DefaultRuntime if containers.conf fails. DefaultRuntime = "runc" diff --git a/vendor/github.com/containers/common/version/version.go b/vendor/github.com/containers/common/version/version.go index 5499120fc5..4867ade0bf 100644 --- a/vendor/github.com/containers/common/version/version.go +++ b/vendor/github.com/containers/common/version/version.go @@ -1,4 +1,4 @@ package version // Version is the version of the build. -const Version = "0.60.1" +const Version = "0.60.2" diff --git a/vendor/github.com/containers/image/v5/signature/fulcio_cert.go b/vendor/github.com/containers/image/v5/signature/fulcio_cert.go index 4e99864226..31dfdd3422 100644 --- a/vendor/github.com/containers/image/v5/signature/fulcio_cert.go +++ b/vendor/github.com/containers/image/v5/signature/fulcio_cert.go @@ -195,10 +195,10 @@ func (f *fulcioTrustRoot) verifyFulcioCertificateAtTime(relevantTime time.Time, return untrustedCertificate.PublicKey, nil } -func verifyRekorFulcio(rekorPublicKey *ecdsa.PublicKey, fulcioTrustRoot *fulcioTrustRoot, untrustedRekorSET []byte, +func verifyRekorFulcio(rekorPublicKeys []*ecdsa.PublicKey, fulcioTrustRoot *fulcioTrustRoot, untrustedRekorSET []byte, untrustedCertificateBytes []byte, untrustedIntermediateChainBytes []byte, untrustedBase64Signature string, untrustedPayloadBytes []byte) (crypto.PublicKey, error) { - rekorSETTime, err := internal.VerifyRekorSET(rekorPublicKey, untrustedRekorSET, untrustedCertificateBytes, + rekorSETTime, err := internal.VerifyRekorSET(rekorPublicKeys, untrustedRekorSET, untrustedCertificateBytes, untrustedBase64Signature, untrustedPayloadBytes) if err != nil { return nil, err diff --git a/vendor/github.com/containers/image/v5/signature/internal/rekor_set.go b/vendor/github.com/containers/image/v5/signature/internal/rekor_set.go index e79c91cf99..604c21c089 100644 --- a/vendor/github.com/containers/image/v5/signature/internal/rekor_set.go +++ b/vendor/github.com/containers/image/v5/signature/internal/rekor_set.go @@ -113,7 +113,7 @@ func (p UntrustedRekorPayload) MarshalJSON() ([]byte, error) { // VerifyRekorSET verifies that unverifiedRekorSET is correctly signed by publicKey and matches the rest of the data. // Returns bundle upload time on success. -func VerifyRekorSET(publicKey *ecdsa.PublicKey, unverifiedRekorSET []byte, unverifiedKeyOrCertBytes []byte, unverifiedBase64Signature string, unverifiedPayloadBytes []byte) (time.Time, error) { +func VerifyRekorSET(publicKeys []*ecdsa.PublicKey, unverifiedRekorSET []byte, unverifiedKeyOrCertBytes []byte, unverifiedBase64Signature string, unverifiedPayloadBytes []byte) (time.Time, error) { // FIXME: Should the publicKey parameter hard-code ecdsa? // == Parse SET bytes @@ -130,7 +130,14 @@ func VerifyRekorSET(publicKey *ecdsa.PublicKey, unverifiedRekorSET []byte, unver return time.Time{}, NewInvalidSignatureError(fmt.Sprintf("canonicalizing Rekor SET JSON: %v", err)) } untrustedSETPayloadHash := sha256.Sum256(untrustedSETPayloadCanonicalBytes) - if !ecdsa.VerifyASN1(publicKey, untrustedSETPayloadHash[:], untrustedSET.UntrustedSignedEntryTimestamp) { + publicKeymatched := false + for _, pk := range publicKeys { + if ecdsa.VerifyASN1(pk, untrustedSETPayloadHash[:], untrustedSET.UntrustedSignedEntryTimestamp) { + publicKeymatched = true + break + } + } + if !publicKeymatched { return time.Time{}, NewInvalidSignatureError("cryptographic signature verification of Rekor SET failed") } diff --git a/vendor/github.com/containers/image/v5/signature/internal/sigstore_payload.go b/vendor/github.com/containers/image/v5/signature/internal/sigstore_payload.go index a2609c954b..8630b08e30 100644 --- a/vendor/github.com/containers/image/v5/signature/internal/sigstore_payload.go +++ b/vendor/github.com/containers/image/v5/signature/internal/sigstore_payload.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "strings" "time" "github.com/containers/image/v5/version" @@ -171,24 +172,62 @@ type SigstorePayloadAcceptanceRules struct { ValidateSignedDockerManifestDigest func(digest.Digest) error } -// VerifySigstorePayload verifies unverifiedBase64Signature of unverifiedPayload was correctly created by publicKey, and that its principal components +// verifySigstorePayloadBlobSignature verifies unverifiedSignature of unverifiedPayload was correctly created +// by any of the public keys in publicKeys. +// +// This is an internal implementation detail of VerifySigstorePayload and should have no other callers. +// It is INSUFFICIENT alone to consider the signature acceptable. +func verifySigstorePayloadBlobSignature(publicKeys []crypto.PublicKey, unverifiedPayload, unverifiedSignature []byte) error { + if len(publicKeys) == 0 { + return errors.New("Need at least one public key to verify the sigstore payload, but got 0") + } + + verifiers := make([]sigstoreSignature.Verifier, 0, len(publicKeys)) + for _, key := range publicKeys { + // Failing to load a verifier indicates that something is really, really + // invalid about the public key; prefer to fail even if the signature might be + // valid with other keys, so that users fix their fallback keys before they need them. + // For that reason, we even initialize all verifiers before trying to validate the signature + // with any key. + verifier, err := sigstoreSignature.LoadVerifier(key, sigstoreHarcodedHashAlgorithm) + if err != nil { + return err + } + verifiers = append(verifiers, verifier) + } + + var failures []string + for _, verifier := range verifiers { + // github.com/sigstore/cosign/pkg/cosign.verifyOCISignature uses signatureoptions.WithContext(), + // which seems to be not used by anything. So we don’t bother. + err := verifier.VerifySignature(bytes.NewReader(unverifiedSignature), bytes.NewReader(unverifiedPayload)) + if err == nil { + return nil + } + + failures = append(failures, err.Error()) + } + + if len(failures) == 0 { + // Coverage: We have checked there is at least one public key, any success causes an early return, + // and any failure adds an entry to failures => there must be at least one error. + return fmt.Errorf("Internal error: signature verification failed but no errors have been recorded") + } + return NewInvalidSignatureError("cryptographic signature verification failed: " + strings.Join(failures, ", ")) +} + +// VerifySigstorePayload verifies unverifiedBase64Signature of unverifiedPayload was correctly created by any of the public keys in publicKeys, and that its principal components // match expected values, both as specified by rules, and returns it. // We return an *UntrustedSigstorePayload, although nothing actually uses it, // just to double-check against stupid typos. -func VerifySigstorePayload(publicKey crypto.PublicKey, unverifiedPayload []byte, unverifiedBase64Signature string, rules SigstorePayloadAcceptanceRules) (*UntrustedSigstorePayload, error) { - verifier, err := sigstoreSignature.LoadVerifier(publicKey, sigstoreHarcodedHashAlgorithm) - if err != nil { - return nil, fmt.Errorf("creating verifier: %w", err) - } - +func VerifySigstorePayload(publicKeys []crypto.PublicKey, unverifiedPayload []byte, unverifiedBase64Signature string, rules SigstorePayloadAcceptanceRules) (*UntrustedSigstorePayload, error) { unverifiedSignature, err := base64.StdEncoding.DecodeString(unverifiedBase64Signature) if err != nil { return nil, NewInvalidSignatureError(fmt.Sprintf("base64 decoding: %v", err)) } - // github.com/sigstore/cosign/pkg/cosign.verifyOCISignature uses signatureoptions.WithContext(), - // which seems to be not used by anything. So we don’t bother. - if err := verifier.VerifySignature(bytes.NewReader(unverifiedSignature), bytes.NewReader(unverifiedPayload)); err != nil { - return nil, NewInvalidSignatureError(fmt.Sprintf("cryptographic signature verification failed: %v", err)) + + if err := verifySigstorePayloadBlobSignature(publicKeys, unverifiedPayload, unverifiedSignature); err != nil { + return nil, err } var unmatchedPayload UntrustedSigstorePayload diff --git a/vendor/github.com/containers/image/v5/signature/policy_config_sigstore.go b/vendor/github.com/containers/image/v5/signature/policy_config_sigstore.go index beb5d0673e..965901e187 100644 --- a/vendor/github.com/containers/image/v5/signature/policy_config_sigstore.go +++ b/vendor/github.com/containers/image/v5/signature/policy_config_sigstore.go @@ -2,7 +2,6 @@ package signature import ( "encoding/json" - "errors" "fmt" "github.com/containers/image/v5/signature/internal" @@ -15,29 +14,57 @@ type PRSigstoreSignedOption func(*prSigstoreSigned) error func PRSigstoreSignedWithKeyPath(keyPath string) PRSigstoreSignedOption { return func(pr *prSigstoreSigned) error { if pr.KeyPath != "" { - return errors.New(`"keyPath" already specified`) + return InvalidPolicyFormatError(`"keyPath" already specified`) } pr.KeyPath = keyPath return nil } } +// PRSigstoreSignedWithKeyPaths specifies a value for the "keyPaths" field when calling NewPRSigstoreSigned. +func PRSigstoreSignedWithKeyPaths(keyPaths []string) PRSigstoreSignedOption { + return func(pr *prSigstoreSigned) error { + if pr.KeyPaths != nil { + return InvalidPolicyFormatError(`"keyPaths" already specified`) + } + if len(keyPaths) == 0 { + return InvalidPolicyFormatError(`"keyPaths" contains no entries`) + } + pr.KeyPaths = keyPaths + return nil + } +} + // PRSigstoreSignedWithKeyData specifies a value for the "keyData" field when calling NewPRSigstoreSigned. func PRSigstoreSignedWithKeyData(keyData []byte) PRSigstoreSignedOption { return func(pr *prSigstoreSigned) error { if pr.KeyData != nil { - return errors.New(`"keyData" already specified`) + return InvalidPolicyFormatError(`"keyData" already specified`) } pr.KeyData = keyData return nil } } +// PRSigstoreSignedWithKeyDatas specifies a value for the "keyDatas" field when calling NewPRSigstoreSigned. +func PRSigstoreSignedWithKeyDatas(keyDatas [][]byte) PRSigstoreSignedOption { + return func(pr *prSigstoreSigned) error { + if pr.KeyDatas != nil { + return InvalidPolicyFormatError(`"keyDatas" already specified`) + } + if len(keyDatas) == 0 { + return InvalidPolicyFormatError(`"keyDatas" contains no entries`) + } + pr.KeyDatas = keyDatas + return nil + } +} + // PRSigstoreSignedWithFulcio specifies a value for the "fulcio" field when calling NewPRSigstoreSigned. func PRSigstoreSignedWithFulcio(fulcio PRSigstoreSignedFulcio) PRSigstoreSignedOption { return func(pr *prSigstoreSigned) error { if pr.Fulcio != nil { - return errors.New(`"fulcio" already specified`) + return InvalidPolicyFormatError(`"fulcio" already specified`) } pr.Fulcio = fulcio return nil @@ -48,29 +75,57 @@ func PRSigstoreSignedWithFulcio(fulcio PRSigstoreSignedFulcio) PRSigstoreSignedO func PRSigstoreSignedWithRekorPublicKeyPath(rekorPublicKeyPath string) PRSigstoreSignedOption { return func(pr *prSigstoreSigned) error { if pr.RekorPublicKeyPath != "" { - return errors.New(`"rekorPublicKeyPath" already specified`) + return InvalidPolicyFormatError(`"rekorPublicKeyPath" already specified`) } pr.RekorPublicKeyPath = rekorPublicKeyPath return nil } } +// PRSigstoreSignedWithRekorPublicKeyPaths specifies a value for the rRekorPublickeyPaths" field when calling NewPRSigstoreSigned. +func PRSigstoreSignedWithRekorPublicKeyPaths(rekorPublickeyPaths []string) PRSigstoreSignedOption { + return func(pr *prSigstoreSigned) error { + if pr.RekorPublicKeyPaths != nil { + return InvalidPolicyFormatError(`"rekorPublickeyPaths" already specified`) + } + if len(rekorPublickeyPaths) == 0 { + return InvalidPolicyFormatError(`"rekorPublickeyPaths" contains no entries`) + } + pr.RekorPublicKeyPaths = rekorPublickeyPaths + return nil + } +} + // PRSigstoreSignedWithRekorPublicKeyData specifies a value for the "rekorPublicKeyData" field when calling NewPRSigstoreSigned. func PRSigstoreSignedWithRekorPublicKeyData(rekorPublicKeyData []byte) PRSigstoreSignedOption { return func(pr *prSigstoreSigned) error { if pr.RekorPublicKeyData != nil { - return errors.New(`"rekorPublicKeyData" already specified`) + return InvalidPolicyFormatError(`"rekorPublicKeyData" already specified`) } pr.RekorPublicKeyData = rekorPublicKeyData return nil } } +// PRSigstoreSignedWithRekorPublicKeyDatas specifies a value for the "rekorPublickeyDatas" field when calling NewPRSigstoreSigned. +func PRSigstoreSignedWithRekorPublicKeyDatas(rekorPublickeyDatas [][]byte) PRSigstoreSignedOption { + return func(pr *prSigstoreSigned) error { + if pr.RekorPublicKeyDatas != nil { + return InvalidPolicyFormatError(`"rekorPublickeyDatas" already specified`) + } + if len(rekorPublickeyDatas) == 0 { + return InvalidPolicyFormatError(`"rekorPublickeyDatas" contains no entries`) + } + pr.RekorPublicKeyDatas = rekorPublickeyDatas + return nil + } +} + // PRSigstoreSignedWithSignedIdentity specifies a value for the "signedIdentity" field when calling NewPRSigstoreSigned. func PRSigstoreSignedWithSignedIdentity(signedIdentity PolicyReferenceMatch) PRSigstoreSignedOption { return func(pr *prSigstoreSigned) error { if pr.SignedIdentity != nil { - return errors.New(`"signedIdentity" already specified`) + return InvalidPolicyFormatError(`"signedIdentity" already specified`) } pr.SignedIdentity = signedIdentity return nil @@ -92,21 +147,40 @@ func newPRSigstoreSigned(options ...PRSigstoreSignedOption) (*prSigstoreSigned, if res.KeyPath != "" { keySources++ } + if res.KeyPaths != nil { + keySources++ + } if res.KeyData != nil { keySources++ } + if res.KeyDatas != nil { + keySources++ + } if res.Fulcio != nil { keySources++ } if keySources != 1 { - return nil, InvalidPolicyFormatError("exactly one of keyPath, keyData and fulcio must be specified") + return nil, InvalidPolicyFormatError("exactly one of keyPath, keyPaths, keyData, keyDatas and fulcio must be specified") } - if res.RekorPublicKeyPath != "" && res.RekorPublicKeyData != nil { - return nil, InvalidPolicyFormatError("rekorPublickeyType and rekorPublickeyData cannot be used simultaneously") + rekorSources := 0 + if res.RekorPublicKeyPath != "" { + rekorSources++ } - if res.Fulcio != nil && res.RekorPublicKeyPath == "" && res.RekorPublicKeyData == nil { - return nil, InvalidPolicyFormatError("At least one of RekorPublickeyPath and RekorPublickeyData must be specified if fulcio is used") + if res.RekorPublicKeyPaths != nil { + rekorSources++ + } + if res.RekorPublicKeyData != nil { + rekorSources++ + } + if res.RekorPublicKeyDatas != nil { + rekorSources++ + } + if rekorSources > 1 { + return nil, InvalidPolicyFormatError("at most one of rekorPublickeyPath, rekorPublicKeyPaths, rekorPublickeyData and rekorPublicKeyDatas can be used simultaneously") + } + if res.Fulcio != nil && rekorSources == 0 { + return nil, InvalidPolicyFormatError("At least one of rekorPublickeyPath, rekorPublicKeyPaths, rekorPublickeyData and rekorPublicKeyDatas must be specified if fulcio is used") } if res.SignedIdentity == nil { @@ -144,7 +218,8 @@ var _ json.Unmarshaler = (*prSigstoreSigned)(nil) func (pr *prSigstoreSigned) UnmarshalJSON(data []byte) error { *pr = prSigstoreSigned{} var tmp prSigstoreSigned - var gotKeyPath, gotKeyData, gotFulcio, gotRekorPublicKeyPath, gotRekorPublicKeyData bool + var gotKeyPath, gotKeyPaths, gotKeyData, gotKeyDatas, gotFulcio bool + var gotRekorPublicKeyPath, gotRekorPublicKeyPaths, gotRekorPublicKeyData, gotRekorPublicKeyDatas bool var fulcio prSigstoreSignedFulcio var signedIdentity json.RawMessage if err := internal.ParanoidUnmarshalJSONObject(data, func(key string) any { @@ -154,18 +229,30 @@ func (pr *prSigstoreSigned) UnmarshalJSON(data []byte) error { case "keyPath": gotKeyPath = true return &tmp.KeyPath + case "keyPaths": + gotKeyPaths = true + return &tmp.KeyPaths case "keyData": gotKeyData = true return &tmp.KeyData + case "keyDatas": + gotKeyDatas = true + return &tmp.KeyDatas case "fulcio": gotFulcio = true return &fulcio case "rekorPublicKeyPath": gotRekorPublicKeyPath = true return &tmp.RekorPublicKeyPath + case "rekorPublicKeyPaths": + gotRekorPublicKeyPaths = true + return &tmp.RekorPublicKeyPaths case "rekorPublicKeyData": gotRekorPublicKeyData = true return &tmp.RekorPublicKeyData + case "rekorPublicKeyDatas": + gotRekorPublicKeyDatas = true + return &tmp.RekorPublicKeyDatas case "signedIdentity": return &signedIdentity default: @@ -192,18 +279,30 @@ func (pr *prSigstoreSigned) UnmarshalJSON(data []byte) error { if gotKeyPath { opts = append(opts, PRSigstoreSignedWithKeyPath(tmp.KeyPath)) } + if gotKeyPaths { + opts = append(opts, PRSigstoreSignedWithKeyPaths(tmp.KeyPaths)) + } if gotKeyData { opts = append(opts, PRSigstoreSignedWithKeyData(tmp.KeyData)) } + if gotKeyDatas { + opts = append(opts, PRSigstoreSignedWithKeyDatas(tmp.KeyDatas)) + } if gotFulcio { opts = append(opts, PRSigstoreSignedWithFulcio(&fulcio)) } if gotRekorPublicKeyPath { opts = append(opts, PRSigstoreSignedWithRekorPublicKeyPath(tmp.RekorPublicKeyPath)) } + if gotRekorPublicKeyPaths { + opts = append(opts, PRSigstoreSignedWithRekorPublicKeyPaths(tmp.RekorPublicKeyPaths)) + } if gotRekorPublicKeyData { opts = append(opts, PRSigstoreSignedWithRekorPublicKeyData(tmp.RekorPublicKeyData)) } + if gotRekorPublicKeyDatas { + opts = append(opts, PRSigstoreSignedWithRekorPublicKeyDatas(tmp.RekorPublicKeyDatas)) + } opts = append(opts, PRSigstoreSignedWithSignedIdentity(tmp.SignedIdentity)) res, err := newPRSigstoreSigned(opts...) @@ -221,7 +320,7 @@ type PRSigstoreSignedFulcioOption func(*prSigstoreSignedFulcio) error func PRSigstoreSignedFulcioWithCAPath(caPath string) PRSigstoreSignedFulcioOption { return func(f *prSigstoreSignedFulcio) error { if f.CAPath != "" { - return errors.New(`"caPath" already specified`) + return InvalidPolicyFormatError(`"caPath" already specified`) } f.CAPath = caPath return nil @@ -232,7 +331,7 @@ func PRSigstoreSignedFulcioWithCAPath(caPath string) PRSigstoreSignedFulcioOptio func PRSigstoreSignedFulcioWithCAData(caData []byte) PRSigstoreSignedFulcioOption { return func(f *prSigstoreSignedFulcio) error { if f.CAData != nil { - return errors.New(`"caData" already specified`) + return InvalidPolicyFormatError(`"caData" already specified`) } f.CAData = caData return nil @@ -243,7 +342,7 @@ func PRSigstoreSignedFulcioWithCAData(caData []byte) PRSigstoreSignedFulcioOptio func PRSigstoreSignedFulcioWithOIDCIssuer(oidcIssuer string) PRSigstoreSignedFulcioOption { return func(f *prSigstoreSignedFulcio) error { if f.OIDCIssuer != "" { - return errors.New(`"oidcIssuer" already specified`) + return InvalidPolicyFormatError(`"oidcIssuer" already specified`) } f.OIDCIssuer = oidcIssuer return nil @@ -254,7 +353,7 @@ func PRSigstoreSignedFulcioWithOIDCIssuer(oidcIssuer string) PRSigstoreSignedFul func PRSigstoreSignedFulcioWithSubjectEmail(subjectEmail string) PRSigstoreSignedFulcioOption { return func(f *prSigstoreSignedFulcio) error { if f.SubjectEmail != "" { - return errors.New(`"subjectEmail" already specified`) + return InvalidPolicyFormatError(`"subjectEmail" already specified`) } f.SubjectEmail = subjectEmail return nil diff --git a/vendor/github.com/containers/image/v5/signature/policy_eval_signedby.go b/vendor/github.com/containers/image/v5/signature/policy_eval_signedby.go index 896ca5a60d..e5c9329185 100644 --- a/vendor/github.com/containers/image/v5/signature/policy_eval_signedby.go +++ b/vendor/github.com/containers/image/v5/signature/policy_eval_signedby.go @@ -6,7 +6,6 @@ import ( "context" "errors" "fmt" - "os" "slices" "github.com/containers/image/v5/internal/multierr" @@ -27,33 +26,18 @@ func (pr *prSignedBy) isSignatureAuthorAccepted(ctx context.Context, image priva } // FIXME: move this to per-context initialization - var data [][]byte - keySources := 0 - if pr.KeyPath != "" { - keySources++ - d, err := os.ReadFile(pr.KeyPath) - if err != nil { - return sarRejected, nil, err - } - data = [][]byte{d} + const notOneSourceErrorText = `Internal inconsistency: not exactly one of "keyPath", "keyPaths" and "keyData" specified` + data, err := loadBytesFromConfigSources(configBytesSources{ + inconsistencyErrorMessage: notOneSourceErrorText, + path: pr.KeyPath, + paths: pr.KeyPaths, + data: pr.KeyData, + }) + if err != nil { + return sarRejected, nil, err } - if pr.KeyPaths != nil { - keySources++ - data = [][]byte{} - for _, path := range pr.KeyPaths { - d, err := os.ReadFile(path) - if err != nil { - return sarRejected, nil, err - } - data = append(data, d) - } - } - if pr.KeyData != nil { - keySources++ - data = [][]byte{pr.KeyData} - } - if keySources != 1 { - return sarRejected, nil, errors.New(`Internal inconsistency: not exactly one of "keyPath", "keyPaths" and "keyData" specified`) + if data == nil { + return sarRejected, nil, errors.New(notOneSourceErrorText) } // FIXME: move this to per-context initialization diff --git a/vendor/github.com/containers/image/v5/signature/policy_eval_sigstore.go b/vendor/github.com/containers/image/v5/signature/policy_eval_sigstore.go index 4851650778..9c553771cb 100644 --- a/vendor/github.com/containers/image/v5/signature/policy_eval_sigstore.go +++ b/vendor/github.com/containers/image/v5/signature/policy_eval_sigstore.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "os" + "strings" "github.com/containers/image/v5/internal/multierr" "github.com/containers/image/v5/internal/private" @@ -20,37 +21,69 @@ import ( "github.com/sigstore/sigstore/pkg/cryptoutils" ) -// loadBytesFromDataOrPath ensures there is at most one of ${prefix}Data and ${prefix}Path set, +// configBytesSources contains configuration fields which may result in one or more []byte values +type configBytesSources struct { + inconsistencyErrorMessage string // Error to return if more than one source is set + path string // …Path: a path to a file containing the data, or "" + paths []string // …Paths: paths to files containing the data, or nil + data []byte // …Data: a single instance ofhe raw data, or nil + datas [][]byte // …Datas: the raw data, or nil // codespell:ignore datas +} + +// loadBytesFromConfigSources ensures at most one of the sources in src is set, // and returns the referenced data, or nil if neither is set. -func loadBytesFromDataOrPath(prefix string, data []byte, path string) ([]byte, error) { - switch { - case data != nil && path != "": - return nil, fmt.Errorf(`Internal inconsistency: both "%sPath" and "%sData" specified`, prefix, prefix) - case path != "": - d, err := os.ReadFile(path) +func loadBytesFromConfigSources(src configBytesSources) ([][]byte, error) { + sources := 0 + var data [][]byte // = nil + if src.path != "" { + sources++ + d, err := os.ReadFile(src.path) if err != nil { return nil, err } - return d, nil - case data != nil: - return data, nil - default: // Nothing - return nil, nil + data = [][]byte{d} } + if src.paths != nil { + sources++ + data = [][]byte{} + for _, path := range src.paths { + d, err := os.ReadFile(path) + if err != nil { + return nil, err + } + data = append(data, d) + } + } + if src.data != nil { + sources++ + data = [][]byte{src.data} + } + if src.datas != nil { // codespell:ignore datas + sources++ + data = src.datas // codespell:ignore datas + } + if sources > 1 { + return nil, errors.New(src.inconsistencyErrorMessage) + } + return data, nil } // prepareTrustRoot creates a fulcioTrustRoot from the input data. // (This also prevents external implementations of this interface, ensuring that prSigstoreSignedFulcio is the only one.) func (f *prSigstoreSignedFulcio) prepareTrustRoot() (*fulcioTrustRoot, error) { - caCertBytes, err := loadBytesFromDataOrPath("fulcioCA", f.CAData, f.CAPath) + caCertPEMs, err := loadBytesFromConfigSources(configBytesSources{ + inconsistencyErrorMessage: `Internal inconsistency: both "caPath" and "caData" specified`, + path: f.CAPath, + data: f.CAData, + }) if err != nil { return nil, err } - if caCertBytes == nil { - return nil, errors.New(`Internal inconsistency: Fulcio specified with neither "caPath" nor "caData"`) + if len(caCertPEMs) != 1 { + return nil, errors.New(`Internal inconsistency: Fulcio specified with not exactly one of "caPath" nor "caData"`) } certs := x509.NewCertPool() - if ok := certs.AppendCertsFromPEM(caCertBytes); !ok { + if ok := certs.AppendCertsFromPEM(caCertPEMs[0]); !ok { return nil, errors.New("error loading Fulcio CA certificates") } fulcio := fulcioTrustRoot{ @@ -66,24 +99,35 @@ func (f *prSigstoreSignedFulcio) prepareTrustRoot() (*fulcioTrustRoot, error) { // sigstoreSignedTrustRoot contains an already parsed version of the prSigstoreSigned policy type sigstoreSignedTrustRoot struct { - publicKey crypto.PublicKey - fulcio *fulcioTrustRoot - rekorPublicKey *ecdsa.PublicKey + publicKeys []crypto.PublicKey + fulcio *fulcioTrustRoot + rekorPublicKeys []*ecdsa.PublicKey } func (pr *prSigstoreSigned) prepareTrustRoot() (*sigstoreSignedTrustRoot, error) { res := sigstoreSignedTrustRoot{} - publicKeyPEM, err := loadBytesFromDataOrPath("key", pr.KeyData, pr.KeyPath) + publicKeyPEMs, err := loadBytesFromConfigSources(configBytesSources{ + inconsistencyErrorMessage: `Internal inconsistency: more than one of "keyPath", "keyPaths", "keyData", "keyDatas" specified`, + path: pr.KeyPath, + paths: pr.KeyPaths, + data: pr.KeyData, + datas: pr.KeyDatas, // codespell:ignore datas + }) if err != nil { return nil, err } - if publicKeyPEM != nil { - pk, err := cryptoutils.UnmarshalPEMToPublicKey(publicKeyPEM) - if err != nil { - return nil, fmt.Errorf("parsing public key: %w", err) + if publicKeyPEMs != nil { + for index, keyData := range publicKeyPEMs { + pk, err := cryptoutils.UnmarshalPEMToPublicKey(keyData) + if err != nil { + return nil, fmt.Errorf("parsing public key %d: %w", index+1, err) + } + res.publicKeys = append(res.publicKeys, pk) + } + if len(res.publicKeys) == 0 { + return nil, errors.New(`Internal inconsistency: "keyPath", "keyPaths", "keyData" and "keyDatas" produced no public keys`) } - res.publicKey = pk } if pr.Fulcio != nil { @@ -94,21 +138,32 @@ func (pr *prSigstoreSigned) prepareTrustRoot() (*sigstoreSignedTrustRoot, error) res.fulcio = f } - rekorPublicKeyPEM, err := loadBytesFromDataOrPath("rekorPublicKey", pr.RekorPublicKeyData, pr.RekorPublicKeyPath) + rekorPublicKeyPEMs, err := loadBytesFromConfigSources(configBytesSources{ + inconsistencyErrorMessage: `Internal inconsistency: both "rekorPublicKeyPath" and "rekorPublicKeyData" specified`, + path: pr.RekorPublicKeyPath, + paths: pr.RekorPublicKeyPaths, + data: pr.RekorPublicKeyData, + datas: pr.RekorPublicKeyDatas, // codespell:ignore datas + }) if err != nil { return nil, err } - if rekorPublicKeyPEM != nil { - pk, err := cryptoutils.UnmarshalPEMToPublicKey(rekorPublicKeyPEM) - if err != nil { - return nil, fmt.Errorf("parsing Rekor public key: %w", err) - } - pkECDSA, ok := pk.(*ecdsa.PublicKey) - if !ok { - return nil, fmt.Errorf("Rekor public key is not using ECDSA") + if rekorPublicKeyPEMs != nil { + for index, pem := range rekorPublicKeyPEMs { + pk, err := cryptoutils.UnmarshalPEMToPublicKey(pem) + if err != nil { + return nil, fmt.Errorf("parsing Rekor public key %d: %w", index+1, err) + } + pkECDSA, ok := pk.(*ecdsa.PublicKey) + if !ok { + return nil, fmt.Errorf("Rekor public key %d is not using ECDSA", index+1) + } + res.rekorPublicKeys = append(res.rekorPublicKeys, pkECDSA) + } + if len(res.rekorPublicKeys) == 0 { + return nil, errors.New(`Internal inconsistency: "rekorPublicKeyPath", "rekorPublicKeyPaths", "rekorPublicKeyData" and "rekorPublicKeyDatas" produced no public keys`) } - res.rekorPublicKey = pkECDSA } return &res, nil @@ -134,37 +189,51 @@ func (pr *prSigstoreSigned) isSignatureAccepted(ctx context.Context, image priva } untrustedPayload := sig.UntrustedPayload() - var publicKey crypto.PublicKey + var publicKeys []crypto.PublicKey switch { - case trustRoot.publicKey != nil && trustRoot.fulcio != nil: // newPRSigstoreSigned rejects such combinations. + case trustRoot.publicKeys != nil && trustRoot.fulcio != nil: // newPRSigstoreSigned rejects such combinations. return sarRejected, errors.New("Internal inconsistency: Both a public key and Fulcio CA specified") - case trustRoot.publicKey == nil && trustRoot.fulcio == nil: // newPRSigstoreSigned rejects such combinations. + case trustRoot.publicKeys == nil && trustRoot.fulcio == nil: // newPRSigstoreSigned rejects such combinations. return sarRejected, errors.New("Internal inconsistency: Neither a public key nor a Fulcio CA specified") - case trustRoot.publicKey != nil: - if trustRoot.rekorPublicKey != nil { + case trustRoot.publicKeys != nil: + if trustRoot.rekorPublicKeys != nil { untrustedSET, ok := untrustedAnnotations[signature.SigstoreSETAnnotationKey] if !ok { // For user convenience; passing an empty []byte to VerifyRekorSet should work. return sarRejected, fmt.Errorf("missing %s annotation", signature.SigstoreSETAnnotationKey) } - // We could use publicKeyPEM directly, but let’s re-marshal to avoid inconsistencies. - // FIXME: We could just generate DER instead of the full PEM text - recreatedPublicKeyPEM, err := cryptoutils.MarshalPublicKeyToPEM(trustRoot.publicKey) - if err != nil { - // Coverage: The key was loaded from a PEM format, so it’s unclear how this could fail. - // (PEM is not essential, MarshalPublicKeyToPEM can only fail if marshaling to ASN1.DER fails.) - return sarRejected, fmt.Errorf("re-marshaling public key to PEM: %w", err) + var rekorFailures []string + for _, candidatePublicKey := range trustRoot.publicKeys { + // We could use publicKeyPEM directly, but let’s re-marshal to avoid inconsistencies. + // FIXME: We could just generate DER instead of the full PEM text + recreatedPublicKeyPEM, err := cryptoutils.MarshalPublicKeyToPEM(candidatePublicKey) + if err != nil { + // Coverage: The key was loaded from a PEM format, so it’s unclear how this could fail. + // (PEM is not essential, MarshalPublicKeyToPEM can only fail if marshaling to ASN1.DER fails.) + return sarRejected, fmt.Errorf("re-marshaling public key to PEM: %w", err) + } + // We don’t care about the Rekor timestamp, just about log presence. + _, err = internal.VerifyRekorSET(trustRoot.rekorPublicKeys, []byte(untrustedSET), recreatedPublicKeyPEM, untrustedBase64Signature, untrustedPayload) + if err == nil { + publicKeys = append(publicKeys, candidatePublicKey) + break // The SET can only accept one public key entry, so if we found one, the rest either doesn’t match or is a duplicate + } + rekorFailures = append(rekorFailures, err.Error()) } - // We don’t care about the Rekor timestamp, just about log presence. - if _, err := internal.VerifyRekorSET(trustRoot.rekorPublicKey, []byte(untrustedSET), recreatedPublicKeyPEM, untrustedBase64Signature, untrustedPayload); err != nil { - return sarRejected, err + if len(publicKeys) == 0 { + if len(rekorFailures) == 0 { + // Coverage: We have ensured that len(trustRoot.publicKeys) != 0, when nothing succeeds, there must be at least one failure. + return sarRejected, errors.New(`Internal inconsistency: Rekor SET did not match any key but we have no failures.`) + } + return sarRejected, internal.NewInvalidSignatureError(fmt.Sprintf("No public key verified against the RekorSET: %s", strings.Join(rekorFailures, ", "))) } + } else { + publicKeys = trustRoot.publicKeys } - publicKey = trustRoot.publicKey case trustRoot.fulcio != nil: - if trustRoot.rekorPublicKey == nil { // newPRSigstoreSigned rejects such combinations. + if trustRoot.rekorPublicKeys == nil { // newPRSigstoreSigned rejects such combinations. return sarRejected, errors.New("Internal inconsistency: Fulcio CA specified without a Rekor public key") } untrustedSET, ok := untrustedAnnotations[signature.SigstoreSETAnnotationKey] @@ -179,19 +248,20 @@ func (pr *prSigstoreSigned) isSignatureAccepted(ctx context.Context, image priva if untrustedIntermediateChain, ok := untrustedAnnotations[signature.SigstoreIntermediateCertificateChainAnnotationKey]; ok { untrustedIntermediateChainBytes = []byte(untrustedIntermediateChain) } - pk, err := verifyRekorFulcio(trustRoot.rekorPublicKey, trustRoot.fulcio, + pk, err := verifyRekorFulcio(trustRoot.rekorPublicKeys, trustRoot.fulcio, []byte(untrustedSET), []byte(untrustedCert), untrustedIntermediateChainBytes, untrustedBase64Signature, untrustedPayload) if err != nil { return sarRejected, err } - publicKey = pk + publicKeys = []crypto.PublicKey{pk} } - if publicKey == nil { - // Coverage: This should never happen, we have already excluded the possibility in the switch above. + if len(publicKeys) == 0 { + // Coverage: This should never happen, we ensured that trustRoot.publicKeys is non-empty if set, + // and we have already excluded the possibility in the switch above. return sarRejected, fmt.Errorf("Internal inconsistency: publicKey not set before verifying sigstore payload") } - signature, err := internal.VerifySigstorePayload(publicKey, untrustedPayload, untrustedBase64Signature, internal.SigstorePayloadAcceptanceRules{ + signature, err := internal.VerifySigstorePayload(publicKeys, untrustedPayload, untrustedBase64Signature, internal.SigstorePayloadAcceptanceRules{ ValidateSignedDockerReference: func(ref string) error { if !pr.SignedIdentity.matchesDockerReference(image, ref) { return PolicyRequirementError(fmt.Sprintf("Signature for identity %q is not accepted", ref)) diff --git a/vendor/github.com/containers/image/v5/signature/policy_types.go b/vendor/github.com/containers/image/v5/signature/policy_types.go index 96e91a0a9c..32aa1c0ad4 100644 --- a/vendor/github.com/containers/image/v5/signature/policy_types.go +++ b/vendor/github.com/containers/image/v5/signature/policy_types.go @@ -74,7 +74,7 @@ type prSignedBy struct { // KeyPath is a pathname to a local file containing the trusted key(s). Exactly one of KeyPath, KeyPaths and KeyData must be specified. KeyPath string `json:"keyPath,omitempty"` - // KeyPaths if a set of pathnames to local files containing the trusted key(s). Exactly one of KeyPath, KeyPaths and KeyData must be specified. + // KeyPaths is a set of pathnames to local files containing the trusted key(s). Exactly one of KeyPath, KeyPaths and KeyData must be specified. KeyPaths []string `json:"keyPaths,omitempty"` // KeyData contains the trusted key(s), base64-encoded. Exactly one of KeyPath, KeyPaths and KeyData must be specified. KeyData []byte `json:"keyData,omitempty"` @@ -111,24 +111,35 @@ type prSignedBaseLayer struct { type prSigstoreSigned struct { prCommon - // KeyPath is a pathname to a local file containing the trusted key. Exactly one of KeyPath, KeyData, Fulcio must be specified. + // KeyPath is a pathname to a local file containing the trusted key. Exactly one of KeyPath, KeyPaths, KeyData, KeyDatas and Fulcio must be specified. KeyPath string `json:"keyPath,omitempty"` - // KeyData contains the trusted key, base64-encoded. Exactly one of KeyPath, KeyData, Fulcio must be specified. + // KeyPaths is a set of pathnames to local files containing the trusted key(s). Exactly one of KeyPath, KeyPaths, KeyData, KeyDatas and Fulcio must be specified. + KeyPaths []string `json:"keyPaths,omitempty"` + // KeyData contains the trusted key, base64-encoded. Exactly one of KeyPath, KeyPaths, KeyData, KeyDatas and Fulcio must be specified. KeyData []byte `json:"keyData,omitempty"` - // FIXME: Multiple public keys? + // KeyDatas is a set of trusted keys, base64-encoded. Exactly one of KeyPath, KeyPaths, KeyData, KeyDatas and Fulcio must be specified. + KeyDatas [][]byte `json:"keyDatas,omitempty"` - // Fulcio specifies which Fulcio-generated certificates are accepted. Exactly one of KeyPath, KeyData, Fulcio must be specified. + // Fulcio specifies which Fulcio-generated certificates are accepted. Exactly one of KeyPath, KeyPaths, KeyData, KeyDatas and Fulcio must be specified. // If Fulcio is specified, one of RekorPublicKeyPath or RekorPublicKeyData must be specified as well. Fulcio PRSigstoreSignedFulcio `json:"fulcio,omitempty"` // RekorPublicKeyPath is a pathname to local file containing a public key of a Rekor server which must record acceptable signatures. - // If Fulcio is used, one of RekorPublicKeyPath or RekorPublicKeyData must be specified as well; otherwise it is optional - // (and Rekor inclusion is not required if a Rekor public key is not specified). + // If Fulcio is used, one of RekorPublicKeyPath, RekorPublicKeyPaths, RekorPublicKeyData and RekorPublicKeyDatas must be specified as well; + // otherwise it is optional (and Rekor inclusion is not required if a Rekor public key is not specified). RekorPublicKeyPath string `json:"rekorPublicKeyPath,omitempty"` + // RekorPublicKeyPaths is a set of pathnames to local files, each containing a public key of a Rekor server. One of the keys must record acceptable signatures. + // If Fulcio is used, one of RekorPublicKeyPath, RekorPublicKeyPaths, RekorPublicKeyData and RekorPublicKeyDatas must be specified as well; + // otherwise it is optional (and Rekor inclusion is not required if a Rekor public key is not specified). + RekorPublicKeyPaths []string `json:"rekorPublicKeyPaths,omitempty"` // RekorPublicKeyPath contain a base64-encoded public key of a Rekor server which must record acceptable signatures. - // If Fulcio is used, one of RekorPublicKeyPath or RekorPublicKeyData must be specified as well; otherwise it is optional - // (and Rekor inclusion is not required if a Rekor public key is not specified). + // If Fulcio is used, one of RekorPublicKeyPath, RekorPublicKeyPaths, RekorPublicKeyData and RekorPublicKeyDatas must be specified as well; + // otherwise it is optional (and Rekor inclusion is not required if a Rekor public key is not specified). RekorPublicKeyData []byte `json:"rekorPublicKeyData,omitempty"` + // RekorPublicKeyDatas each contain a base64-encoded public key of a Rekor server. One of the keys must record acceptable signatures. + // If Fulcio is used, one of RekorPublicKeyPath, RekorPublicKeyPaths, RekorPublicKeyData and RekorPublicKeyDatas must be specified as well; + // otherwise it is optional (and Rekor inclusion is not required if a Rekor public key is not specified). + RekorPublicKeyDatas [][]byte `json:"rekorPublicKeyDatas,omitempty"` // SignedIdentity specifies what image identity the signature must be claiming about the image. // Defaults to "matchRepoDigestOrExact" if not specified. diff --git a/vendor/github.com/containers/image/v5/version/version.go b/vendor/github.com/containers/image/v5/version/version.go index 19f708adb9..64e4687259 100644 --- a/vendor/github.com/containers/image/v5/version/version.go +++ b/vendor/github.com/containers/image/v5/version/version.go @@ -6,9 +6,9 @@ const ( // VersionMajor is for an API incompatible changes VersionMajor = 5 // VersionMinor is for functionality in a backwards-compatible manner - VersionMinor = 33 + VersionMinor = 32 // VersionPatch is for backwards-compatible bug fixes - VersionPatch = 1 + VersionPatch = 2 // VersionDev indicates development branch. Releases will be empty string. VersionDev = "" diff --git a/vendor/modules.txt b/vendor/modules.txt index 346d3c73de..69255b2804 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -140,7 +140,7 @@ github.com/containernetworking/cni/pkg/version # github.com/containernetworking/plugins v1.5.1 ## explicit; go 1.20 github.com/containernetworking/plugins/pkg/ns -# github.com/containers/buildah v1.37.1 +# github.com/containers/buildah v1.37.2 ## explicit; go 1.21.0 github.com/containers/buildah github.com/containers/buildah/bind @@ -170,7 +170,7 @@ github.com/containers/buildah/pkg/sshagent github.com/containers/buildah/pkg/util github.com/containers/buildah/pkg/volumes github.com/containers/buildah/util -# github.com/containers/common v0.60.1 +# github.com/containers/common v0.60.2 ## explicit; go 1.21.0 github.com/containers/common/internal github.com/containers/common/internal/attributedstring @@ -243,7 +243,7 @@ github.com/containers/conmon/runner/config # github.com/containers/gvisor-tap-vsock v0.7.4 ## explicit; go 1.21 github.com/containers/gvisor-tap-vsock/pkg/types -# github.com/containers/image/v5 v5.32.1 +# github.com/containers/image/v5 v5.32.2 ## explicit; go 1.21.0 github.com/containers/image/v5/copy github.com/containers/image/v5/directory