Commit graph

1602 commits

Author SHA1 Message Date
Jhon Honce 47620961fe Port to MacOS
* Refactor Tunnel to support selecting port for remote sshd
* Refactor ssh tunnel to support MacOS version of ssh
* Refactor Tunnel.close() to find and kill off zombie siblings
* Add psutil dependency
* Add logging setup, letting library produce debugging records
* Clean up Tunnel API
* Fix test_runner.sh to propagate returncode to caller

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

Closes: #1199
Approved by: rhatdan
2018-08-05 11:06:18 +00:00
baude a1e3e542ff Make one runtime for the varlink service
Rather than making a runtime each time a client hits a varlink endpoint, we now
make a single runtime when the varlink service starts up.  This fixes a problem
where we hit a max inotify limit from CNI.

Resolves: #1211

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

Closes: #1215
Approved by: rhatdan
2018-08-05 10:43:32 +00:00
Matthew Heon debf23c72a
Merge pull request #1213 from mheon/bump-0.8.1
Bump to 0.8.1
2018-08-03 14:47:08 -04:00
Matthew Heon 650a199b1f Bump gitvalidation epoch
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-08-03 14:46:15 -04:00
Matthew Heon 11264dabda Bump to v0.8.2-dev
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-08-03 14:46:15 -04:00
Matthew Heon 6b4ab2a2b4 Bump to v0.8.1
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-08-03 14:46:11 -04:00
Daniel J Walsh 7462ebe830 Vendor in latest github.com/projectatomic/buildah
This adds support for Dockerfile.in and fixes some limits
issues on docker build

Also adds support for podman build to read Dockerfile from stdin.

cat Dockerfile | podman build -f - .

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

