6446 Commits

Author SHA1 Message Date
d2100cd473 Only set --all when a status filter is given to ps
The changes in #5075 turn out to be too aggressive; we should
only be setting --all if a status= filter is given. Otherwise
only running containers are filtered.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-12 20:14:20 -05:00
2281cbdd6d Merge pull request #5171 from baude/apiv2cockpit2
Fix container filters
2020-02-12 22:43:59 +01:00
e74ad35963 Merge pull request #5187 from vrothberg/pkg-seccomp
add pkg/seccomp
2020-02-12 19:13:23 +01:00
dd5df42be9 Merge pull request #5168 from mheon/do_not_overwrite_volumes
Do not copy up when volume is not empty
2020-02-12 18:46:35 +01:00
65d10ffab3 add pkg/seccomp
Add pkg/seccomp to consolidate all seccomp-policy related code which is
currently scattered across multiple packages and complicating the
creatconfig refactoring.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 17:10:18 +01:00
c140ecdc9b Do not copy up when volume is not empty
When Docker performs a copy up, it first verifies that the volume
being copied into is empty; thus, for volumes that have been
modified elsewhere (e.g. manually copying into then), the copy up
will not be performed at all. Duplicate this behavior in Podman
by checking if the volume is empty before copying.

Furthermore, move setting copyup to false further up. This will
prevent a potential race where copy up could happen more than
once if Podman was killed after some files had been copied but
before the DB was updated.

This resolves CVE-2020-1726.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-12 10:58:42 -05:00
0e9c637c42 Merge pull request #5185 from vrothberg/v2-pull-fix
[CI:DOCS] api: pull: fix reference parsing
2020-02-12 16:55:06 +01:00
62e20b6cd8 Merge pull request #5184 from vrothberg/refactor-pull
cmd/podman/pull: refactor code
2020-02-12 16:15:33 +01:00
9fbacd8305 api: pull: fix reference parsing
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 15:25:25 +01:00
61b890268a cmd/podman/pull: refactor code
Refactor and simplify the code in cmd/podman/pull.go to address a couple
of issues w.r.t. how the arguments were passed.  Also make sure to
always use the c/image API for parsing instead of working around it.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-12 15:11:17 +01:00
e223675625 Merge pull request #5144 from marusak/doc_fixes
[CI:DOCS] podman system service doc fixes
2020-02-12 13:48:56 +01:00
be37d144e7 Merge pull request #5175 from baude/apiv2events
apiv2 stream events
2020-02-12 13:28:55 +01:00
4f44a1a3a2 Merge pull request #5165 from edsantiago/test_apiv2
API v2 tests: catch up to moving target
2020-02-12 12:56:19 +01:00
d0452ae6f3 Merge pull request #5176 from edsantiago/304_is_not_an_error
HTTP 304 (NotModified) is not an error!
2020-02-12 09:19:44 +01:00
ba30bb8409 HTTP 304 (NotModified) is not an error!
Even after #5169, my test logs kept showing:

   ERRO[0004] unable to write json: "http: request method or response status code does not allow body"

Cause: overly-helpful code trying to treat condition as an
error and include a diagnostic message. This is forbidden
per rfc2616.

This PR fixes the faulty response, as well as three others
found via:

    $ ack 'Error.*NotMod'  (4 hits total)
    $ ack 'Error.*NoCont'  (no hits)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 15:15:20 -07:00
0af16eb15b API v2 tests: catch up to moving target
Lots has changed since I first checked this in:

 * Switch to new podman system service invocation
 * /containers API has changed drastically
 * /pods API has some fixes; check for them (e.g.
   container-exists is now 409 Conflict, not 500)
 * One test ('?invalidparam=x') still doesn't work;
   comment it out so we can get everything passing.

Also, some work on the test framework itself:

 * Cleaner port-open testing (the bash /dev/tcp check).
 * Add a 'podman' function to invoke local podman and
   log its output.

The above two allow us to:

 * Get rid of stderr special-casing

