Commit graph

999 commits

Author SHA1 Message Date
Jhon Honce 4f5e6728b7 Provide examples for python podman API
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #870
Approved by: rhatdan
2018-06-01 21:19:56 +00:00
Matthew Heon b6753238bc Bump Buildah vendor to pick up fix for tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #878
Approved by: mheon
2018-06-01 20:58:39 +00:00
Matthew Heon c2e3058b3b Log podman build failures in papr
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #875
Approved by: mheon
2018-06-01 20:39:15 +00:00
Jhon Honce 727ecfeadf Use Version from spec file in setup.py
- If envvar PODMAN_VERSION not set use default version of 0.0.0

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #807
Approved by: rhatdan
2018-06-01 20:18:23 +00:00
Daniel J Walsh 2446ebc70f Attempt to use fedora 28 atomic host
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #873
Approved by: mheon
2018-06-01 20:14:28 +00:00
Daniel J Walsh e83b007d51
Merge pull request #876 from jwhonce/wip/commit
Fix label handling
2018-06-01 15:46:48 -04:00
Jhon Honce 80baf0d800 Fix lable handling
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-06-01 10:03:54 -07:00
Daniel J Walsh 8c68fddd1c
Merge pull request #839 from baude/varlinkcreatefixes
varlink build
2018-06-01 13:00:30 -04:00
Daniel J Walsh 3c63a48bb8
Merge pull request #859 from rhatdan/onbuild
Add OnBuild support for podman build
2018-06-01 12:59:47 -04:00
Daniel J Walsh 10d440a1c8
Merge pull request #872 from giuseppe/add-usr-libexec-podman-conmon
runtime: add /usr/libexec/podman/conmon to the conmon paths
2018-06-01 12:58:51 -04:00
Daniel J Walsh 3f29e3e881
Merge pull request #869 from jwhonce/wip/attach
Implement container attach
2018-06-01 11:41:16 -04:00
Giuseppe Scrivano 46e0cf0ef8
runtime: add /usr/libexec/podman/conmon to the conmon paths
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-06-01 16:43:35 +02:00
baude 62ea88fa19 varlink build
Add the endpoint and methods for build so users can build an image
with varlink.  build can also use the more method for streaming
output back more regularily; however, it looks like a bug in buildah
does not output all build output to the writer provided.

Tidy up some create fixes and add endpoint for GetImage requested by
jhonce.

Signed-off-by: baude <bbaude@redhat.com>
2018-06-01 09:13:31 -05:00
Daniel J Walsh 29c831f9d6 Add OnBuild support for podman build
Only supported for docker formated images. OCI Does not support this flag.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-06-01 10:08:56 -04:00
Matthew Heon ff3b46e769
Merge pull request #867 from wking/release-script
hack/release.sh: Add a release script
2018-06-01 09:40:48 -04:00
baude 8f14f966be return all inspect info for varlink containerinspect
when obtaining the inspect information for a container through varlink, we need
to extract more container related information by parsing the data through the
method 'GetCtrInspectInfo' which was previously only in podman's main.

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

Closes: #866
Approved by: rhatdan
2018-06-01 08:37:55 +00:00
W. Trevor King 34886a79d6 hooks/exec: Allow successful reaps for 0s post-kill timeouts
I'd been getting the failed-to-reap errors locally, but on an
unrelated pull-request the FAH27 suite successfully reaped that hook
[1]:

  --- FAIL: TestRunKillTimeout (0.50s)
  	assertions.go:226:

  	Error Trace:	exec_test.go:210

  	Error:      	Expect "signal: killed" to match "^failed to reap process within 0s of the kill signal$"
  FAIL

The successful-reap cases limit our coverage, but I don't think that's
a big enough problem to be worth repeated polling or similar until we
do get the failed-to-reap error.

[1]: 96c1535fdc.0.1527811547665239762/output.log

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

