diff options
-rw-r--r-- | cmd/podman/images/save.go | 2 | ||||
-rw-r--r-- | contrib/spec/podman.spec.in | 64 | ||||
-rw-r--r-- | libpod/image/prune.go | 5 | ||||
-rw-r--r-- | pkg/domain/entities/types/auth.go | 3 | ||||
-rw-r--r-- | pkg/domain/entities/types/types.go | 3 | ||||
-rw-r--r-- | pkg/domain/infra/abi/play.go | 1 | ||||
-rw-r--r-- | pkg/specgen/generate/kube/kube.go | 6 | ||||
-rwxr-xr-x | test/compose/test-compose | 8 | ||||
-rw-r--r-- | test/e2e/play_kube_test.go | 1 | ||||
-rw-r--r-- | test/e2e/save_test.go | 18 | ||||
-rw-r--r-- | test/system/070-build.bats | 12 |
11 files changed, 85 insertions, 38 deletions
diff --git a/cmd/podman/images/save.go b/cmd/podman/images/save.go index 6c03fc3c6..f1f7e8b2e 100644 --- a/cmd/podman/images/save.go +++ b/cmd/podman/images/save.go @@ -102,7 +102,7 @@ func save(cmd *cobra.Command, args []string) (finalErr error) { tags []string succeeded = false ) - if cmd.Flag("compress").Changed && (saveOpts.Format != define.OCIManifestDir && saveOpts.Format != define.V2s2ManifestDir && saveOpts.Format == "") { + if cmd.Flag("compress").Changed && (saveOpts.Format != define.OCIManifestDir && saveOpts.Format != define.V2s2ManifestDir) { return errors.Errorf("--compress can only be set when --format is either 'oci-dir' or 'docker-dir'") } if len(saveOpts.Output) == 0 { diff --git a/contrib/spec/podman.spec.in b/contrib/spec/podman.spec.in index 78ff664f7..02b73bdb8 100644 --- a/contrib/spec/podman.spec.in +++ b/contrib/spec/podman.spec.in @@ -12,9 +12,9 @@ %global debug_package %{nil} %endif -# %if ! 0% {?gobuild:1} -%define gobuild(o:) go build -tags="$BUILDTAGS" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; -#% endif +%if ! 0%{?gobuild:1} +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -extldflags '-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; +%endif # podman hack directory %define hackdir %{_builddir}/%{repo}-%{shortcommit0} @@ -30,12 +30,6 @@ %global commit0 #COMMIT# %global shortcommit0 %(c=%{commit0}; echo ${c:0:8}) -# People want conmon packaged with the copr rpm -%global import_path_conmon github.com/containers/conmon -%global git_conmon https://%{import_path_conmon} -%global commit_conmon 41877362fc4685d55e0473d2e4a1cbe5e1debee0 -%global shortcommit_conmon %(c=%{commit_conmon}; echo ${c:0:7}) - Name: podman %if 0%{?fedora} Epoch: 99 @@ -74,7 +68,8 @@ BuildRequires: libselinux-devel BuildRequires: pkgconfig BuildRequires: make BuildRequires: systemd-devel -Requires: skopeo-containers +Requires: containers-common +Requires: conmon Requires: containernetworking-plugins >= 0.6.0-3 Requires: iptables %if 0%{?rhel} < 8 || 0%{?centos} < 8 @@ -371,6 +366,26 @@ BuildArch: noarch Man pages for the %{name} commands %endif +%if 0%{?fedora} && ! 0%{?centos} +%package tests +Summary: Tests for %{name} + +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: bats +Requires: jq +Requires: skopeo +Requires: nmap-ncat +Requires: httpd-tools +Requires: openssl +Requires: socat +Requires: buildah + +%description tests +%{summary} + +This package contains system tests for %{name} +%endif + %prep %autosetup -Sgit -n %{repo}-%{shortcommit0} @@ -416,18 +431,6 @@ BUILDTAGS=$BUILDTAGS make binaries docs %else BUILDTAGS=$BUILDTAGS make binaries %endif -# build conmon -pushd conmon - -mkdir _output -pushd _output -mkdir -p src/%{provider}.%{provider_tld}/{containers,opencontainers} -ln -s $(dirs +1 -l) src/%{import_path_conmon} -popd - -export BUILDTAGS="selinux seccomp systemd $(%{hackdir}/hack/btrfs_installed_tag.sh) $(%{hackdir}/hack/btrfs_tag.sh)" -BUILDTAGS=$BUILDTAGS make -popd %install install -dp %{buildroot}%{_unitdir} @@ -444,10 +447,6 @@ PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{build mv pkg/hooks/README.md pkg/hooks/README-hooks.md -# install conmon -install -dp %{buildroot}%{_libexecdir}/%{name} -install -p -m 755 conmon/bin/conmon %{buildroot}%{_libexecdir}/%{name} - # source codes for building projects %if 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ @@ -467,6 +466,11 @@ for file in $(find . \( -iname "*.go" -or -iname "*.s" \) \! -iname "*_test.go" done %endif +%if 0%{?fedora} && ! 0%{?centos} +install -d -p %{buildroot}/%{_datadir}/%{name}/test/system +cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/ +%endif + # testing files for this project %if 0%{?with_unit_test} && 0%{?with_devel} install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ @@ -522,7 +526,6 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %{_datadir}/bash-completion/completions/* %{_datadir}/zsh/site-functions/* %{_datadir}/fish/vendor_completions.d/* -%{_libexecdir}/%{name}/conmon %config(noreplace) %{_sysconfdir}/cni/net.d/87-%{name}-bridge.conflist %{_unitdir}/podman-auto-update.service %{_unitdir}/podman-auto-update.timer @@ -558,6 +561,13 @@ export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath} %{_mandir}/man5/*.5* %endif +%if 0%{?fedora} && ! 0%{?centos} +%files tests +%license LICENSE +%{_datadir}/%{name}/test +%dir %{_datadir}/%{name}/test/system +%endif + %changelog * Sat Aug 4 2018 Dan Walsh <dwalsh@redhat.com> - 0.8.1-1.git6b4ab2a - Bump to v0.8.1 diff --git a/libpod/image/prune.go b/libpod/image/prune.go index 12727901a..0e41fde44 100644 --- a/libpod/image/prune.go +++ b/libpod/image/prune.go @@ -134,10 +134,11 @@ func (ir *Runtime) PruneImages(ctx context.Context, all bool, filter []string) ( } nameOrID := img.ID() s, err := img.Size(ctx) - imgSize := *s + imgSize := uint64(0) if err != nil { logrus.Warnf("Failed to collect image size for: %s, %s", nameOrID, err) - imgSize = 0 + } else { + imgSize = *s } if err := img.Remove(ctx, false); err != nil { if errors.Cause(err) == storage.ErrImageUsedByContainer { diff --git a/pkg/domain/entities/types/auth.go b/pkg/domain/entities/types/auth.go index ddf15bb18..7f2480173 100644 --- a/pkg/domain/entities/types/auth.go +++ b/pkg/domain/entities/types/auth.go @@ -1,4 +1,5 @@ -package types // import "github.com/docker/docker/api/types" +// copied from github.com/docker/docker/api/types +package types // AuthConfig contains authorization information for connecting to a Registry type AuthConfig struct { diff --git a/pkg/domain/entities/types/types.go b/pkg/domain/entities/types/types.go index 77834c0cb..7dc785078 100644 --- a/pkg/domain/entities/types/types.go +++ b/pkg/domain/entities/types/types.go @@ -1,4 +1,5 @@ -package types // import "github.com/docker/docker/api/types" +// copied from github.com/docker/docker/api/types +package types // ComponentVersion describes the version information for a specific component. type ComponentVersion struct { diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index d4c57bd07..4a13a8029 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -311,6 +311,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY RestartPolicy: ctrRestartPolicy, NetNSIsHost: p.NetNS.IsHost(), SecretsManager: secretsManager, + LogDriver: options.LogDriver, } specGen, err := kube.ToSpecGen(ctx, &specgenOpts) if err != nil { diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index 31ed3fd7c..7aeec9d41 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -98,6 +98,8 @@ type CtrSpecGenOptions struct { NetNSIsHost bool // SecretManager to access the secrets SecretsManager *secrets.SecretsManager + // LogDriver which should be used for the container + LogDriver string } func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGenerator, error) { @@ -115,6 +117,10 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener s.Pod = opts.PodID + s.LogConfiguration = &specgen.LogConfig{ + Driver: opts.LogDriver, + } + setupSecurityContext(s, opts.Container) // Since we prefix the container name with pod name to work-around the uniqueness requirement, diff --git a/test/compose/test-compose b/test/compose/test-compose index c4c484190..46ca80321 100755 --- a/test/compose/test-compose +++ b/test/compose/test-compose @@ -173,15 +173,16 @@ function test_port() { if [ $curl_rc -ne 0 ]; then _show_ok 0 "$testname - curl (port $port) failed with status $curl_rc" - # FIXME: is this useful? What else can we do to diagnose? - echo "# docker-compose logs:" - docker-compose logs echo "# podman ps -a:" $PODMAN_BIN --root $WORKDIR/root --runroot $WORKDIR/runroot ps -a if type -p ss; then echo "# ss -tulpn:" ss -tulpn + echo "# podman unshare --rootless-cni ss -tulpn:" + $PODMAN_BIN --root $WORKDIR/root --runroot $WORKDIR/runroot unshare --rootless-cni ss -tulpn fi + echo "# cat $WORKDIR/server.log:" + cat $WORKDIR/server.log return fi @@ -212,6 +213,7 @@ function start_service() { cp /etc/cni/net.d/*podman*conflist $WORKDIR/cni/ $PODMAN_BIN \ + --log-level debug \ --root $WORKDIR/root \ --runroot $WORKDIR/runroot \ --cgroup-manager=systemd \ diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index e006777bc..5c25c4459 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -2003,7 +2003,6 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) }) It("podman play kube applies log driver to containers", func() { - Skip("need to verify images have correct packages for journald") pod := getPod() err := generateKubeYaml("pod", pod, kubeYaml) Expect(err).To(BeNil()) diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go index 5ddd5efc8..42ee7440b 100644 --- a/test/e2e/save_test.go +++ b/test/e2e/save_test.go @@ -111,6 +111,24 @@ var _ = Describe("Podman save", func() { Expect(save.ExitCode()).To(Equal(0)) }) + It("podman save to directory with --compress but not use docker-dir and oci-dir", func() { + if rootless.IsRootless() && podmanTest.RemoteTest { + Skip("Requires a fix in containers image for chown/lchown") + } + outdir := filepath.Join(podmanTest.TempDir, "save") + + save := podmanTest.Podman([]string{"save", "--compress", "--format", "docker-archive", "-o", outdir, ALPINE}) + save.WaitWithDefaultTimeout() + // should not be 0 + Expect(save.ExitCode()).ToNot(Equal(0)) + + save = podmanTest.Podman([]string{"save", "--compress", "--format", "oci-archive", "-o", outdir, ALPINE}) + save.WaitWithDefaultTimeout() + // should not be 0 + Expect(save.ExitCode()).ToNot(Equal(0)) + + }) + It("podman save bad filename", func() { outdir := filepath.Join(podmanTest.TempDir, "save:colon") diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 5a887c71e..d4017ae01 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -691,8 +691,16 @@ RUN echo $random_string EOF run_podman 125 build -t build_test --pull-never $tmpdir - is "$output" ".* pull policy is .never. but .* could not be found locally" \ - "--pull-never fails with expected error message" + # FIXME: this is just ridiculous. Even after #10030 and #10034, Ubuntu + # remote *STILL* flakes this test! It fails with the correct exit status, + # but the error output is 'Error: stream dropped, unexpected failure' + # Let's just stop checking on podman-remote. As long as it exits 125, + # we're happy. + if ! is_remote; then + is "$output" \ + ".* pull policy is .never. but .* could not be found locally" \ + "--pull-never fails with expected error message" + fi } @test "podman build --logfile test" { |