Furthermore:

 * t() no longer needs leading '.'; this allows jq
   features such as 'length' and perhaps other filters
 * special-case handling of 204 and 304: rfc2616 demands
   that they return no message body; assert that it is so.
 * new root & rootless helper functions (check server)
 * remove the "unlikely to work" message for rootless;
   it seems to be working fine
 * fix pod tests for rootless
   * BUT: add a bolder FIXME because the ID field seems wrong

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 14:31:12 -07:00
4bdfeed5bf Merge pull request #5169 from edsantiago/apiv2_pod_status_codes
API v2: pods: fix two incorrect return codes
2020-02-11 22:22:55 +01:00
5b830cca90 apiv2 stream events
the events endpoint should be stream-based.  it also needed to be registered to answer and not produce 404s.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-11 15:00:41 -06:00
d34ce1320c Merge pull request #5083 from vrothberg/v2-libpod-image-endpoints
v2 api: /libpod/images/{import,load,pull}
2020-02-11 21:25:35 +01:00
cbce43a865 Merge pull request #5132 from sujil02/test
Add test cases to validate remove and list images api.
2020-02-11 20:50:28 +01:00
ad4a92c5e5 Fix container filters
container filters were being double encoded (maybe triple) which resulted in the wrong encoding representation of filters being sent by the go-bindings.  Also, on the server side, Filter needed to be changed to Filter to decode properly. Finally, due to the changed return type of List Containers, the go bindings return values needed to be changed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-11 12:42:58 -06:00
bdccdd2265 API v2: pods: fix two incorrect return codes
1) /pods/<X>/exists - is documented to return 204, and that's
    the correct value, but until now it has been returning 200.

 2) /pods/create - return 409 (conflict), not 500, when pod
    already exists

Also: in WriteResponse(), if code is 204 (No Content) or 304
(Not Modified), emit the status code only but no content-type
headers nor content.

Signed-off-by: Ed Santiago <santiago@redhat.com>
2020-02-11 10:50:23 -07:00
86b5a89d1a Merge pull request #5068 from baude/newimagestest
replace prow images test
2020-02-11 17:33:35 +01:00
c705d2cefc Merge pull request #5159 from baude/apiv2cockpit1
Rewire ListContainers for APIv2 libpod
2020-02-11 17:13:33 +01:00
27e42027f0 Merge pull request #5161 from vrothberg/revert-96ab0c64b4e3
container create: relax os/arch checks
2020-02-11 16:03:44 +01:00
ddffc865f3 Rewire ListContainers for APIv2 libpod
consumers of the api remarked how they would prefer a more strongly typed data structure from list containers oon the libpod side of things.  for example, events should be consumable and consistent timestamps.  also, for the sake of compatibility, it is helpful to have the json named atttributes for Id to not be ID.

listcontainers on the libpod side no longer strongly uses the the ps cli to obtain information but we do benefit from turning on the ability to list the last X containers, something CLI does not have yet. we also flipped the bit on defaulting to truncated output in the return.

thanks to the efforts of the cockpit team to help us here.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-11 08:14:28 -06:00
d9fa5af701 Merge pull request #5164 from vrothberg/fix-3878
podman build -f completions
2020-02-11 14:52:39 +01:00
044fc0d783 Merge pull request #5162 from vrothberg/fix-4814
Make: s/uname -o/uname -s/
2020-02-11 14:38:55 +01:00
9e1f6aeef8 podman build -f completions
Also cleanup the code a bit. There's no --runtime flag for build.