Closes: #868
Approved by: rhatdan
2018-06-01 08:28:06 +00:00
W. Trevor King 8405ff9baa hack/release.sh: Add a release script
Matthew had expressed interest in a lovely release script on IRC.
Here's my attempt to encode the changes from the v0.5.4 release
branch.  I've also added tag signing, so you may be prompted for your
passphrase during that step.

The version scheme for 0.x.y is 0.${month}.${count_that_month} [1].
We could automatically calculate those with a dozen or so lines of
shell script, but we don't think that's worth the maintenance burden
when it's easy enough for the caller to think them up on their own
[2].

The spec sed also bumps the Python package version to match, which
seems like the intended behavior until 1.0 when the Python code will
move into its own repository [3].

[1]: https://github.com/projectatomic/libpod/pull/867#issuecomment-393731907
[2]: https://github.com/projectatomic/libpod/pull/867#issuecomment-393743295
[3]: https://github.com/projectatomic/libpod/issues/786#issuecomment-390682012

Signed-off-by: W. Trevor King <wking@tremily.us>
2018-05-31 21:04:46 -07:00
Jhon Honce 2cb881fa58 Implement container attach
Signed-off-by: Jhon Honce <jhonce@redhat.com>
2018-05-31 20:13:35 -07:00
Daniel J Walsh a9e9fd4f5b If user specifies UIDMapSlice without GIDMapSlice, set them equal
We need to map slices set for both UID and GID maps to be equivalent if
not specified by user.  Currently if you do not specify both the containers
are not running.

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

Closes: #865
Approved by: baude
2018-05-31 22:30:16 +00:00
baude 0eda60957d fix panic with podman pull
when there are no registries configured for the system and the user provided
a short image name, we panic'd due a logic bug in recent image pull changes.

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

Closes: #841
Approved by: rhatdan
2018-05-31 22:07:15 +00:00
W. Trevor King 81d6f082f3 pkg/hooks/exec: Add a new package for local hook execution
This wraps os/exec to:

* Clear the environment when the hook doesn't set 'env'.  The runtime
  spec has [1]:

  > * env (array of strings, OPTIONAL) with the same semantics as IEEE
  >   Std 1003.1-2008's environ.

  And running execle or similar with NULL env results in an empty
  environment:

    $ cat test.c
    #include <unistd.h>

    int main()
    {
      return execle("/usr/bin/env", "env", NULL, NULL);
    }
    $ cc -o test test.c
    $ ./test
    ...no output...

  Go's Cmd.Env, on the other hand, has [2]:

  > If Env is nil, the new process uses the current process's environment.

  This commit works around that by setting []string{} in those cases
  to avoid leaking the runtime environment into the hooks.

* Roll the 'timeout' value (if set) into the passed context.  There's
  no need for two separate ways to cancel hook execution.

* Add a configurable timeout on abandoning a post-kill wait.  The
  waiting goroutine will continue and eventually reap the process, but
  this avoids blocking the Run() call when that takes inordinately
  long (for example, if a GPU cleanup hook is stuck in I/O sleep [3]).

The 'env' output format is specified in POSIX [4].

[1]: https://github.com/opencontainers/runtime-spec/blob/v1.0.1/config.md#posix-platform-hooks
[2]: https://golang.org/pkg/os/exec/#Cmd
[3]: https://github.com/projectatomic/libpod/pull/857#discussion_r192191002
[4]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html

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

Closes: #857
Approved by: mheon
2018-05-31 21:45:27 +00:00
Matthew Heon 824ea4da33 Remove --net flag and make it an alias for --network
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #862
Approved by: rhatdan
2018-05-31 20:09:38 +00:00
Daniel J Walsh d6b8f62dd6 Catch does not exist error
There was a new line at the end of does not exist
which was causing this to fail.

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