Closes: #1209
Approved by: mheon
2018-08-03 14:39:07 +00:00
Matthew Heon a83f54e9c7 Update gitvalidation epoch
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #1210
Approved by: rhatdan
2018-08-03 14:31:55 +00:00
Anders F Björklund 71af51e723 Check for missing arguments in /proc/self/cmdline
Closes: #1206
Approved by: giuseppe
2018-08-03 07:39:25 +00:00
haircommander 26b9b17d27 Added ps --pod option
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1205
Approved by: rhatdan
2018-08-02 20:39:06 +00:00
baude 20155657ec clarify pull error message
when pulling, we can fail to find an image (i.e. it doesn't exist) or we
can not have authority/access to pull it.  the registries don't tell us
one way or another so the error message needs to cover both.

Resolves #1194

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

Closes: #1195
Approved by: rhatdan
2018-08-02 19:53:50 +00:00
Giuseppe Scrivano 13b1845214 rootless: do not set setgroups to deny when using newuidmap
It is required only when directly configuring the user namespace.

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

Closes: #1200
Approved by: rhatdan
2018-08-02 18:49:55 +00:00
Daniel J Walsh 9f2da6f59f
Merge pull request #1201 from giuseppe/fix-segfault-rootless
rootless: do not segfault if the parent already died
2018-08-02 14:42:39 -04:00
Daniel J Walsh d55445d77f
Merge pull request #1202 from rhatdan/man
Man page fixes found by https://pagure.io/ManualPageScan
2018-08-02 14:41:59 -04:00
Daniel J Walsh 995ab8391d
Man page fixes found by https://pagure.io/ManualPageScan
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-08-02 09:21:43 -04:00
Miloslav Trmač 126a97af82 Inline pullGoalNamesFromPossiblyUnqualifiedName into Runtime.pullGoalFromPossibly...
Again, we only needed them split for tests; so, integrate them back.
Then drop all remaining references to pullRefName and pullGoalNames,
which are not used for anything.

Should not change behavior

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1198
Approved by: mheon
2018-08-02 13:17:17 +00:00
Miloslav Trmač 5334d9ab5e Replace getPullRefName by Runtime.getPullRefPair
This more or less reverts 9c9401a96c
"Replace getPullRefPair with getPullRefName"; now that tests don't require
us to use pullRefName, move creation of storage references deeper into the
calls stack to reduce string use.

ir.getSinglePullRefNameGoal is accordingly updated to ir.getSinglePullRefPairGoal,
and we need to add a ~duplicate singlePullRefPairGoal; that duplication
of singlePullRefNameGoal will soon be resolved by dropping singlePullRefNameGoal.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1198
Approved by: mheon
2018-08-02 13:17:17 +00:00
Miloslav Trmač 682076e58f Inline pullGoalNamesFromImageReference back into Runtime.pullGoalFromImageReference
Now that we don't need a separate pullGoalNamesFromImageReference for
running tests, inline it back.

This forces us to add some glue code to getSinglePullRefNameGoal
and to convert between pullGoal and *pullGoal; that is temporary
and will be cleaned up soon.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1198
Approved by: mheon
2018-08-02 13:17:17 +00:00
Miloslav Trmač 4cf9308bf2 Introduce getSinglePullRefNameGoal
This merely wraps the
> return singlePullRefNameGoal(getPullRefName(... reference)), nil
pattern which is used for almost all getPullRefName uses.  For now
it seems not really worth it, but it will result in shorter code
(and smaller migration) after we replace getPullRefName with
getPullRefPair, which can fail, again - the pullGoalNamesFromImageReference
will not have to add any error handling.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1198
Approved by: mheon
2018-08-02 13:17:17 +00:00
Miloslav Trmač 48763b14ae Test Runtime.pullGoalFromPossiblyUnqualifiedName instead of pullGoalNameFrom...
Similarly to pullGoalNamesFromImageReference, use a storage.Store and
test the actually created references; that is more representative,
and clearly shows the impact of further normalization in
storageReference (like defaulting to :latest on NameOnly references).

Only modifies tests, so does not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1198
Approved by: mheon
2018-08-02 13:17:17 +00:00
Miloslav Trmač be101dee8a Test Runtime.pullGoalFromImageReference instead of pullGoalNamesFromImageReference
pullGoalNamesFromImageReference has been added only to allow testing without
a storage.Store, because I thought that a storage.Store can only be created
by root.

It turns out that non-root stores, at least good enough for reference
parsing and formatting, are possible (and have existed in c/image/storage
tests), so this creates such a store, and modifies the existing
test to test the created c/image/storage.storageReference values
instead of strings; that is more representative, and clearly shows
the impact of further normalization in storageReference (like
defaulting to :latest on NameOnly references).

Eventually we will want to get rid of pullGoalNames / pullRefName.

Only modifies tests, so does not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1198
Approved by: mheon
2018-08-02 13:17:17 +00:00
baude a6de23278a Use REGISTRIES_CONFIG_PATH for all tests
We should not be using the test systems registries.conf file for integration
tests. We should always use a constructed file created specifically for the
integration tests or we stand to have unpredictable results.  The beforeTest
function now sets an environment variable pointing to a registries.conf file
in the test's tempdir.  That file will container docker.io as a default.

The afterTest function then clears the environment variable.

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

Closes: #1197
Approved by: rhatdan
2018-08-02 12:40:14 +00:00
Giuseppe Scrivano c7b6403ae5
rootless: do not segfault if the parent already died
Closes: https://github.com/projectatomic/libpod/issues/1189

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-08-02 14:29:50 +02:00
Miloslav Trmač 3d1449b2cc RFC: Rename runtime.pullImage to runtime.pullImageFromHeuristicSource
This is similar to the PushImageToHeuristicDestination RFC.

The goal is to be very explicit about which functions try to heuristically
guess what is the expected format of the string.  Not quite "shaming"
the users, but making sure they stand out.

RFC:
- Is this at all acceptable? Desirable?

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 1c2d245c47 Introduce Runtime.pullImageFromReference, call it in Runtime.FromImageReference
FINALLY, (podman load) can pass through an ImageReference directly from
loadCmd all the way to pullGoalNamesFromImageReference, making sure not
to trigger the docker-like reference parsing heuristics.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 0d4a5549d6 RFC: Remove unused transport name constants from libpod
They are not used anywhere in the packagee.

Two of the values still have users in the CLI, but used only once.
So, use the .Transport.Name() calls in there directly, that is
likely to be cheaper (and makes the files depend directly
on the transports instead of referring to them indirectly through
libpod).

RFC: Should not change behavior in _this_ repo, but it is an
externally-observable API change. Is there any user that could
notice?

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 5507f15ba5 Replace Runtime.LoadFromArchive with Runtime.LoadFromArchiveReference
All callers of LoadFromArchive expect the input to be in the
transport:name format, or create it that way.  So, pass a
types.ImageReference instead of a string.

That requires us to add an explicit parse step in (podman pull);
in (podman load) we can, instead of pasting strings, create
native objects directly.

Changes the error behavior of (podman pull), we no longer
try heuristically parsing docker-archive:... inputs as
Docker references.

Also changes the string reported by (podman load) if all parsing
attempts fail, to be only the path instead of dir:path.  The error
message itself is likely to be the same (from directory.Transport).

(While at it, update a mismatched comment.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 04f3a9079c Rename the "image" variable to "imageName"
... so that it does not shadow the libpod/image module.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 85cb582f86 Fix the heuristic for docker-archive: sources in (podman pull)
Instead of searching for "docker-archive" anywhere in the input,
only accept it at the start, and require the colon separator as well.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 558a1bd776 Split doPullImage from pullImage
Now that we have a pullGoal, separate determination of the goal from
performing it; we will then introduce another entry point with
a supplied types.ImageReference.

Also remove or correct some misleading comments.

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 7f5efd8d04 Remove the forceCompress parameter from getCopyOptions and DRO.GetSystemContext
Use the parent types.SystemContext data instead.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač b63b84ea5e Remove the authFile parameter from getCopyOptions and DRO.GetSystemContext
Use the parent types.SystemContext data instead.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 444142c7c1 Remove the signaturePolicyPath parameter from getCopyOptions and DRO.GetSystemContext
Use the parent types.SystemContext data instead.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 1054b8d2c5 Add a *types.SystemContext parameter to getCopyOptions and DRO.GetSystemContext
All callers of getCopyOptions also call GetSystemContext with the same three parameters;
we will want to simplify this by passing the first SystemContext to getCopyOptions,
which can then inherit this data instead of so many parameters everywhere.

For now, just add a *types.SystemContext parameter without using it.

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 2d5410d349 Move pullImage from Image to Runtime
pullImage (now) only uses Image.InputName; it is really used to _create_
an Image object, based on the pull results (as is most visible in the
LoadFromArchive caller), so it should not be a method on it.

This also simplifies a bit the number of different kids of uses of
Image.InputName; still apparently not enough to clearly document
the field, though.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač dbe2395769 Do not re-parse the list of search registries just for an error message
... when we even only count them.

This eliminates a rare error case, and saves time re-reading and re-parsing
the input.

(We still compute registryPath redundantly, and it may get out of sync.)

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 8d73e45663 Eliminate duplicate determination whether to use search registries
Instead of duplicating the hasRegistry logic, just record whether we
did use search or not.

Should not change behavior (but does not add unit tests for all of it).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 5eac0740c3 Eliminate the "DockerArchive means pull all refPairs" special case
Instead, encode it explicitly in pullGoal.pullAllPairs.

Should not change behavior (but does not add unit tests for
all of it).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 86491efea0 Introduce struct pullGoalNames
This is an intermediate version of pullGoal, which exists basically
only for easier testing without containers-storage: (i.e. root access)
in unit tests.

Like pullGoal, we will add more members to make it useful in the future.

RFC: Unlike pullGoal, the return value is *pullGoalNames, because there are
quite a few (return nil, err) cases which would be more difficult to read
when returning a value.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač fadb143399 Introduce struct pullGoal
The eventual goal is to cleanly capture semantics like "pull all images
for DockerArchive" and "did a search through $registries" without
hard-coding it through; and to allow a pullImage variant where
the caller can pass an imageReference directly.

For now, this just wraps []pullRefPair and should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač bf0ab88eac Use []pullRefPair instead of []*pullRefPair
We are passing the values, don't really need the pointer sharing semantics,
and the structures are small enough, and the arrays short enough,
that we very likely lose on the indirect accesses more than we save on
quicker copying of the slices when extending them.  Value semantics
is safer anyway.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač dae6200662 Use []pullRefName instead of []*pullRefName
We are passing the values, don't really need the pointer sharing semantics,
and the structures are small enough, and the arrays short enough,
that we very likely lose on the indirect accesses more than we save on
quicker copying of the slices when extending them.  Value semantics
is safer anyway.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 83f40de965 Introduce singlePullRefNameGoal
All but two cases returning a []*pullRefName only return a single
item.  Introduce a helper for that case, which seems not
worth it now, but the return value will get a bit more complex
and introducing the helper now will minimize code changes in future
commits.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 1efbc40999 Use an early return from refNamesFromPossiblyUnqualifiedName
We will introduce helpers for the "single image" case, and having a separate
return statement will make them applicable here.

(Also allows us to reduce the scope of some variables a bit.)

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 4dab4d97de RFC: Rename Image.PushImage to Image.PushImageToHeuristicDestination
The goal is to be very explicit about which functions try to heuristically
guess what is the expected format of the string.  Not quite "shaming"
the users, but making sure they stand out.

RFC:
- Is this at all acceptable? Desirable?
- varlink ExportImage says "destination must have transport type";
  should it be using alltransports.ParseImageReference
  + PushImageToReference, then?

(While touching the call in cmd/podman, also remove a commented-out
older version of the call.)

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 86fb1bf8eb Remove an unnecessary use of alltransports.ParseImageName
When the string is formatted including a constant transport name,
just call the transport to create or parse a reference explicitly.

This avoids unnecessary string formatting and parsing.

Then drop image.TarballTransport, which has no remaining users.

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 90abdfdff5 RFC? Hard-code "format" string values instead of using libpod.* transport names
We don't really want to change the names of the CLI options just because
the transport names change (with oci-dir/docker-dir there is no
direct correspondence wanyway), and this removes a dependency.

Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač a5c1cecbea Use PushImageToReference for (podman save)
To do that, create the relevant ImageReference values directly
by calling ParseReference/NewReference from the relevant transport
subpackages instead of formatting strings to be parsed (and
heuristically re-parsed) by PushImage.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 754fc8e8ec Call imageNameForSaveDestination while creating the references
Instead of creating a reference string and then checking it again
to see which kind of archive it is, just call
imageNameForSaveDestination at the place where we already know
what kind of archive it is because we are making that decision.

This also notably fixes the use of strings.CONTAINS to see
whether the just constructed strings start with one of the
transport names; that would match anywhere in the
path.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00
Miloslav Trmač 18c4e2c835 Exit early in the simple case in imageNameForSaveDestination
... to make it a tiny bit easier to read.

Should not change behavior (but does not add unit tests).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>

Closes: #1176
Approved by: rhatdan
2018-08-01 18:22:59 +00:00