1238 Commits

Author SHA1 Message Date
cad28cc2d3 libpod/networking_unsupported: Remove JoinNetworkNameSpace
This function was added in cc6f0e85 (more changes to compile darwin,
2018-07-04, #1047), but it has no consumers and no Linux analog.
Remove it, which also fixes the [1]:

  libpod/networking_unsupported.go:9:1⚠️ exported function
  JoinNetworkNameSpace should have comment or be unexported (golint)

lint issue.

[1]: https://travis-ci.org/projectatomic/libpod/jobs/400555937#L158

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1034
Approved by: baude
2018-07-06 00:48:39 +00:00
b1f63aa0cd .travis: Run gofmt and lint on OS X
Just in case their output depends on the target GOOS.  Lint, at least,
does care, because it can pass on Linux [1] and fail on OS X [2] with
the same code.

[1]: https://travis-ci.org/projectatomic/libpod/jobs/400555936#L856
[2]: https://travis-ci.org/projectatomic/libpod/jobs/400555937#L153

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1034
Approved by: baude
2018-07-06 00:48:39 +00:00
83968de28c rootless: Merge rootless.go back into rootless_linux.go
The files were split apart by b96be3af (changes to allow for darwin
compilation, 2018-06-20, #1015), but the C import and two functions
left in rootless.go are all Linux-specific as well.  This commit moves
all of the pre-b96be3af rootless.go into rootless_linux.go, just
adding the '// +build linux' header (b96be3af also scrambled the + in
that header) and keeping the new GetRootlessUID from a1545fe6
(rootless: add function to retrieve the original UID, 2018-07-05, #1048).

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1034
Approved by: baude
2018-07-06 00:48:39 +00:00
4b54a471a4 Makefile: Use a pattern rule for cross-compilation
Pattern-rule documentation is in [1].  This commit follows the basic
approach from [2], with the portable build tags from [3].

Using --keep-going allows folks to see errors for multiple target
platforms.  For example, if the Darwin target dies, we'll still
attempt to build the Linux target before erroring out.

I've added an ALLOWED_TO_FAIL environment variable to mark script
blocks for the the allow_failures block.  Currently we're requiring
builds from Linux for Linux and OS X to succeed, but allowing builds
from OS X to both targets to fail.

[1]: https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html#Pattern-Intro
[2]: e5031fcf9a
[3]: https://github.com/kubernetes-incubator/cri-o/pull/1653

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1034
Approved by: baude
2018-07-06 00:48:39 +00:00
cc6f0e85f9 more changes to compile darwin
this should represent the last major changes to get darwin to **compile**.  again,
the purpose here is to get darwin to compile so that we can eventually implement a
ci task that would protect against regressions for darwin compilation.

i have left the manual darwin compilation largely static still and in fact now only
interject (manually) two build tags to assist with the build.  trevor king has great
ideas on how to make this better and i will defer final implementation of those
to him.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #1047
Approved by: rhatdan
2018-07-05 16:05:12 +00:00
33870ea2c3 Fix timeout issue with built-in volume test
Building our own image to test built-in volume and user
instead of using the mariadb one.
Solves timeout issue in travis tests.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1044
Approved by: mheon
2018-07-05 14:20:12 +00:00
4cc4c7137d rootless: add /run/user/$UID to the lookup paths
when XDG_RUNTIME_DIR is not set, still attempt to use /run/user/$UID
before looking up other directories.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1048
Approved by: mheon
2018-07-05 13:30:15 +00:00
a1545fe6e4 rootless: add function to retrieve the original UID
After we re-exec in the userNS os.Getuid() returns the new UID (= 0)
which is not what we want to use.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1048
Approved by: mheon
2018-07-05 13:30:15 +00:00
e38272047f rootless: always set XDG_RUNTIME_DIR
containers/image uses XDG_RUNTIME_DIR to locate the auth file.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1048
Approved by: mheon
2018-07-05 13:30:15 +00:00
77758a6c9f rootless: set XDG_RUNTIME_DIR also for state and exec
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1048
Approved by: mheon
2018-07-05 13:30:15 +00:00
baa42fd4bd libpod/container: Replace containerState* with containerPlatformState
This way we don't need to stub in structures for other OSes (e.g. the
Darwin stub in a Linux-only file).  Matthew was concerned about errors
unmarshalling, say, a Linux state object on a Windows box [1], but we
can address that in checks when loading the database [2].

[1]: https://github.com/projectatomic/libpod/pull/1015#discussion_r198649043
[2]: https://github.com/projectatomic/libpod/pull/1015#discussion_r198802956

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1033
Approved by: mheon
2018-07-05 12:47:10 +00:00
49fe03c626 urfave/cli: fix parsing of short opts
Vendor an updated version of urfave/cli to fix the parsing of short
options.  Until the fix is merged upstream, vendor the code from
github.com/vrothberg/cli containing both, the latest urfave/cli and
the bug fix.

Fixes: #714
Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1046
Approved by: rhatdan
2018-07-05 10:43:17 +00:00
f2462ca59e docs: Follow man-pages(7) suggestions for SYNOPSIS
man-pages(7) has [1]:

> For commands, this shows the syntax of the command and its arguments
> (including options); boldface is used for as-is text and italics are
> used to indicate replaceable arguments. Brackets ([]) surround
> optional arguments, vertical bars (|) separate choices, and ellipses
> (...) can be repeated.

I've adjusted our SYNOPSIS entries to match that formatting, and
generally tried to make them more consistent with the precedent set by
the man-pages project.  Outside of the SYNOPSIS entry, I prefer using
backticks for literals, although in some places I've left the **
bolding to keep things visually similar to a nearby SYNOPSIS entry.

[1]: http://man7.org/linux/man-pages/man7/man-pages.7.html

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1027
Approved by: rhatdan
2018-07-04 09:40:37 +00:00
6d8fac87ed Allow multiple mounts
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #1030
Approved by: rhatdan
2018-07-03 18:02:45 +00:00
7a5c376e63 Makefile: Use 'git diff' to show gofmt changes
This makes fixing errors easier.  Before this commit, errors looked
like [1]:

  $ make gofmt
  libpod/container_linux.go:1:⚠️ file is not gofmted with -s (gofmt)
  make: *** [gofmt] Error 1

But that's not very helpful when your local gofmt thinks the file is
fine.  With this commit, errors will look like:

  $ make gofmt
  find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
  git diff --exit-code
  diff --git a/libpod/container_internal.go b/libpod/container_internal.go
  index df4de3fe..22b39870 100644
  --- a/libpod/container_internal.go
  +++ b/libpod/container_internal.go
  @@ -1,7 +1,7 @@
   package libpod

   import (
  -"bytes"
  +       "bytes"
          "context"
          "encoding/json"
          "fmt"
  make: *** [Makefile:87: gofmt] Error 1

(or whatever, I just stuffed in a formatting error for demonstration
purposes).

Also remove the helper script in favor of direct Makefile calls,
because with Git handling difference reporting and exit status, this
becomes a simpler check.  find's -exec, !, and -path arguments are
specified in POSIX [2].

[1]: https://travis-ci.org/kubernetes-incubator/cri-o/jobs/331949394#L1075
[2]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/find.html

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1038
Approved by: rhatdan
2018-07-03 10:39:54 +00:00
40e4481bd8 Skip a test in Travis that has timeout issues
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1041
Approved by: rhatdan
2018-07-03 10:09:12 +00:00
767b3ddc43 vendor in selinux and buildah for darwin compilation
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1037
Approved by: baude
2018-07-02 20:39:16 +00:00
d357703e06 add image user to inspect data
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1036
Approved by: rhatdan
2018-07-02 15:10:46 +00:00
b96be3af1b changes to allow for darwin compilation
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1015
Approved by: baude
2018-06-29 20:44:09 +00:00
8d114ea4d8 Merge pull request #1029 from mheon/bump-0.6.5
Bump to v0.6.5
2018-06-29 16:00:47 -04:00
7a2298db6b Bump gitvalidation epoch
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-06-29 15:59:22 -04:00
c71845fa70 Bump to v0.7.1-dev
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-06-29 15:59:22 -04:00
9d97bd67ed Bump to v0.6.5
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
v0.6.5
2018-06-29 15:59:12 -04:00
4c8c000f3a Fix built-in volume issue with podman run/create
The destination path of the built-in volume was not being created
but a relabel was being attempted on it, this was causing issues
with all images that have built-in volumes.
This patch fixes that and ensures the destination volume path
is created.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1026
Approved by: mheon
2018-06-29 19:56:12 +00:00
7fc1a329bd Add podman container cleanup to CLI
When we run containers in detach mode, nothing cleans up the network stack or
the mount points.  This patch will tell conmon to execute the cleanup code when
the container exits.

It can also be called to attempt to cleanup previously running containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #942
Approved by: mheon
2018-06-29 15:25:21 +00:00
41bd607c12 Allow multiple containers and all for umount
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #1012
Approved by: rhatdan
2018-06-29 15:01:21 +00:00
3a90b5224d Returning joining namespace error should not be fatal
I got my database state in a bad way by killing a hanging container.

It did not setup the network namespace correctly

listing/remove bad containers becomes impossible.

podman run alpine/nginx
^c
got me in this state.

I got into a state in the database where
podman ps -a
was returning errors and I could not get out of it,  Makeing joining the network
namespace a non fatal error fixes the issue.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #918
Approved by: mheon
2018-06-29 14:32:57 +00:00
810f2b6061 Start using github.com/seccomp/containers-golang
User newer seccomp bindings from the seccomp upstream

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1021
Approved by: giuseppe
2018-06-29 13:18:41 +00:00
c09bbe8e06 Test to verify overlay quotas work, show container overhead on quota
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1013
Approved by: rhatdan
2018-06-29 09:21:33 +00:00
c9eddd22eb conmon no longer writes to syslog
If the caller sets up the app to be in logrus.DebugLevel,
then we will add the --syslog flag to conmon to get all of the
messages.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1014
Approved by: TomSweeneyRedHat
2018-06-29 08:22:27 +00:00
d61d8a35e0 Fix broken f28/cloud instance
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1024
Approved by: nalind
2018-06-29 00:28:27 +00:00
10dfd8d92a Vendor latest projectatomic/buildah
Fixes issue with build for last step of docker file when
building with --layers.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1023
Approved by: mheon
2018-06-28 23:26:42 +00:00
183cde0c68 Merge pull request #1020 from giuseppe/resize-fix-loop
utils: fix endless write of resize event
2018-06-28 17:43:58 -04:00
67f68626e6 vendor in latest golang/x/sys
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1022
Approved by: baude
2018-06-28 20:28:38 +00:00
45c745e0b0 vendor in latest docker package
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1022
Approved by: baude
2018-06-28 20:28:38 +00:00
3b9046a170 Remove the --registry flag from podman search
Instead of setting the --registry flag to search a single registry,
prefix the registry before the image name in the input, an example is
`podman search registry.fedoraproject.org/fedora` and this will search for
the fedora image in only registry.fedoraproject.org.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1011
Approved by: rhatdan
2018-06-28 16:55:29 +00:00
54e9a48c54 utils: fix endless write of resize event
issue introduced with c82166afabd63f6271990be89ffa6609d3dc6712

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-28 18:53:09 +02:00
650797c016 Start prints UUID or container name that user inputs on success
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1019
Approved by: rhatdan
2018-06-28 16:13:42 +00:00
c82166afab cmd/podman/utils.go: Cancel-able resize writes
On Thu, Jun 28, 2018 at 03:48:26AM -0700, Marco Vedovati wrote [1]:
> The root cause is a deadlock between two channel writes made by two
> different goroutines:
>
> 1. `resizeTty() : go func(){} : sendUpdate()` is sending a resize
>    message thru `resize` right at the beginning, but the channel is
>    never read if some startup error occurs.
>
> 2. Upon program termination, `startAttachCtr() : defer func(){} ` is
>    telling the goroutine in "1." to stop via the `resizeTerminate`
>    channel. But that guy is still waiting for the write to `resize`
>    to complete so the the termination message is never read.
>
> I think the go deadlock detection does not kick in because not all
> goroutines are seen as asleep. E.g. `os/signal Notify()` is enough
> to have the deadlock not detected.

333ab8c2 (Fix podman hangs when detecting startup error in container
attached mode, 2018-06-27, #1010) addressed this with a deferred
drain.  This commit adjusts that approach to use a single select to
cover "have we been canceled?", "has there been a resize signal?", and
(when we have one) "can we write the most recent resize event to the
resize channel?".

A side benefit to this approach is that if we have a slow resize
consumer and several resize signals, the resizeTty function will keep
updating its local resizeEvent.  Once the resize channel is able to
accept, only the most-recent event will be written.  Previously we'd
have written one resize event for every received signal, even if the
resize consumer was falling behind.

[1]: https://github.com/projectatomic/libpod/pull/1010#issuecomment-400994436

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1018
Approved by: rhatdan
2018-06-28 15:53:02 +00:00
333ab8c211 Fix podman hangs when detecting startup error in container attached mode
Signed-off-by: Marco Vedovati <mvedovati@suse.com>

The initial resize command sent to the terminal window over the resize
channel may never be delivered in case of error.

Hence it is necessary to consume all data from the resize channel to
avoid a deadlock on startup.

Fixes: #1009

Closes: #1010
Approved by: giuseppe
2018-06-28 13:39:52 +00:00
b5cd076164 travis: bump go to 1.9.x and 1.10.x
Update the used go versions from 1.8.x to 1.9.x and 1.9.x to 1.10.x.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1016
Approved by: rhatdan
2018-06-28 13:08:11 +00:00
04accf0eff podman-build --help: update description
Update the description of podman-build which was mentioning the initial
requirement of Buildah which doesn't apply anymore since Podman is
vendoring Buildah code.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #1005
Approved by: rhatdan
2018-06-28 13:07:31 +00:00
fd12c8918b *: Replace Generator.Spec() with Generator.Config
Catching up with opencontainers/runtime-tools@84a62c6a (generate: Move
Generator.spec to Generator.Config, 2016-11-06, #266, v0.6.0), now
that we've bumped runtime-tools in f6c0fc1a (Vendor in latest
runtime-tools, 2018-06-26, #1007).

Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #1008
Approved by: mheon
2018-06-27 21:27:19 +00:00
c32c491869 generator.New() requires an OS string input variable
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1007
Approved by: baude
2018-06-27 15:16:02 +00:00
e1b47c1507 Vendor in latest buildah
Signed-off-by: baude <bbaude@redhat.com>

Closes: #1007
Approved by: baude
2018-06-27 15:16:02 +00:00
f6c0fc1aa8 Vendor in latest runtime-tools
Newer runtime tools separates syscalls by OS so we can build darwin.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #1007
Approved by: baude
2018-06-27 15:16:02 +00:00
19f5a504ff docs: add documentation for rootless containers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
6f3208b599 runtime: change rootless data storage default path
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
3306d3e120 rootless: use $HOME/.config/containers/libpod.conf
If the file exists, use it to read the configuration.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00
ea06dccba2 test: add env variables to the debug output
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #936
Approved by: rhatdan
2018-06-27 14:07:17 +00:00