Closes: #863
Approved by: baude
2018-05-31 19:28:00 +00:00
W. Trevor King 4dfe0d60f3 hooks: Rename Hooks() output to extensionStageHooks
To more clearly distinguish between the extensionStages input to New()
(a slice of strings) and the map output from Hooks().

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

Closes: #855
Approved by: rhatdan
2018-05-31 14:11:52 +00:00
W. Trevor King 7c1434c2f7 hooks: Allow local control of OCI stages via extensionStages
This allows callers to avoid delegating to OCI runtimes for cases
where they feel that the runtime hook handling is unreliable [1].

[1]: https://github.com/projectatomic/libpod/issues/730#issuecomment-392959938

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

Closes: #855
Approved by: rhatdan
2018-05-31 14:11:52 +00:00
Daniel J Walsh 7c6034e161 We need to change the SELinux label of the conmon process to s0
If SELinux is enabled, we are leaking in pipes into the container
owned by conmon.  The container processes are not allowed to use
these pipes, if the calling process is fully ranged.  By changing
the level of the conmon process to s0, this allows container processes
to use the pipes.

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

Closes: #854
Approved by: mheon
2018-05-31 13:51:11 +00:00
Daniel J Walsh bae80a0b66 Clear all caps, except the bounding set, when --user is specified.
Currently we are giving all caps to users when running with podman run --user,
They should get none by default.  If the command line includes --cap-add, then
we need to run with those capabilties.  Similarly we need to drop caps from
bounding set, if user specifies --cap-drop

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

Closes: #851
Approved by: mheon
2018-05-31 13:46:08 +00:00
W. Trevor King e6b088fc6e Makefile: Add stderr redirect to HAS_PYTHON3 definition
For two reasons:

* When a system is missing python3, we don't need to spam them with
  "Command not found" in their stderr.

* Without the redirect, GNU Make (at least version 4.2.1) is overly
  clever and tries to invoke the command itself, not realizing that
  it's a shell builtin [1].

    $ make --version
    GNU Make 4.2.1
    Built for aarch64-unknown-linux-gnu
    Copyright (C) 1988-2016 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    $ cat Makefile
    PYTHON3_A := $(shell command -v python3)
    PYTHON3_B := $(shell command -v python3 2>/dev/null)

    test:
            @echo "SHELL: '$(SHELL)'"
            @echo "PYTHON3_A: '$(PYTHON3_A)'"
            @echo "PYTHON3_B: '$(PYTHON3_B)'"
    $ make
    make: command: Command not found
    SHELL: '/bin/sh'
    PYTHON3_A: ''
    PYTHON3_B: '/usr/bin/python3'

  By adding the redirect we actually hit the shell and can
  successfully invoke command.

[1]: https://stackoverflow.com/a/17550243

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

Closes: #856
Approved by: rhatdan
2018-05-31 12:57:34 +00:00
Matthew Heon a127b4f312 Force update of API.md
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #849
Approved by: rhatdan
2018-05-30 18:41:54 +00:00
Daniel J Walsh 6d90259999 do not allow port related args to be used with --network=container:
we cannot set additional ports on an existing container namespace, so we should
not allow --network=container with publish or publish-all.

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

Closes: #853
Approved by: baude
2018-05-30 18:40:46 +00:00
Matthew Heon 66a5bc0b72 Update .gitignore for Varlink code and gopathok
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #847
Approved by: rhatdan
2018-05-30 17:06:22 +00:00
baude 9ace06e0c2 sort containers and images by create time
When running podman ps or podman images, the containers and images should
be sorted by newest to oldest.

Resolves: #830

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

Closes: #848
Approved by: mheon
2018-05-30 16:30:20 +00:00
Daniel J Walsh 71487466fb Cleanup man pages
Format md files to work properly when converted to man pages.
Add sed command to cleanup table in podman man page.

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

Closes: #842
Approved by: mheon
2018-05-30 13:49:45 +00:00
baude 8ee0f2bf91 add go generate varlink to copr spec
Now that we make the varlink .go file on the fly, we need to have the
spec call go generate on it to build properly.

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

