summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/early_init_unsupported.go1
-rw-r--r--cmd/podman/images/utils_unsupported.go1
-rw-r--r--cmd/podman/machine/init.go1
-rw-r--r--cmd/podman/machine/machine.go1
-rw-r--r--cmd/podman/machine/machine_unsupported.go1
-rw-r--r--cmd/podman/machine/platform.go1
-rw-r--r--cmd/podman/machine/rm.go1
-rw-r--r--cmd/podman/machine/set.go1
-rw-r--r--cmd/podman/machine/ssh.go1
-rw-r--r--cmd/podman/machine/start.go4
-rw-r--r--cmd/podman/registry/config_abi.go1
-rw-r--r--cmd/podman/registry/config_tunnel.go1
-rw-r--r--cmd/podman/syslog_unsupported.go1
-rw-r--r--cmd/podman/system/migrate.go1
-rw-r--r--cmd/podman/system/renumber.go1
-rw-r--r--cmd/podman/system/reset.go1
-rw-r--r--cmd/podman/system/service.go1
-rw-r--r--cmd/podman/system/service_abi.go1
-rw-r--r--cmd/podman/utils/signals_linux.go1
-rw-r--r--cmd/podman/utils/signals_windows.go1
-rwxr-xr-xcontrib/cirrus/logformatter19
-rwxr-xr-xcontrib/cirrus/logformatter.t6
-rw-r--r--dependencies/dependencies.go1
-rw-r--r--libpod/boltdb_state_linux.go1
-rw-r--r--libpod/container_copy_linux.go1
-rw-r--r--libpod/container_linux.go1
-rw-r--r--libpod/container_log_unsupported.go3
-rw-r--r--libpod/container_stat_linux.go1
-rw-r--r--libpod/container_top_linux.go1
-rw-r--r--libpod/events/events_unsupported.go1
-rw-r--r--libpod/events/journal_linux.go1
-rw-r--r--libpod/events/journal_unsupported.go1
-rw-r--r--libpod/linkmode/linkmode_dynamic.go1
-rw-r--r--libpod/linkmode/linkmode_static.go1
-rw-r--r--libpod/lock/shm/shm_lock.go1
-rw-r--r--libpod/lock/shm/shm_lock_nocgo.go1
-rw-r--r--libpod/lock/shm/shm_lock_test.go1
-rw-r--r--libpod/lock/shm_lock_manager_linux.go1
-rw-r--r--libpod/lock/shm_lock_manager_unsupported.go1
-rw-r--r--libpod/mounts_linux.go1
-rw-r--r--libpod/networking_linux.go1
-rw-r--r--libpod/networking_slirp4netns.go1
-rw-r--r--libpod/oci_attach_linux.go3
-rw-r--r--libpod/oci_conmon_linux.go3
-rw-r--r--libpod/pod_top_linux.go1
-rw-r--r--libpod/runtime.go4
-rw-r--r--libpod/runtime_migrate.go1
-rw-r--r--libpod/runtime_volume_linux.go1
-rw-r--r--libpod/stats.go1
-rw-r--r--libpod/util_linux.go1
-rw-r--r--pkg/api/handlers/libpod/generate.go34
-rw-r--r--pkg/bindings/generator/generator.go1
-rw-r--r--pkg/bindings/images/build_unix.go1
-rw-r--r--pkg/criu/criu.go1
-rw-r--r--pkg/criu/criu_unsupported.go1
-rw-r--r--pkg/ctime/ctime_linux.go1
-rw-r--r--pkg/ctime/ctime_unsupported.go1
-rw-r--r--pkg/domain/infra/abi/play.go1
-rw-r--r--pkg/domain/infra/runtime_abi.go1
-rw-r--r--pkg/domain/infra/runtime_abi_unsupported.go1
-rw-r--r--pkg/domain/infra/runtime_libpod.go1
-rw-r--r--pkg/domain/infra/runtime_proxy.go1
-rw-r--r--pkg/domain/infra/runtime_tunnel.go1
-rw-r--r--pkg/env/env_unix.go1
-rw-r--r--pkg/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go1
-rw-r--r--pkg/machine/fcos.go1
-rw-r--r--pkg/machine/fedora.go1
-rw-r--r--pkg/machine/ignition_darwin.go3
-rw-r--r--pkg/machine/ignition_schema.go1
-rw-r--r--pkg/machine/ignition_windows.go3
-rw-r--r--pkg/machine/keys.go1
-rw-r--r--pkg/machine/machine_unsupported.go1
-rw-r--r--pkg/machine/pull.go1
-rw-r--r--pkg/machine/qemu/machine.go112
-rw-r--r--pkg/machine/qemu/machine_unsupported.go1
-rw-r--r--pkg/machine/wsl/machine_unsupported.go1
-rw-r--r--pkg/rootless/rootless_linux.go1
-rw-r--r--pkg/rootless/rootless_unsupported.go1
-rw-r--r--pkg/rootlessport/rootlessport_linux.go1
-rw-r--r--pkg/servicereaper/service.go3
-rw-r--r--pkg/signal/signal_linux.go4
-rw-r--r--pkg/signal/signal_linux_mipsx.go1
-rw-r--r--pkg/signal/signal_unix.go1
-rw-r--r--pkg/signal/signal_unsupported.go1
-rw-r--r--pkg/specgen/config_unsupported.go1
-rw-r--r--pkg/specgen/generate/config_linux_cgo.go1
-rw-r--r--pkg/specgen/generate/config_linux_nocgo.go1
-rw-r--r--pkg/specgen/generate/pod_create.go1
-rw-r--r--pkg/systemd/generate/common.go14
-rw-r--r--pkg/systemd/generate/containers.go4
-rw-r--r--pkg/systemd/generate/containers_test.go42
-rw-r--r--pkg/systemd/generate/pods.go3
-rw-r--r--pkg/systemd/generate/pods_test.go44
-rw-r--r--pkg/terminal/console_unix.go1
-rw-r--r--pkg/terminal/console_windows.go1
-rw-r--r--pkg/util/mountOpts_other.go1
-rw-r--r--pkg/util/utils_darwin.go3
-rw-r--r--pkg/util/utils_supported.go1
-rw-r--r--pkg/util/utils_unsupported.go1
-rw-r--r--pkg/util/utils_windows.go1
-rw-r--r--test/apiv2/20-containers.at2
-rwxr-xr-xtest/apiv2/test-apiv244
-rw-r--r--test/checkseccomp/checkseccomp.go1
-rw-r--r--test/e2e/generate_systemd_test.go52
-rw-r--r--test/e2e/libpod_suite_test.go1
-rw-r--r--test/e2e/play_build_test.go1
-rw-r--r--test/e2e/run_apparmor_test.go1
-rw-r--r--test/e2e/systemd_activate_test.go107
-rw-r--r--test/system/010-images.bats3
-rw-r--r--test/system/070-build.bats11
-rw-r--r--test/system/200-pod.bats8
-rw-r--r--test/system/helpers.bash9
-rw-r--r--test/utils/utils.go2
-rw-r--r--utils/utils_supported.go1
-rw-r--r--utils/utils_windows.go1
115 files changed, 542 insertions, 94 deletions
diff --git a/cmd/podman/early_init_unsupported.go b/cmd/podman/early_init_unsupported.go
index 4e748559f..55bb0906f 100644
--- a/cmd/podman/early_init_unsupported.go
+++ b/cmd/podman/early_init_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package main
diff --git a/cmd/podman/images/utils_unsupported.go b/cmd/podman/images/utils_unsupported.go
index 69d1df786..7d4a19ded 100644
--- a/cmd/podman/images/utils_unsupported.go
+++ b/cmd/podman/images/utils_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package images
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go
index ab13d8651..8fb9f17c7 100644
--- a/cmd/podman/machine/init.go
+++ b/cmd/podman/machine/init.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/cmd/podman/machine/machine.go b/cmd/podman/machine/machine.go
index 4937fcbda..d3775f022 100644
--- a/cmd/podman/machine/machine.go
+++ b/cmd/podman/machine/machine.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/cmd/podman/machine/machine_unsupported.go b/cmd/podman/machine/machine_unsupported.go
index 2f4189446..e11049888 100644
--- a/cmd/podman/machine/machine_unsupported.go
+++ b/cmd/podman/machine/machine_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !amd64 && !arm64
// +build !amd64,!arm64
package machine
diff --git a/cmd/podman/machine/platform.go b/cmd/podman/machine/platform.go
index bbcf06c85..77fec083e 100644
--- a/cmd/podman/machine/platform.go
+++ b/cmd/podman/machine/platform.go
@@ -1,3 +1,4 @@
+//go:build (amd64 && !windows) || (arm64 && !windows)
// +build amd64,!windows arm64,!windows
package machine
diff --git a/cmd/podman/machine/rm.go b/cmd/podman/machine/rm.go
index 3e5d5fb0b..82c68c4cf 100644
--- a/cmd/podman/machine/rm.go
+++ b/cmd/podman/machine/rm.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/cmd/podman/machine/set.go b/cmd/podman/machine/set.go
index c978206f0..4a05a9c1c 100644
--- a/cmd/podman/machine/set.go
+++ b/cmd/podman/machine/set.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/cmd/podman/machine/ssh.go b/cmd/podman/machine/ssh.go
index ba37f7ba4..e1175d632 100644
--- a/cmd/podman/machine/ssh.go
+++ b/cmd/podman/machine/ssh.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/cmd/podman/machine/start.go b/cmd/podman/machine/start.go
index 16faa25ef..56acb09cb 100644
--- a/cmd/podman/machine/start.go
+++ b/cmd/podman/machine/start.go
@@ -57,10 +57,6 @@ func start(cmd *cobra.Command, args []string) error {
}
return errors.Wrapf(machine.ErrMultipleActiveVM, "cannot start VM %s. VM %s is currently running", vmName, activeName)
}
- vm, err = provider.LoadVMByName(vmName)
- if err != nil {
- return err
- }
fmt.Printf("Starting machine %q\n", vmName)
if err := vm.Start(vmName, machine.StartOptions{}); err != nil {
return err
diff --git a/cmd/podman/registry/config_abi.go b/cmd/podman/registry/config_abi.go
index 4a909c17e..7babfa169 100644
--- a/cmd/podman/registry/config_abi.go
+++ b/cmd/podman/registry/config_abi.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package registry
diff --git a/cmd/podman/registry/config_tunnel.go b/cmd/podman/registry/config_tunnel.go
index bb3da947e..dfdbab8f8 100644
--- a/cmd/podman/registry/config_tunnel.go
+++ b/cmd/podman/registry/config_tunnel.go
@@ -1,3 +1,4 @@
+//go:build remote
// +build remote
package registry
diff --git a/cmd/podman/syslog_unsupported.go b/cmd/podman/syslog_unsupported.go
index 3765d96b9..42a7851ab 100644
--- a/cmd/podman/syslog_unsupported.go
+++ b/cmd/podman/syslog_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package main
diff --git a/cmd/podman/system/migrate.go b/cmd/podman/system/migrate.go
index c6b6546e7..5d7b31314 100644
--- a/cmd/podman/system/migrate.go
+++ b/cmd/podman/system/migrate.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package system
diff --git a/cmd/podman/system/renumber.go b/cmd/podman/system/renumber.go
index b310dc607..f24488822 100644
--- a/cmd/podman/system/renumber.go
+++ b/cmd/podman/system/renumber.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package system
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index 07904faaa..e8cf127b7 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package system
diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go
index daf252401..dd64db169 100644
--- a/cmd/podman/system/service.go
+++ b/cmd/podman/system/service.go
@@ -1,3 +1,4 @@
+//go:build linux && !remote
// +build linux,!remote
package system
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 560cce847..d6b42ed29 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -1,3 +1,4 @@
+//go:build linux && !remote
// +build linux,!remote
package system
diff --git a/cmd/podman/utils/signals_linux.go b/cmd/podman/utils/signals_linux.go
index f0a14aff0..dd0507c0e 100644
--- a/cmd/podman/utils/signals_linux.go
+++ b/cmd/podman/utils/signals_linux.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package utils
diff --git a/cmd/podman/utils/signals_windows.go b/cmd/podman/utils/signals_windows.go
index 30b058cb9..e6fcc1b32 100644
--- a/cmd/podman/utils/signals_windows.go
+++ b/cmd/podman/utils/signals_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package utils
diff --git a/contrib/cirrus/logformatter b/contrib/cirrus/logformatter
index 43173eaa6..5b8e2f2a1 100755
--- a/contrib/cirrus/logformatter
+++ b/contrib/cirrus/logformatter
@@ -307,10 +307,18 @@ END_HTML
elsif ($line =~ /^#\s#\|\s/) { $css = 'log-esm' }
elsif ($line =~ /^#\s/) { $css = 'log' }
+ # Link to source file. This is ugly: we have to hardcode 'podman'
+ # and 'test/system' because there's no way to get them from log.
+ #
+ # 1 2 2 13 4 43 5
+ $line =~ s{(in(\stest)?\s+file\s+\S+/)(\S+\.(bats|bash)),\s+line\s+(\d+)}{$1<a class="codelink" href="https://github.com/containers/podman/blob/$git_commit/test/system/$3#L$5">$3, line $5</a>};
+
if ($css) {
# Make it linkable, e.g. foo.html#t--00001
- if ($line =~ /^(not\s+)?ok\s+(\d+)/) {
+ if ($line =~ /^(not\s+)?ok\s+(\d+)\s+(.*)/) {
$line = sprintf("<a name='t--%05d'>%s</a>", $2, $line);
+
+ push @{$bats_count{__fail_list}}, [ $2, $3 ] if $1;
}
$line = "<span class='bats-$css'>$line</span>";
@@ -515,6 +523,15 @@ END_HTML
}
}
+ # Grumble. Github only shows the last N lines of the log... which is
+ # anti-helpful when you want a quick synopsis of what failed. Write a
+ # summary at the tail, to make it easier for humans to see what went wrong.
+ if (my $fails = $bats_count{__fail_list}) {
+ print "\n";
+ printf "Failed tests (%d):\n", scalar(@$fails);
+ printf " - %d %s\n", @$_ for @$fails;
+ }
+
# If Cirrus magic envariables are available, write a link to results.
# FIXME: it'd be so nice to make this a clickable live link.
#
diff --git a/contrib/cirrus/logformatter.t b/contrib/cirrus/logformatter.t
index df8154cb9..7f5973a15 100755
--- a/contrib/cirrus/logformatter.t
+++ b/contrib/cirrus/logformatter.t
@@ -91,6 +91,9 @@ __END__
ok 1 hi
ok 2 bye # skip no reason
not ok 3 fail
+# (from function `assert' in file ./helpers.bash, line 343,
+# from function `expect_output' in file ./helpers.bash, line 370,
+# in test file ./run.bats, line 786)
# $ /path/to/podman foo -bar
# #| FAIL: exit code is 123; expected 321
ok 4 blah
@@ -99,6 +102,9 @@ ok 4 blah
<span class='bats-passed'><a name='t--00001'>ok 1 hi</a></span>
<span class='bats-skipped'><a name='t--00002'>ok 2 bye # skip no reason</a></span>
<span class='bats-failed'><a name='t--00003'>not ok 3 fail</a></span>
+<span class='bats-log'># (from function `assert&#39; in file ./<a class="codelink" href="https://github.com/containers/podman/blob/ceci-nest-pas-une-sha/test/system/helpers.bash#L343">helpers.bash, line 343</a>,</span>
+<span class='bats-log'># from function `expect_output&#39; in file ./<a class="codelink" href="https://github.com/containers/podman/blob/ceci-nest-pas-une-sha/test/system/helpers.bash#L370">helpers.bash, line 370</a>,</span>
+<span class='bats-log'># in test file ./<a class="codelink" href="https://github.com/containers/podman/blob/ceci-nest-pas-une-sha/test/system/run.bats#L786">run.bats, line 786</a>)</span>
<span class='bats-log'># $ <b><span title="/path/to/podman">podman</span> foo -bar</b></span>
<span class='bats-log-esm'># #| FAIL: exit code is 123; expected 321</span>
<span class='bats-passed'><a name='t--00004'>ok 4 blah</a></span>
diff --git a/dependencies/dependencies.go b/dependencies/dependencies.go
index b1b0aee08..adc074d93 100644
--- a/dependencies/dependencies.go
+++ b/dependencies/dependencies.go
@@ -1,3 +1,4 @@
+//go:build !linter
// +build !linter
package dependencies
diff --git a/libpod/boltdb_state_linux.go b/libpod/boltdb_state_linux.go
index 63ce9784e..8bb10fb63 100644
--- a/libpod/boltdb_state_linux.go
+++ b/libpod/boltdb_state_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/container_copy_linux.go b/libpod/container_copy_linux.go
index d16d635b7..38927d691 100644
--- a/libpod/container_copy_linux.go
+++ b/libpod/container_copy_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/container_linux.go b/libpod/container_linux.go
index c445fb8af..8b517e69f 100644
--- a/libpod/container_linux.go
+++ b/libpod/container_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/container_log_unsupported.go b/libpod/container_log_unsupported.go
index f9ca26966..4f50f9f4c 100644
--- a/libpod/container_log_unsupported.go
+++ b/libpod/container_log_unsupported.go
@@ -1,4 +1,5 @@
-//+build !linux !systemd
+//go:build !linux || !systemd
+// +build !linux !systemd
package libpod
diff --git a/libpod/container_stat_linux.go b/libpod/container_stat_linux.go
index d90684197..84ab984e0 100644
--- a/libpod/container_stat_linux.go
+++ b/libpod/container_stat_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/container_top_linux.go b/libpod/container_top_linux.go
index 41300a708..9b3dbc873 100644
--- a/libpod/container_top_linux.go
+++ b/libpod/container_top_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/events/events_unsupported.go b/libpod/events/events_unsupported.go
index 5b32a1b4b..25c175524 100644
--- a/libpod/events/events_unsupported.go
+++ b/libpod/events/events_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package events
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index cc63df120..866042a4c 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -1,3 +1,4 @@
+//go:build systemd
// +build systemd
package events
diff --git a/libpod/events/journal_unsupported.go b/libpod/events/journal_unsupported.go
index 004efdab2..6ed39792b 100644
--- a/libpod/events/journal_unsupported.go
+++ b/libpod/events/journal_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !systemd
// +build !systemd
package events
diff --git a/libpod/linkmode/linkmode_dynamic.go b/libpod/linkmode/linkmode_dynamic.go
index 6d51d60e0..f020fa53e 100644
--- a/libpod/linkmode/linkmode_dynamic.go
+++ b/libpod/linkmode/linkmode_dynamic.go
@@ -1,3 +1,4 @@
+//go:build !static
// +build !static
package linkmode
diff --git a/libpod/linkmode/linkmode_static.go b/libpod/linkmode/linkmode_static.go
index 2db083f4a..b181ad285 100644
--- a/libpod/linkmode/linkmode_static.go
+++ b/libpod/linkmode/linkmode_static.go
@@ -1,3 +1,4 @@
+//go:build static
// +build static
package linkmode
diff --git a/libpod/lock/shm/shm_lock.go b/libpod/lock/shm/shm_lock.go
index fea02a619..c7f4d1bc5 100644
--- a/libpod/lock/shm/shm_lock.go
+++ b/libpod/lock/shm/shm_lock.go
@@ -1,3 +1,4 @@
+//go:build linux && cgo
// +build linux,cgo
package shm
diff --git a/libpod/lock/shm/shm_lock_nocgo.go b/libpod/lock/shm/shm_lock_nocgo.go
index 627344d9c..31fc02223 100644
--- a/libpod/lock/shm/shm_lock_nocgo.go
+++ b/libpod/lock/shm/shm_lock_nocgo.go
@@ -1,3 +1,4 @@
+//go:build linux && !cgo
// +build linux,!cgo
package shm
diff --git a/libpod/lock/shm/shm_lock_test.go b/libpod/lock/shm/shm_lock_test.go
index cb83c7c2c..8dfc849d6 100644
--- a/libpod/lock/shm/shm_lock_test.go
+++ b/libpod/lock/shm/shm_lock_test.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package shm
diff --git a/libpod/lock/shm_lock_manager_linux.go b/libpod/lock/shm_lock_manager_linux.go
index 8f3b6df7f..3076cd864 100644
--- a/libpod/lock/shm_lock_manager_linux.go
+++ b/libpod/lock/shm_lock_manager_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package lock
diff --git a/libpod/lock/shm_lock_manager_unsupported.go b/libpod/lock/shm_lock_manager_unsupported.go
index 1d6e3fcbd..d578359ab 100644
--- a/libpod/lock/shm_lock_manager_unsupported.go
+++ b/libpod/lock/shm_lock_manager_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package lock
diff --git a/libpod/mounts_linux.go b/libpod/mounts_linux.go
index e6aa09eac..f6945b3a3 100644
--- a/libpod/mounts_linux.go
+++ b/libpod/mounts_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 7fd80927b..d2d1e12cb 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/networking_slirp4netns.go b/libpod/networking_slirp4netns.go
index cc44f78f7..a7a002657 100644
--- a/libpod/networking_slirp4netns.go
+++ b/libpod/networking_slirp4netns.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/oci_attach_linux.go b/libpod/oci_attach_linux.go
index 1ee664e81..b5eabec1f 100644
--- a/libpod/oci_attach_linux.go
+++ b/libpod/oci_attach_linux.go
@@ -1,4 +1,5 @@
-//+build linux
+//go:build linux
+// +build linux
package libpod
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index a328f7621..735b1f09b 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
@@ -1199,7 +1200,7 @@ func (r *ConmonOCIRuntime) createOCIContainer(ctr *Container, restoreOptions *Co
cmd.ExtraFiles = append(cmd.ExtraFiles, childSyncPipe, childStartPipe)
if r.reservePorts && !rootless.IsRootless() && !ctr.config.NetMode.IsSlirp4netns() {
- ports, err := bindPorts(ctr.config.PortMappings)
+ ports, err := bindPorts(ctr.convertPortMappings())
if err != nil {
return 0, err
}
diff --git a/libpod/pod_top_linux.go b/libpod/pod_top_linux.go
index 43823a106..83a070807 100644
--- a/libpod/pod_top_linux.go
+++ b/libpod/pod_top_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/runtime.go b/libpod/runtime.go
index d19997709..07653217a 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -210,6 +210,10 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
}
if err := shutdown.Register("libpod", func(sig os.Signal) error {
+ // For `systemctl stop podman.service` support, exit code should be 0
+ if sig == syscall.SIGTERM {
+ os.Exit(0)
+ }
os.Exit(1)
return nil
}); err != nil && errors.Cause(err) != shutdown.ErrHandlerExists {
diff --git a/libpod/runtime_migrate.go b/libpod/runtime_migrate.go
index 32fdc7b5d..fccd5bdee 100644
--- a/libpod/runtime_migrate.go
+++ b/libpod/runtime_migrate.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go
index c4fe3db90..3d585fa7a 100644
--- a/libpod/runtime_volume_linux.go
+++ b/libpod/runtime_volume_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/stats.go b/libpod/stats.go
index dbb10a27e..b5d39240d 100644
--- a/libpod/stats.go
+++ b/libpod/stats.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/libpod/util_linux.go b/libpod/util_linux.go
index dd115c7fb..fe98056dc 100644
--- a/libpod/util_linux.go
+++ b/libpod/util_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package libpod
diff --git a/pkg/api/handlers/libpod/generate.go b/pkg/api/handlers/libpod/generate.go
index 7e08dd4a8..28785b00d 100644
--- a/pkg/api/handlers/libpod/generate.go
+++ b/pkg/api/handlers/libpod/generate.go
@@ -25,18 +25,15 @@ func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
RestartSec uint `schema:"restartSec"`
StopTimeout uint `schema:"stopTimeout"`
StartTimeout uint `schema:"startTimeout"`
- ContainerPrefix string `schema:"containerPrefix"`
- PodPrefix string `schema:"podPrefix"`
- Separator string `schema:"separator"`
+ ContainerPrefix *string `schema:"containerPrefix"`
+ PodPrefix *string `schema:"podPrefix"`
+ Separator *string `schema:"separator"`
Wants []string `schema:"wants"`
After []string `schema:"after"`
Requires []string `schema:"requires"`
}{
- StartTimeout: 0,
- StopTimeout: util.DefaultContainerConfig().Engine.StopTimeout,
- ContainerPrefix: "container",
- PodPrefix: "pod",
- Separator: "-",
+ StartTimeout: 0,
+ StopTimeout: util.DefaultContainerConfig().Engine.StopTimeout,
}
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
@@ -44,6 +41,21 @@ func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
return
}
+ var ContainerPrefix = "container"
+ if query.ContainerPrefix != nil {
+ ContainerPrefix = *query.ContainerPrefix
+ }
+
+ var PodPrefix = "pod"
+ if query.PodPrefix != nil {
+ PodPrefix = *query.PodPrefix
+ }
+
+ var Separator = "-"
+ if query.Separator != nil {
+ Separator = *query.Separator
+ }
+
containerEngine := abi.ContainerEngine{Libpod: runtime}
options := entities.GenerateSystemdOptions{
Name: query.Name,
@@ -53,9 +65,9 @@ func GenerateSystemd(w http.ResponseWriter, r *http.Request) {
RestartPolicy: query.RestartPolicy,
StartTimeout: &query.StartTimeout,
StopTimeout: &query.StopTimeout,
- ContainerPrefix: query.ContainerPrefix,
- PodPrefix: query.PodPrefix,
- Separator: query.Separator,
+ ContainerPrefix: ContainerPrefix,
+ PodPrefix: PodPrefix,
+ Separator: Separator,
RestartSec: &query.RestartSec,
Wants: query.Wants,
After: query.After,
diff --git a/pkg/bindings/generator/generator.go b/pkg/bindings/generator/generator.go
index a224013ea..e69973be1 100644
--- a/pkg/bindings/generator/generator.go
+++ b/pkg/bindings/generator/generator.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
package main
diff --git a/pkg/bindings/images/build_unix.go b/pkg/bindings/images/build_unix.go
index 0afb1deb6..67a5e2998 100644
--- a/pkg/bindings/images/build_unix.go
+++ b/pkg/bindings/images/build_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package images
diff --git a/pkg/criu/criu.go b/pkg/criu/criu.go
index 967da0dca..b54870abc 100644
--- a/pkg/criu/criu.go
+++ b/pkg/criu/criu.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package criu
diff --git a/pkg/criu/criu_unsupported.go b/pkg/criu/criu_unsupported.go
index 51cd0c1fd..3e3ed9c6c 100644
--- a/pkg/criu/criu_unsupported.go
+++ b/pkg/criu/criu_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package criu
diff --git a/pkg/ctime/ctime_linux.go b/pkg/ctime/ctime_linux.go
index 113693e87..7eb3caa6d 100644
--- a/pkg/ctime/ctime_linux.go
+++ b/pkg/ctime/ctime_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package ctime
diff --git a/pkg/ctime/ctime_unsupported.go b/pkg/ctime/ctime_unsupported.go
index 325731353..afee56027 100644
--- a/pkg/ctime/ctime_unsupported.go
+++ b/pkg/ctime/ctime_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package ctime
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index e16da4ed9..4d8c5a381 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -462,6 +462,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
if err != nil {
return nil, err
}
+ specGen.RawImageName = container.Image
rtSpec, spec, opts, err := generate.MakeContainer(ctx, ic.Libpod, specGen, false, nil)
if err != nil {
return nil, err
diff --git a/pkg/domain/infra/runtime_abi.go b/pkg/domain/infra/runtime_abi.go
index 5b7b7cf8a..39989c96b 100644
--- a/pkg/domain/infra/runtime_abi.go
+++ b/pkg/domain/infra/runtime_abi.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package infra
diff --git a/pkg/domain/infra/runtime_abi_unsupported.go b/pkg/domain/infra/runtime_abi_unsupported.go
index b4414dc54..9e5bd01eb 100644
--- a/pkg/domain/infra/runtime_abi_unsupported.go
+++ b/pkg/domain/infra/runtime_abi_unsupported.go
@@ -1,3 +1,4 @@
+//go:build remote
// +build remote
package infra
diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go
index f9ceb9305..dffd90dbe 100644
--- a/pkg/domain/infra/runtime_libpod.go
+++ b/pkg/domain/infra/runtime_libpod.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package infra
diff --git a/pkg/domain/infra/runtime_proxy.go b/pkg/domain/infra/runtime_proxy.go
index a70b61165..e5761d4ab 100644
--- a/pkg/domain/infra/runtime_proxy.go
+++ b/pkg/domain/infra/runtime_proxy.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package infra
diff --git a/pkg/domain/infra/runtime_tunnel.go b/pkg/domain/infra/runtime_tunnel.go
index 68f8b0dac..8a4de032f 100644
--- a/pkg/domain/infra/runtime_tunnel.go
+++ b/pkg/domain/infra/runtime_tunnel.go
@@ -1,3 +1,4 @@
+//go:build remote
// +build remote
package infra
diff --git a/pkg/env/env_unix.go b/pkg/env/env_unix.go
index 16061a700..690078f33 100644
--- a/pkg/env/env_unix.go
+++ b/pkg/env/env_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package env
diff --git a/pkg/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go b/pkg/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go
index 2501d5516..a502b5adb 100644
--- a/pkg/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go
+++ b/pkg/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go
@@ -1,3 +1,4 @@
+//go:build !notest
// +build !notest
/*
diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go
index 4d3e2edf4..6215ae08f 100644
--- a/pkg/machine/fcos.go
+++ b/pkg/machine/fcos.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/pkg/machine/fedora.go b/pkg/machine/fedora.go
index cd713dde7..b26921b52 100644
--- a/pkg/machine/fedora.go
+++ b/pkg/machine/fedora.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/pkg/machine/ignition_darwin.go b/pkg/machine/ignition_darwin.go
index 9ede4b026..b9fbf218d 100644
--- a/pkg/machine/ignition_darwin.go
+++ b/pkg/machine/ignition_darwin.go
@@ -1,4 +1,5 @@
-//+build darwin
+//go:build darwin
+// +build darwin
package machine
diff --git a/pkg/machine/ignition_schema.go b/pkg/machine/ignition_schema.go
index 8cfb0d04e..d6b86229c 100644
--- a/pkg/machine/ignition_schema.go
+++ b/pkg/machine/ignition_schema.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/pkg/machine/ignition_windows.go b/pkg/machine/ignition_windows.go
index c0de48bd3..0fcc06273 100644
--- a/pkg/machine/ignition_windows.go
+++ b/pkg/machine/ignition_windows.go
@@ -1,4 +1,5 @@
-//+build windows
+//go:build windows
+// +build windows
package machine
diff --git a/pkg/machine/keys.go b/pkg/machine/keys.go
index 711b091f0..15c1f73d8 100644
--- a/pkg/machine/keys.go
+++ b/pkg/machine/keys.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/pkg/machine/machine_unsupported.go b/pkg/machine/machine_unsupported.go
index da1437984..a12140e16 100644
--- a/pkg/machine/machine_unsupported.go
+++ b/pkg/machine/machine_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !amd64 && !arm64
// +build !amd64,!arm64
package machine
diff --git a/pkg/machine/pull.go b/pkg/machine/pull.go
index cf1e708b1..26abedfcd 100644
--- a/pkg/machine/pull.go
+++ b/pkg/machine/pull.go
@@ -1,3 +1,4 @@
+//go:build amd64 || arm64
// +build amd64 arm64
package machine
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 3b4548c17..d30e51215 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -134,7 +134,7 @@ func (p *Provider) NewMachine(opts machine.InitOptions) (machine.VM, error) {
// LoadByName reads a json file that describes a known qemu vm
// and returns a vm instance
func (p *Provider) LoadVMByName(name string) (machine.VM, error) {
- vm := new(MachineVM)
+ vm := &MachineVM{UID: -1} // posix reserves -1, so use it to signify undefined
vmConfigDir, err := machine.GetConfDir(vmtype)
if err != nil {
return nil, err
@@ -373,6 +373,10 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
wait time.Duration = time.Millisecond * 500
)
+ if v.isIncompatible() {
+ logrus.Errorf("machine %q is incompatible with this release of podman and needs to be recreated, starting for recovery only", v.Name)
+ }
+
forwardSock, forwardState, err := v.startHostNetworking()
if err != nil {
return errors.Errorf("unable to start host networking: %q", err)
@@ -506,7 +510,7 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
}
}
- waitAPIAndPrintInfo(forwardState, forwardSock, v.Rootful, v.Name)
+ v.waitAPIAndPrintInfo(forwardState, forwardSock)
return nil
}
@@ -975,7 +979,11 @@ func (v *MachineVM) startHostNetworking() (string, apiForwardingState, error) {
// Add the ssh port
cmd = append(cmd, []string{"-ssh-port", fmt.Sprintf("%d", v.Port)}...)
- cmd, forwardSock, state := v.setupAPIForwarding(cmd)
+ var forwardSock string
+ var state apiForwardingState
+ if !v.isIncompatible() {
+ cmd, forwardSock, state = v.setupAPIForwarding(cmd)
+ }
if logrus.GetLevel() == logrus.DebugLevel {
cmd = append(cmd, "--debug")
@@ -1043,6 +1051,10 @@ func (v *MachineVM) setupAPIForwarding(cmd []string) ([]string, string, apiForwa
return cmd, dockerSock, dockerGlobal
}
+func (v *MachineVM) isIncompatible() bool {
+ return v.UID == -1
+}
+
func (v *MachineVM) getForwardSocketPath() (string, error) {
path, err := machine.GetDataDir(v.Name)
if err != nil {
@@ -1102,46 +1114,66 @@ func waitAndPingAPI(sock string) {
}
}
-func waitAPIAndPrintInfo(forwardState apiForwardingState, forwardSock string, rootFul bool, name string) {
- if forwardState != noForwarding {
- suffix := ""
- if name != machine.DefaultMachineName {
- suffix = " " + name
- }
- waitAndPingAPI(forwardSock)
- if !rootFul {
- fmt.Printf("\nThis machine is currently configured in rootless mode. If your containers\n")
- fmt.Printf("require root permissions (e.g. ports < 1024), or if you run into compatibility\n")
- fmt.Printf("issues with non-podman clients, you can switch using the following command: \n")
- fmt.Printf("\n\tpodman machine set --rootful%s\n\n", suffix)
- }
+func (v *MachineVM) waitAPIAndPrintInfo(forwardState apiForwardingState, forwardSock string) {
+ suffix := ""
+ if v.Name != machine.DefaultMachineName {
+ suffix = " " + v.Name
+ }
- fmt.Printf("API forwarding listening on: %s\n", forwardSock)
- if forwardState == dockerGlobal {
- fmt.Printf("Docker API clients default to this address. You do not need to set DOCKER_HOST.\n\n")
- } else {
- stillString := "still "
- switch forwardState {
- case notInstalled:
- fmt.Printf("\nThe system helper service is not installed; the default Docker API socket\n")
- fmt.Printf("address can't be used by podman. ")
- if helper := findClaimHelper(); len(helper) > 0 {
- fmt.Printf("If you would like to install it run the\nfollowing commands:\n")
- fmt.Printf("\n\tsudo %s install\n", helper)
- fmt.Printf("\tpodman machine stop%s; podman machine start%s\n\n", suffix, suffix)
- }
- case machineLocal:
- fmt.Printf("\nAnother process was listening on the default Docker API socket address.\n")
- case claimUnsupported:
- fallthrough
- default:
- stillString = ""
- }
+ if v.isIncompatible() {
+ fmt.Fprintf(os.Stderr, "\n!!! ACTION REQUIRED: INCOMPATIBLE MACHINE !!!\n")
- fmt.Printf("You can %sconnect Docker API clients by setting DOCKER_HOST using the\n", stillString)
- fmt.Printf("following command in your terminal session:\n")
- fmt.Printf("\n\texport DOCKER_HOST='unix://%s'\n\n", forwardSock)
+ fmt.Fprintf(os.Stderr, "\nThis machine was created by an older podman release that is incompatible\n")
+ fmt.Fprintf(os.Stderr, "with this release of podman. It has been started in a limited operational\n")
+ fmt.Fprintf(os.Stderr, "mode to allow you to copy any necessary files before recreating it. This\n")
+ fmt.Fprintf(os.Stderr, "can be accomplished with the following commands:\n\n")
+ fmt.Fprintf(os.Stderr, "\t# Login and copy desired files (Optional)\n")
+ fmt.Fprintf(os.Stderr, "\t# podman machine ssh%s tar cvPf - /path/to/files > backup.tar\n\n", suffix)
+ fmt.Fprintf(os.Stderr, "\t# Recreate machine (DESTRUCTIVE!) \n")
+ fmt.Fprintf(os.Stderr, "\tpodman machine stop%s\n", suffix)
+ fmt.Fprintf(os.Stderr, "\tpodman machine rm -f%s\n", suffix)
+ fmt.Fprintf(os.Stderr, "\tpodman machine init --now%s\n\n", suffix)
+ fmt.Fprintf(os.Stderr, "\t# Copy back files (Optional)\n")
+ fmt.Fprintf(os.Stderr, "\t# cat backup.tar | podman machine ssh%s tar xvPf - \n\n", suffix)
+ }
+
+ if forwardState == noForwarding {
+ return
+ }
+
+ waitAndPingAPI(forwardSock)
+ if !v.Rootful {
+ fmt.Printf("\nThis machine is currently configured in rootless mode. If your containers\n")
+ fmt.Printf("require root permissions (e.g. ports < 1024), or if you run into compatibility\n")
+ fmt.Printf("issues with non-podman clients, you can switch using the following command: \n")
+ fmt.Printf("\n\tpodman machine set --rootful%s\n\n", suffix)
+ }
+
+ fmt.Printf("API forwarding listening on: %s\n", forwardSock)
+ if forwardState == dockerGlobal {
+ fmt.Printf("Docker API clients default to this address. You do not need to set DOCKER_HOST.\n\n")
+ } else {
+ stillString := "still "
+ switch forwardState {
+ case notInstalled:
+ fmt.Printf("\nThe system helper service is not installed; the default Docker API socket\n")
+ fmt.Printf("address can't be used by podman. ")
+ if helper := findClaimHelper(); len(helper) > 0 {
+ fmt.Printf("If you would like to install it run the\nfollowing commands:\n")
+ fmt.Printf("\n\tsudo %s install\n", helper)
+ fmt.Printf("\tpodman machine stop%s; podman machine start%s\n\n", suffix, suffix)
+ }
+ case machineLocal:
+ fmt.Printf("\nAnother process was listening on the default Docker API socket address.\n")
+ case claimUnsupported:
+ fallthrough
+ default:
+ stillString = ""
}
+
+ fmt.Printf("You can %sconnect Docker API clients by setting DOCKER_HOST using the\n", stillString)
+ fmt.Printf("following command in your terminal session:\n")
+ fmt.Printf("\n\texport DOCKER_HOST='unix://%s'\n\n", forwardSock)
}
}
diff --git a/pkg/machine/qemu/machine_unsupported.go b/pkg/machine/qemu/machine_unsupported.go
index e3ce05e3d..794e710f9 100644
--- a/pkg/machine/qemu/machine_unsupported.go
+++ b/pkg/machine/qemu/machine_unsupported.go
@@ -1,3 +1,4 @@
+//go:build (!amd64 && !arm64) || windows
// +build !amd64,!arm64 windows
package qemu
diff --git a/pkg/machine/wsl/machine_unsupported.go b/pkg/machine/wsl/machine_unsupported.go
index 043c5d729..856f9dd0c 100644
--- a/pkg/machine/wsl/machine_unsupported.go
+++ b/pkg/machine/wsl/machine_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package wsl
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index a0b6edcfb..786e28093 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -1,3 +1,4 @@
+//go:build linux && cgo
// +build linux,cgo
package rootless
diff --git a/pkg/rootless/rootless_unsupported.go b/pkg/rootless/rootless_unsupported.go
index 7dfb4a4b2..fe164e235 100644
--- a/pkg/rootless/rootless_unsupported.go
+++ b/pkg/rootless/rootless_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux || !cgo
// +build !linux !cgo
package rootless
diff --git a/pkg/rootlessport/rootlessport_linux.go b/pkg/rootlessport/rootlessport_linux.go
index b89a92d1e..6918a7e8c 100644
--- a/pkg/rootlessport/rootlessport_linux.go
+++ b/pkg/rootlessport/rootlessport_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Package rootlessport provides reexec for RootlessKit-based port forwarder.
diff --git a/pkg/servicereaper/service.go b/pkg/servicereaper/service.go
index e105148f0..61445bc19 100644
--- a/pkg/servicereaper/service.go
+++ b/pkg/servicereaper/service.go
@@ -1,4 +1,5 @@
-//+build linux
+//go:build linux
+// +build linux
package servicereaper
diff --git a/pkg/signal/signal_linux.go b/pkg/signal/signal_linux.go
index 305b9d21f..21e09c9fe 100644
--- a/pkg/signal/signal_linux.go
+++ b/pkg/signal/signal_linux.go
@@ -1,5 +1,5 @@
-// +build linux
-// +build !mips,!mipsle,!mips64,!mips64le
+//go:build linux && !mips && !mipsle && !mips64 && !mips64le
+// +build linux,!mips,!mipsle,!mips64,!mips64le
// Signal handling for Linux only.
package signal
diff --git a/pkg/signal/signal_linux_mipsx.go b/pkg/signal/signal_linux_mipsx.go
index 45c9d5af1..52b07aaf4 100644
--- a/pkg/signal/signal_linux_mipsx.go
+++ b/pkg/signal/signal_linux_mipsx.go
@@ -1,3 +1,4 @@
+//go:build linux && (mips || mipsle || mips64 || mips64le)
// +build linux
// +build mips mipsle mips64 mips64le
diff --git a/pkg/signal/signal_unix.go b/pkg/signal/signal_unix.go
index f35abddc1..c0aa62d21 100644
--- a/pkg/signal/signal_unix.go
+++ b/pkg/signal/signal_unix.go
@@ -1,3 +1,4 @@
+//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd netbsd openbsd solaris zos
// Signal handling for Linux only.
diff --git a/pkg/signal/signal_unsupported.go b/pkg/signal/signal_unsupported.go
index 45946f142..d8bba7c90 100644
--- a/pkg/signal/signal_unsupported.go
+++ b/pkg/signal/signal_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos
// Signal handling for Linux only.
diff --git a/pkg/specgen/config_unsupported.go b/pkg/specgen/config_unsupported.go
index 70a60ac47..a6bf77277 100644
--- a/pkg/specgen/config_unsupported.go
+++ b/pkg/specgen/config_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package specgen
diff --git a/pkg/specgen/generate/config_linux_cgo.go b/pkg/specgen/generate/config_linux_cgo.go
index 239655c72..efab6679a 100644
--- a/pkg/specgen/generate/config_linux_cgo.go
+++ b/pkg/specgen/generate/config_linux_cgo.go
@@ -1,3 +1,4 @@
+//go:build linux && cgo
// +build linux,cgo
package generate
diff --git a/pkg/specgen/generate/config_linux_nocgo.go b/pkg/specgen/generate/config_linux_nocgo.go
index 9ead739a7..99b0c4eb2 100644
--- a/pkg/specgen/generate/config_linux_nocgo.go
+++ b/pkg/specgen/generate/config_linux_nocgo.go
@@ -1,3 +1,4 @@
+//go:build linux && !cgo
// +build linux,!cgo
package generate
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index 8450fe7ce..ba823f3a8 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -56,6 +56,7 @@ ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath)
CommonBuildOpts: &buildahDefine.CommonBuildOptions{},
Output: imageName,
Quiet: true,
+ IgnoreFile: "/dev/null", // makes sure to not read a local .ignorefile (see #13529)
IIDFile: "/dev/null", // prevents Buildah from writing the ID on stdout
}
if _, _, err := rt.Build(context.Background(), buildOptions, tmpF.Name()); err != nil {
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go
index a6f8f7cd4..e53d37897 100644
--- a/pkg/systemd/generate/common.go
+++ b/pkg/systemd/generate/common.go
@@ -137,3 +137,17 @@ func removeArg(arg string, args []string) []string {
}
return newArgs
}
+
+// This function is used to get name of systemd service from prefix, separator, and
+// container/pod name. If prefix is empty, the service name does not include the
+// separator. This is to avoid a situation where service name starts with the separator
+// which is usually hyphen.
+func getServiceName(prefix string, separator string, name string) string {
+ serviceName := name
+
+ if len(prefix) > 0 {
+ serviceName = prefix + separator + name
+ }
+
+ return serviceName
+}
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index ea829c810..c01bb1baf 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -236,7 +236,9 @@ func containerServiceName(ctr *libpod.Container, options entities.GenerateSystem
if options.Name {
nameOrID = ctr.Name()
}
- serviceName := fmt.Sprintf("%s%s%s", options.ContainerPrefix, options.Separator, nameOrID)
+
+ serviceName := getServiceName(options.ContainerPrefix, options.Separator, nameOrID)
+
return nameOrID, serviceName
}
diff --git a/pkg/systemd/generate/containers_test.go b/pkg/systemd/generate/containers_test.go
index 2f653a4b9..b9bf7c317 100644
--- a/pkg/systemd/generate/containers_test.go
+++ b/pkg/systemd/generate/containers_test.go
@@ -91,6 +91,30 @@ Type=forking
WantedBy=default.target
`
+ goodNameEmptyContainerPrefix := `# foobar.service
+# autogenerated by Podman CI
+
+[Unit]
+Description=Podman foobar.service
+Documentation=man:podman-generate-systemd(1)
+Wants=network-online.target
+After=network-online.target
+RequiresMountsFor=/var/run/containers/storage
+
+[Service]
+Environment=PODMAN_SYSTEMD_UNIT=%n
+Restart=on-failure
+TimeoutStopSec=70
+ExecStart=/usr/bin/podman start foobar
+ExecStop=/usr/bin/podman stop -t 10 foobar
+ExecStopPost=/usr/bin/podman stop -t 10 foobar
+PIDFile=/run/containers/storage/overlay-containers/639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401/userdata/conmon.pid
+Type=forking
+
+[Install]
+WantedBy=default.target
+`
+
goodNameCustomWants := `# container-foobar.service
# autogenerated by Podman CI
@@ -1206,6 +1230,24 @@ WantedBy=default.target
false,
true,
},
+ {"good with name and empty container-prefix",
+ containerInfo{
+ Executable: "/usr/bin/podman",
+ ServiceName: "foobar",
+ ContainerNameOrID: "foobar",
+ PIDFile: "/run/containers/storage/overlay-containers/639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401/userdata/conmon.pid",
+ StopTimeout: 10,
+ PodmanVersion: "CI",
+ EnvVariable: define.EnvVariable,
+ GraphRoot: "/var/lib/containers/storage",
+ RunRoot: "/var/run/containers/storage",
+ },
+ goodNameEmptyContainerPrefix,
+ false,
+ false,
+ false,
+ false,
+ },
}
for _, tt := range tests {
test := tt
diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go
index 003c23e77..78ae6391b 100644
--- a/pkg/systemd/generate/pods.go
+++ b/pkg/systemd/generate/pods.go
@@ -242,7 +242,8 @@ func generatePodInfo(pod *libpod.Pod, options entities.GenerateSystemdOptions) (
nameOrID = pod.Name()
ctrNameOrID = infraCtr.Name()
}
- serviceName := fmt.Sprintf("%s%s%s", options.PodPrefix, options.Separator, nameOrID)
+
+ serviceName := getServiceName(options.PodPrefix, options.Separator, nameOrID)
info := podInfo{
ServiceName: serviceName,
diff --git a/pkg/systemd/generate/pods_test.go b/pkg/systemd/generate/pods_test.go
index b37e0825b..dcb18780c 100644
--- a/pkg/systemd/generate/pods_test.go
+++ b/pkg/systemd/generate/pods_test.go
@@ -67,6 +67,32 @@ WantedBy=default.target
podGood := serviceInfo + headerInfo + podContent
podGoodNoHeaderInfo := serviceInfo + podContent
+ podGoodWithEmptyPrefix := `# 123abc.service
+# autogenerated by Podman CI
+
+[Unit]
+Description=Podman 123abc.service
+Documentation=man:podman-generate-systemd(1)
+Wants=network-online.target
+After=network-online.target
+RequiresMountsFor=/var/run/containers/storage
+Requires=container-1.service container-2.service
+Before=container-1.service container-2.service
+
+[Service]
+Environment=PODMAN_SYSTEMD_UNIT=%n
+Restart=on-failure
+TimeoutStopSec=102
+ExecStart=/usr/bin/podman start jadda-jadda-infra
+ExecStop=/usr/bin/podman stop -t 42 jadda-jadda-infra
+ExecStopPost=/usr/bin/podman stop -t 42 jadda-jadda-infra
+PIDFile=/run/containers/storage/overlay-containers/639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401/userdata/conmon.pid
+Type=forking
+
+[Install]
+WantedBy=default.target
+`
+
podGoodCustomWants := `# pod-123abc.service
# autogenerated by Podman CI
@@ -580,6 +606,24 @@ WantedBy=default.target
false,
false,
},
+ {"pod with empty pod-prefix",
+ podInfo{
+ Executable: "/usr/bin/podman",
+ ServiceName: "123abc",
+ InfraNameOrID: "jadda-jadda-infra",
+ PIDFile: "/run/containers/storage/overlay-containers/639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401/userdata/conmon.pid",
+ StopTimeout: 42,
+ PodmanVersion: "CI",
+ GraphRoot: "/var/lib/containers/storage",
+ RunRoot: "/var/run/containers/storage",
+ RequiredServices: []string{"container-1", "container-2"},
+ CreateCommand: []string{"podman", "pod", "create", "--name", "foo", "bar=arg with space"},
+ },
+ podGoodWithEmptyPrefix,
+ false,
+ false,
+ false,
+ },
}
for _, tt := range tests {
diff --git a/pkg/terminal/console_unix.go b/pkg/terminal/console_unix.go
index 6eee6aa2f..e6c0442c9 100644
--- a/pkg/terminal/console_unix.go
+++ b/pkg/terminal/console_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package terminal
diff --git a/pkg/terminal/console_windows.go b/pkg/terminal/console_windows.go
index 9a636d681..1a7da3335 100644
--- a/pkg/terminal/console_windows.go
+++ b/pkg/terminal/console_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package terminal
diff --git a/pkg/util/mountOpts_other.go b/pkg/util/mountOpts_other.go
index 6a34942e5..64b4dd1d9 100644
--- a/pkg/util/mountOpts_other.go
+++ b/pkg/util/mountOpts_other.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
package util
diff --git a/pkg/util/utils_darwin.go b/pkg/util/utils_darwin.go
index 33a46a5d4..66ae85e9c 100644
--- a/pkg/util/utils_darwin.go
+++ b/pkg/util/utils_darwin.go
@@ -1,4 +1,5 @@
-//+build darwin
+//go:build darwin
+// +build darwin
package util
diff --git a/pkg/util/utils_supported.go b/pkg/util/utils_supported.go
index 848b35a45..50e4b1b7b 100644
--- a/pkg/util/utils_supported.go
+++ b/pkg/util/utils_supported.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package util
diff --git a/pkg/util/utils_unsupported.go b/pkg/util/utils_unsupported.go
index 62805d7c8..896346493 100644
--- a/pkg/util/utils_unsupported.go
+++ b/pkg/util/utils_unsupported.go
@@ -1,3 +1,4 @@
+//go:build darwin || windows
// +build darwin windows
package util
diff --git a/pkg/util/utils_windows.go b/pkg/util/utils_windows.go
index 46ca5e7f1..2732124f2 100644
--- a/pkg/util/utils_windows.go
+++ b/pkg/util/utils_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package util
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at
index 49f8fb3fc..94de2cf24 100644
--- a/test/apiv2/20-containers.at
+++ b/test/apiv2/20-containers.at
@@ -280,7 +280,7 @@ t DELETE containers/$cid_top 204
t POST containers/create \
Image=$ENV_WORKDIR_IMG \
WorkingDir=/dataDir \
- StopSignal=9 \
+ StopSignal=\"9\" \
201 \
.Id~[0-9a-f]\\{64\\}
cid=$(jq -r '.Id' <<<"$output")
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index ff328cfc8..c3545522e 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -194,8 +194,16 @@ function jsonify() {
local rhs
IFS='=' read lhs rhs <<<"$i"
- # If right-hand side already includes double quotes, do nothing
- if [[ ! $rhs =~ \" ]]; then
+ if [[ $rhs =~ \" || $rhs == true || $rhs == false || $rhs =~ ^-?[0-9]+$ ]]; then
+ # rhs has been pre-formatted for JSON or a non-string, do not change it
+ :
+ elif [[ $rhs == False ]]; then
+ # JSON boolean is lowercase only
+ rhs=false
+ elif [[ $rhs == True ]]; then
+ # JSON boolean is lowercase only
+ rhs=true
+ else
rhs="\"${rhs}\""
fi
settings_out+=("\"${lhs}\":${rhs}")
@@ -241,26 +249,30 @@ function t() {
# entrypoint path can include a descriptive comment; strip it off
path=${path%% *}
- # path may include JSONish params that curl will barf on; url-encode them
- path="${path//'['/%5B}"
- path="${path//']'/%5D}"
- path="${path//'{'/%7B}"
- path="${path//'}'/%7D}"
- path="${path//':'/%3A}"
+ local url=$path
+ if ! [[ $path =~ ^'http://' ]]; then
+ # path may include JSONish params that curl will barf on; url-encode them
+ path="${path//'['/%5B}"
+ path="${path//']'/%5D}"
+ path="${path//'{'/%7B}"
+ path="${path//'}'/%7D}"
+ path="${path//':'/%3A}"
+
+ # If given path begins with /, use it as-is; otherwise prepend /version/
+ url=http://$HOST:$PORT
+ case "$path" in
+ /*) url="$url$path" ;;
+ libpod/*) url="$url/v4.0.0/$path" ;;
+ *) url="$url/v1.41/$path" ;;
+ esac
+ fi
# curl -X HEAD but without --head seems to wait for output anyway
if [[ $method == "HEAD" ]]; then
curl_args="--head"
fi
- local expected_code=$1; shift
- # If given path begins with /, use it as-is; otherwise prepend /version/
- local url=http://$HOST:$PORT
- case "$path" in
- /*) url="$url$path" ;;
- libpod/*) url="$url/v4.0.0/$path" ;;
- *) url="$url/v1.41/$path" ;;
- esac
+ local expected_code=$1; shift
# Log every action we do
echo "-------------------------------------------------------------" >>$LOG
diff --git a/test/checkseccomp/checkseccomp.go b/test/checkseccomp/checkseccomp.go
index 9046e0955..6c188ec0d 100644
--- a/test/checkseccomp/checkseccomp.go
+++ b/test/checkseccomp/checkseccomp.go
@@ -1,3 +1,4 @@
+//go:build seccomp
// +build seccomp
package main
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index 55b9a8037..e4b854332 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -423,6 +423,20 @@ var _ = Describe("Podman generate systemd", func() {
})
+ It("podman generate systemd --container-prefix ''", func() {
+ n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n).Should(Exit(0))
+
+ session := podmanTest.Podman([]string{"generate", "systemd", "--name", "--container-prefix", "", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ // Grepping the output (in addition to unit tests)
+ Expect(session.OutputToString()).To(ContainSubstring("# foo.service"))
+
+ })
+
It("podman generate systemd --separator _", func() {
n := podmanTest.Podman([]string{"create", "--name", "foo", "alpine", "top"})
n.WaitWithDefaultTimeout()
@@ -485,6 +499,44 @@ var _ = Describe("Podman generate systemd", func() {
Expect(session.OutputToString()).To(ContainSubstring("BindsTo=p_foo.service"))
})
+ It("podman generate systemd pod --pod-prefix '' --container-prefix '' --separator _ change all prefixes/separator", func() {
+ n := podmanTest.Podman([]string{"pod", "create", "--name", "foo"})
+ n.WaitWithDefaultTimeout()
+ Expect(n).Should(Exit(0))
+
+ n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-1", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n).Should(Exit(0))
+
+ n = podmanTest.Podman([]string{"create", "--pod", "foo", "--name", "foo-2", "alpine", "top"})
+ n.WaitWithDefaultTimeout()
+ Expect(n).Should(Exit(0))
+
+ // test systemd generate with empty pod prefix
+ session1 := podmanTest.Podman([]string{"generate", "systemd", "--pod-prefix", "", "--name", "foo"})
+ session1.WaitWithDefaultTimeout()
+ Expect(session1).Should(Exit(0))
+
+ // Grepping the output (in addition to unit tests)
+ Expect(session1.OutputToString()).To(ContainSubstring("# foo.service"))
+ Expect(session1.OutputToString()).To(ContainSubstring("Requires=container-foo-1.service container-foo-2.service"))
+ Expect(session1.OutputToString()).To(ContainSubstring("# container-foo-1.service"))
+ Expect(session1.OutputToString()).To(ContainSubstring("BindsTo=foo.service"))
+
+ // test systemd generate with empty container and pod prefix
+ session2 := podmanTest.Podman([]string{"generate", "systemd", "--container-prefix", "", "--pod-prefix", "", "--separator", "_", "--name", "foo"})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2).Should(Exit(0))
+
+ // Grepping the output (in addition to unit tests)
+ Expect(session2.OutputToString()).To(ContainSubstring("# foo.service"))
+ Expect(session2.OutputToString()).To(ContainSubstring("Requires=foo-1.service foo-2.service"))
+ Expect(session2.OutputToString()).To(ContainSubstring("# foo-1.service"))
+ Expect(session2.OutputToString()).To(ContainSubstring("# foo-2.service"))
+ Expect(session2.OutputToString()).To(ContainSubstring("BindsTo=foo.service"))
+
+ })
+
It("podman generate systemd pod with containers --new", func() {
tmpDir, err := ioutil.TempDir("", "")
Expect(err).To(BeNil())
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index ccd7c771e..cf81a0348 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package integration
diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go
index 849ba7162..96785c569 100644
--- a/test/e2e/play_build_test.go
+++ b/test/e2e/play_build_test.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
// build for play kube is not supported on remote yet.
diff --git a/test/e2e/run_apparmor_test.go b/test/e2e/run_apparmor_test.go
index e6526217a..64a01deb7 100644
--- a/test/e2e/run_apparmor_test.go
+++ b/test/e2e/run_apparmor_test.go
@@ -1,3 +1,4 @@
+//go:build !remote
// +build !remote
package integration
diff --git a/test/e2e/systemd_activate_test.go b/test/e2e/systemd_activate_test.go
new file mode 100644
index 000000000..d5434868d
--- /dev/null
+++ b/test/e2e/systemd_activate_test.go
@@ -0,0 +1,107 @@
+package integration
+
+import (
+ "errors"
+ "fmt"
+ "io/fs"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "syscall"
+ "time"
+
+ testUtils "github.com/containers/podman/v4/test/utils"
+ podmanUtils "github.com/containers/podman/v4/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+ . "github.com/onsi/gomega/gexec"
+)
+
+var _ = Describe("Systemd activate", func() {
+ var tempDir string
+ var err error
+ var podmanTest *PodmanTestIntegration
+
+ BeforeEach(func() {
+ tempDir, err = testUtils.CreateTempDirInTempDir()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "%v\n", err)
+ os.Exit(1)
+ }
+
+ podmanTest = PodmanTestCreate(tempDir)
+ podmanTest.Setup()
+ podmanTest.SeedImages()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ processTestResult(CurrentGinkgoTestDescription())
+ })
+
+ It("stop podman.service", func() {
+ SkipIfRemote("Testing stopped service requires both podman and podman-remote binaries")
+
+ activate, err := exec.LookPath("systemd-socket-activate")
+ if err != nil {
+ activate = "/usr/bin/systemd-socket-activate"
+ }
+ stat, err := os.Stat(activate)
+ switch {
+ case errors.Is(err, fs.ErrNotExist):
+ Skip(activate + " required for systemd activation tests")
+ case stat.Mode()&0111 == 0:
+ Skip("Unable to execute " + activate)
+ case err != nil:
+ Skip(err.Error())
+ }
+
+ // systemd-socket-activate does not support DNS lookups
+ host := "127.0.0.1"
+ port, err := podmanUtils.GetRandomPort()
+ Expect(err).ToNot(HaveOccurred())
+
+ activateSession := testUtils.StartSystemExec(activate, []string{
+ fmt.Sprintf("--listen=%s:%d", host, port),
+ podmanTest.PodmanBinary,
+ "--root=" + filepath.Join(tempDir, "server_root"),
+ "system", "service",
+ "--time=0",
+ })
+ Expect(activateSession.Exited).ShouldNot(Receive(), "Failed to start podman service")
+
+ // Curried functions for specialized podman calls
+ podmanRemote := func(args ...string) *testUtils.PodmanSession {
+ args = append([]string{"--url", fmt.Sprintf("tcp://%s:%d", host, port)}, args...)
+ return testUtils.SystemExec(podmanTest.RemotePodmanBinary, args)
+ }
+
+ podman := func(args ...string) *testUtils.PodmanSession {
+ args = append([]string{"--root", filepath.Join(tempDir, "server_root")}, args...)
+ return testUtils.SystemExec(podmanTest.PodmanBinary, args)
+ }
+
+ containerName := "top_" + testUtils.RandomString(8)
+ apiSession := podmanRemote(
+ "create", "--tty", "--name", containerName, "--entrypoint", "top",
+ "quay.io/libpod/alpine_labels:latest",
+ )
+ Expect(apiSession).Should(Exit(0))
+
+ apiSession = podmanRemote("start", containerName)
+ Expect(apiSession).Should(Exit(0))
+
+ apiSession = podmanRemote("inspect", "--format={{.State.Running}}", containerName)
+ Expect(apiSession).Should(Exit(0))
+ Expect(apiSession.OutputToString()).To(Equal("true"))
+
+ // Emulate 'systemd stop podman.service'
+ activateSession.Signal(syscall.SIGTERM)
+ time.Sleep(2)
+ Eventually(activateSession).Should(Exit(0))
+
+ abiSession := podman("inspect", "--format={{.State.Running}}", containerName)
+ Expect(abiSession).To(Exit(0))
+ Expect(abiSession.OutputToString()).To(Equal("true"))
+ })
+})
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index ebd71450f..dbf4b2828 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -248,8 +248,7 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z
run_podman inspect --format '{{.ID}}' $IMAGE
imageID=$output
- run_podman version --format "{{.Server.Version}}-{{.Server.Built}}"
- pauseImage=localhost/podman-pause:$output
+ pauseImage=$(pause_image)
run_podman inspect --format '{{.ID}}' $pauseImage
pauseID=$output
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index e47d66542..7466c3b74 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -605,7 +605,7 @@ EOF
done
}
-# Regression test for #9867
+# Regression test for #9867 and #13529
# Make sure that if you exclude everything in context dir, that
# the Containerfile/Dockerfile in the context dir are used
@test "podman build with ignore '*'" {
@@ -620,6 +620,15 @@ cat >$tmpdir/.dockerignore <<EOF
*
EOF
+ # Prior to the fix for #13529, pod-create would fail with 'error building
+ # at STEP COPY .../catatonit' because of the local .dockerignore file was
+ # used.
+ pushd "${tmpdir}"
+ run_podman pod create
+ run_podman pod rm $output
+ run_podman rmi $(pause_image)
+ popd
+
run_podman build -t build_test $tmpdir
# Rename Containerfile to Dockerfile
diff --git a/test/system/200-pod.bats b/test/system/200-pod.bats
index 34dfaa8f6..ca931e244 100644
--- a/test/system/200-pod.bats
+++ b/test/system/200-pod.bats
@@ -6,13 +6,7 @@ load helpers
function teardown() {
run_podman pod rm -f -t 0 -a
run_podman rm -f -t 0 -a
- run_podman image list --format '{{.ID}} {{.Repository}}'
- while read id name; do
- if [[ "$name" =~ /podman-pause ]]; then
- run_podman rmi $id
- fi
- done <<<"$output"
-
+ run_podman ? rmi $(pause_image)
basic_teardown
}
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 221315b97..0d336592f 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -383,6 +383,15 @@ function journald_unavailable() {
return 1
}
+# Returns the name of the local pause image.
+function pause_image() {
+ # This function is intended to be used as '$(pause_image)', i.e.
+ # our caller wants our output. run_podman() messes with output because
+ # it emits the command invocation to stdout, hence the redirection.
+ run_podman version --format "{{.Server.Version}}-{{.Server.Built}}" >/dev/null
+ echo "localhost/podman-pause:$output"
+}
+
###########################
# _add_label_if_missing # make sure skip messages include rootless/remote
###########################
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 14092a2a5..8fe45dca0 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -368,6 +368,7 @@ func CreateTempDirInTempDir() (string, error) {
// SystemExec is used to exec a system command to check its exit code or output
func SystemExec(command string, args []string) *PodmanSession {
c := exec.Command(command, args...)
+ fmt.Println("Execing " + c.String() + "\n")
session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
@@ -379,6 +380,7 @@ func SystemExec(command string, args []string) *PodmanSession {
// StartSystemExec is used to start exec a system command
func StartSystemExec(command string, args []string) *PodmanSession {
c := exec.Command(command, args...)
+ fmt.Println("Execing " + c.String() + "\n")
session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
diff --git a/utils/utils_supported.go b/utils/utils_supported.go
index 561372607..ab2de2ce1 100644
--- a/utils/utils_supported.go
+++ b/utils/utils_supported.go
@@ -1,3 +1,4 @@
+//go:build linux || darwin
// +build linux darwin
package utils
diff --git a/utils/utils_windows.go b/utils/utils_windows.go
index 1a2196029..2c159ab06 100644
--- a/utils/utils_windows.go
+++ b/utils/utils_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package utils