Fixes: #3878
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-11 13:42:23 +01:00
13187607e7 swagger: fix /libpod/images/{import,load,pull}
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-11 13:08:23 +01:00
51e0a8b1c3 Make: s/uname -o/uname -s/
uname -o doesn't seem to work on Mac OS.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-11 12:53:42 +01:00
b0abd1c36e container create: relax os/arch checks
Relax the os/arch checks when creating a container and only info-log
mismatches instead of erroring out.  There are too many images used
in the wild which do not set their arch correctly correctly.  Erroring
out has hit users sufficiently enough to justify relaxing the errors
and only log to at least inform the users and image vendors.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-11 09:48:26 +01:00
72dcc45f5a Merge pull request #5156 from mheon/fix_entrypoint_format
Remove incorrect validation of --change for commit
2020-02-11 04:07:18 +01:00
34c9aeaffa Merge pull request #5112 from cevich/only_prune_from_master
Cirrus: Never run prune on other branches
2020-02-11 02:07:09 +01:00
6271837a1d Merge pull request #5137 from mgoltzsche/master
Fix varlink code generation target.
2020-02-11 01:51:52 +01:00
2800323e60 replace prow images test
this is a container-based approach to verifying we can build an rpm based on the contrib spec.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-02-10 18:44:20 -06:00
d68e7d4500 Merge pull request #5155 from TomSweeneyRedHat/coc
Update Code of Conduct to Containers variant
2020-02-11 01:40:09 +01:00
d99f2ee784 Remove incorrect validation of --change for commit
The validation logic was failing on properly-formatted changes.
There's already validation in Commit itself, so no need to
duplicate.

Fixes #5148

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-02-10 16:32:02 -05:00
fc1d67a5f6 [CI:DOCS] Update Code of Conduct to Containers variant
As the title says.  I renamed the old file from the lower case to the
upper case name.  This makes it appear higher up in the listing on GitHub
and also is in line with the rest of the containers projects.  Due to this
change, I also had to change a few references in a couple of build related
files.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2020-02-10 14:01:02 -05:00
f7f7a8cbad Add test cases to validate remove and list images api.
Includes testcase to validate list image api count as we create and delete images
Include testcase to validate remove image api responses with container instance, etc.

Signed-off-by: Sujil02 <sushah@redhat.com>
2020-02-10 12:07:35 -05:00
d64e8b7dd5 bash-completions: Add missing subcommands in 'podman system'
Signed-off-by: Matej Marusak <mmarusak@redhat.com>
2020-02-10 16:31:50 +01:00
6eac49ed1d doc: Fix examples for 'podman system service'
Signed-off-by: Matej Marusak <mmarusak@redhat.com>
2020-02-10 16:26:27 +01:00
e57253d068 Merge pull request #5143 from stefanb2/topic-pr-4477-2
docs: add workaround for --device with rootless containers (II)
2020-02-10 14:52:19 +01:00
5f34b2150b Merge pull request #5122 from mtrmac/image-object-creation
Simplify image object creation
2020-02-10 14:28:40 +01:00
e2a01603f2 Merge pull request #5064 from mheon/pod_network_opts
Add backend code for pod network options
2020-02-10 14:07:04 +01:00
185c82bc80 v2 api: /libpod/images/import
Implement the /libpod/images/import endpoint

Tested manually with curl:
curl -X POST --data-binary "@image.tar" --header "Content-Type: application/x-tar"

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-10 13:18:50 +01:00
926c9f8fbb v2 api: /libpod/images/load
Implement the /libpod/images/load endpoint.

Tested manually with curl:
curl -X POST --data-binary "@image.tar" --header "Content-Type: application/x-tar"

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-10 13:18:48 +01:00
76e2a0c5d3 v2 api: /libpod/images/pull
Implement the /libpod/images/pull endpoint and correct the swagger docs.
The reference parameter is mandatory and must either be a
c/image/docker/reference or a reference to the "docker://" transport as
the pull endpoint is meant to only support pulling images from a
registry.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-02-10 12:36:45 +01:00
20cb169874 docs: add workaround for --device with rootless containers (II)
Update documentation for crun >= 0.11.

See 6df930821d

Fixes #4477

Signed-off-by: Stefan Becker <chemobejk@gmail.com>
2020-02-10 11:19:33 +02:00
c588ae1428 Fix varlink code generation target.
Closes #5130.

varlink code generation was skipped when `uname -o` did not print "GNU/Linux".
However on some Linux systems (e.g. alpine) only "Linux" is printed
which results in cmd/podman/varlink/iopodman.go not being generated.
Thus the Makefile target condition has been changed to match "Linux".

Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
2020-02-09 21:25:59 +01:00