Closes: #843
Approved by: baude
2018-05-29 20:59:08 +00:00
baude 8b3f8076c7 Remove varlink's generated Go file
Signed-off-by: baude <bbaude@redhat.com>

Closes: #840
Approved by: baude
2018-05-29 20:25:10 +00:00
Matthew Heon 44d1c1c631
Merge pull request #834 from mheon/bump_0_5_4
Bump 0 5 4
2018-05-25 13:54:33 -04:00
Matthew Heon a9f200065c Bump gitvalidation epoch
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-05-25 13:49:19 -04:00
Matthew Heon 70672652b6 Bump to v0.6.1-dev
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-05-25 13:48:56 -04:00
Matthew Heon 1f2e2a25bf Bump to v0.5.4
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-05-25 13:46:50 -04:00
umohnani8 1930f5d709 Vendor in latest projectatomic/buildah
buildah fixed its probelm where it was not pulling in
the ENV of the base image. This pulls that change into
libpod as well.

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

Closes: #832
Approved by: mheon
2018-05-25 17:03:09 +00:00
Jhon Honce 8fcf1aaa29 Rename addFIPSsModeSecret to addFIPSModeSecret
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #833
Approved by: mheon
2018-05-25 16:37:34 +00:00
Matthew Heon de13777e71 Make references to the Process part of Spec conditional
The OCI runtime spec does not require Process to be passed (IE,
it can be nil). Make most of our references to it conditional on
it existing.

Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #828
Approved by: mheon
2018-05-25 15:32:47 +00:00
umohnani8 c8b72e57a7 save and load should support multi-tag for docker-archive
The docker-archive tar files can have multiple tags for the same
image stored in it. Load pulls all the tags found in the archive
when loading a tar file. Save can oush multiple tags of the same
image to a tar archive.

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

Closes: #819
Approved by: rhatdan
2018-05-25 15:15:47 +00:00
Jhon Honce 0a4ade1c17 Implement python podman create and start
- Added alias 'container()' to image model for CreateContainer()
- Fixed return in containers_create.go to wrap error in varlink
  exception
- Added a wait time to container.kill(), number of seconds to wait
  for the container to change state
- Refactored cached_property() to use system libraries
- Refactored tests to speed up performance

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #821
Approved by: rhatdan
2018-05-25 09:31:21 +00:00
Jhon Honce 684b544e9c Spell check strings and comments
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #831
Approved by: rhatdan
2018-05-25 08:45:15 +00:00
W. Trevor King a7180cd545 hooks/1.0.0: Error on empty process.args instead of panicking
The process property is optional [1], which this package already
handled appropriately, although I've added a new test here to guard
against regressions.

The process.args entry is required when process is set [2], and it's
also required to contain at least one entry [3].  The previous
implementation here assumed that would always be satisfied, and
panicked on empty process.args.  With this commit, we avoid the panic
and instead return an error message explaining why the input was
invalid.

[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L145
[2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L157
[3]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L158

Reported-by: Brent Baude <bbaude@redhat.com>
Signed-off-by: W. Trevor King <wking@tremily.us>

Closes: #829
Approved by: mheon
2018-05-24 21:27:05 +00:00
Matthew Heon b09fca74af Set Entrypoint from image only if not already set
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #827
Approved by: rhatdan
2018-05-24 17:36:37 +00:00
Daniel J Walsh 915364034f Update podman build to match buildah bud functionality
Add --label, --annotations, --idfile, --squash

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

Closes: #824
Approved by: TomSweeneyRedHat
2018-05-23 22:38:17 +00:00
Jhon Honce d252fa710e Fix test_runner call of podman varlink
- Updated some tests due to slippage between tests and code
- Skipped tests will be reinstated in a separate PR

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #825
Approved by: rhatdan
2018-05-23 19:46:23 +00:00