42 Commits

Author SHA1 Message Date
72f1617fac Bump Go module to v5
Moving from Go module v4 to v5 prepares us for public releases.

Move done using gomove [1] as with the v3 and v4 moves.

[1] https://github.com/KSubedi/gomove

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-08 09:35:39 -05:00
2a2d0b0e18 chore: delete obsolete // +build lines
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-04 11:53:38 +02:00
ae9b63fbf0 Check for imageID, not imageName
We are only using imageID on that branch, so it is
more consistent.

Should not change behavior; in callers, either
both are set or neither.

[NO NEW TESTS NEEDED]

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-11-20 19:06:44 +01:00
ff80e40adf Use NewStoreReference instead of ParseStoreReference
By construction, imageID is a full image ID, so avoid heuristics
by using a more specific API.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-11-20 18:26:38 +01:00
e9587f5e37 Don't re-assign imageID
By construction in callers, imageID is always a full ID,
so this assignment is always a no-op.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-11-20 18:24:28 +01:00
c850682208 Remove clearly dead code
Should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2023-11-20 16:57:28 +01:00
aefa9abf4b image: replace GetStoreImage with ResolveReference
GetStoreImage is deprecated after containers/image#2056

Signed-off-by: Aditya R <arajan@redhat.com>
2023-11-02 11:22:02 +05:30
bad25da92e libpod: add !remote tag
This should never be pulled into the remote client.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-10-24 12:11:34 +02:00
e4aad8f0f4 libpod.storageService.CreateContainerStorage(): retrieve ID maps
When creating storage for a container using ID maps, read the ID maps
that are assigned to the container from the returned container
structure, rather than from the options structure that we passed to the
storage library, which it previously modified in error.

[NO NEW TESTS NEEDED]

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-04-05 17:58:30 -04:00
251d91699d libpod: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

[NO NEW TESTS NEEDED]

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-07-05 16:06:32 +02:00
bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
c9ea2cae1e Storage can remove ErrNotAContainer as well
Fixes: https://github.com/containers/podman/issues/11775

[NO TESTS NEEDED] No easy way to cause this problem in CI.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-29 10:12:49 -04:00
1c4e6d8624 standardize logrus messages to upper case
Remove ERROR: Error stutter from logrus messages also.

[ NO TESTS NEEDED] This is just code cleanup.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-22 15:29:34 -04:00
d0d084dd8c turn hidden --trace into a NOP
The --trace has helped in early stages analyze Podman code.  However,
it's contributing to dependency and binary bloat.  The standard go
tooling can also help in profiling, so let's turn `--trace` into a NOP.

[NO TESTS NEEDED]

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-03-08 09:22:42 +01:00
5dded6fae7 bump go module to v3
We missed bumping the go module, so let's do it now :)

* Automated go code with github.com/sirkon/go-imports-rename
* Manually via `vgrep podman/v2` the rest

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-22 09:03:51 +01:00
a5e37ad280 Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
4b784b377c Remove all instances of named return "err" from Libpod
This was inspired by https://github.com/cri-o/cri-o/pull/3934 and
much of the logic for it is contained there. However, in brief,
a named return called "err" can cause lots of code confusion and
encourages using the wrong err variable in defer statements,
which can make them work incorrectly. Using a separate name which
is not used elsewhere makes it very clear what the defer should
be doing.

As part of this, remove a large number of named returns that were
not used anywhere. Most of them were once needed, but are no
longer necessary after previous refactors (but were accidentally
retained).

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-09 13:54:47 -04:00
8489dc4345 move go module to v2
With the advent of Podman 2.0.0 we crossed the magical barrier of go
modules.  While we were able to continue importing all packages inside
of the project, the project could not be vendored anymore from the
outside.

Move the go module to new major version and change all imports to
`github.com/containers/libpod/v2`.  The renaming of the imports
was done via `gomove` [1].

[1] https://github.com/KSubedi/gomove

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 15:50:12 +02:00
200cfa41a4 Turn on More linters
- misspell
    - prealloc
    - unparam
    - nakedret

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-15 07:05:56 -04:00
3a0a727110 userns: support --userns=auto
automatically pick an empty range and create an user namespace for the
container.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-06 16:32:36 +02:00
593eb7625a golangci: enable goimports
Enable the goimports linter and fix reports.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-05 20:03:44 +01:00
a4a70b4506 bump containers/image to v5.0.0, buildah to v1.11.4
Move to containers/image v5 and containers/buildah to v1.11.4.

Replace an equality check with a type assertion when checking for a
docker.ErrUnauthorizedForCredentials in `podman login`.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-10-29 13:35:18 -04:00
d3f59bedb3 Update c/image to v4.0.1 and buildah to 1.11.3
This requires updating all import paths throughout, and a matching
buildah update to interoperate.

I can't figure out the reason for go.mod tracking
	github.com/containers/image v3.0.2+incompatible // indirect
((go mod graph) lists it as a direct dependency of libpod, but
(go list -json -m all) lists it as an indirect dependency),
but at least looking at the vendor subdirectory, it doesn't seem
to be actually used in the built binaries.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2019-10-04 20:18:23 +02:00
dd81a44ccf remove libpod from main
the compilation demands of having libpod in main is a burden for the
remote client compilations.  to combat this, we should move the use of
libpod structs, vars, constants, and functions into the adapter code
where it will only be compiled by the local client.

this should result in cleaner code organization and smaller binaries. it
should also help if we ever need to compile the remote client on
non-Linux operating systems natively (not cross-compiled).

Signed-off-by: baude <bbaude@redhat.com>
2019-06-25 13:51:24 -05:00
7141f97270 OpenTracing support added to start, stop, run, create, pull, and ps
Drop context.Context field from cli.Context

Signed-off-by: Sebastian Jug <sejug@redhat.com>
2019-02-18 09:57:08 -05:00
167d50a9fa Move all libpod/ JSON references over to jsoniter
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-01-10 15:48:09 -05:00
a95d71f113 Allow containers/storage to handle on SELinux labeling
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-23 10:57:23 -04:00
8e1ef558eb Add --force to podman umount to force the unmounting of the rootfs
podman umount will currently only unmount file system if not other
process is using it, otherwise the umount decrements the container
storage to indicate that the caller is no longer using the mount
point, once the count gets to 0, the file system is actually unmounted.

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

Closes: #1184
Approved by: TomSweeneyRedHat
2018-08-01 17:53:30 +00:00
3c5ce9b8bf Update container Mounted() and Mountpoint() functions
Addresses a regression in `podman mount` due to our mount changes
to allow concurrency by letting c/storage handle mounting and
unmounting.

Combine Mounted() and Mountpoint() into one function and query
c/storage directly to ensure we get accurate information.

Fixes: #1143

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #1144
Approved by: baude
2018-07-24 02:25:11 +00:00
85db3f09bf Let containers/storage keep track of mounts
Currently we unmount storage that is still in use.
We should not be unmounting storeage that we mounted
via a different command or by podman mount. This
change relies on containers/storage to umount keep track of
how many times the storage was mounted before really unmounting
it from the system.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-07-19 17:01:07 -04:00
98703eb204 Vendor in latest code for storage,image, buildah
vendor in containers/storage
vendor in containers/image
vendor in projectatomic/buildah

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

Closes: #1114
Approved by: mheon
2018-07-19 18:43:32 +00:00
1d9e884232 We are using err in defer function, needs to be defined name
Since we are checking if err is non nil in defer function we need
to define it, so that the check will work correctly.

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

Closes: #985
Approved by: mheon
2018-06-22 13:43:19 +00:00
7bdfb4f9b3 podman: accept option --rootfs to use exploded images
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #871
Approved by: mheon
2018-06-15 14:53:18 +00:00
b51d737998 Begin wiring in USERNS Support into podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #690
Approved by: mheon
2018-05-04 17:15:55 +00:00
ab7e2a6956 Store user Volumes, Entrypoint, Command in database
We need these for commit, and they cannot be properly deduced
from just the OCI spec, so save them in the database so we can
retrieve them for commit.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #700
Approved by: rhatdan
2018-05-03 12:23:12 +00:00
27107fdac1 Vendor in latest containers/image and contaners/storage
Made necessary changes to functions to include contex.Context wherever needed

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

Closes: #640
Approved by: baude
2018-04-19 14:08:47 +00:00
6f51a5b2f9 Force host UID/GID mapping when creating containers
Until we can handle running containers which use UID/GID mappings, make
sure that we always create containers that use the host mappings.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #609
Approved by: baude
2018-04-12 15:24:46 +00:00
48811d539e Don't return an ImageConfig when creating storage
We don't use it directly, we aren't going to cache it in the DB,
and when we do use it (image volumes) we might well be in a
different process (podman create -> podman start). No point in
keeping it around.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #571
Approved by: rhatdan
2018-04-02 14:22:57 +00:00
fd79671d05 CreateContainerStorage by image id
When creating container storage by name, if that name is a tagged image then the storage
could not be found.  We now use the image id which seems more reliable. Also added an
integration test to protect against regression.

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

Closes: #393
Approved by: mheon
2018-02-23 17:44:28 +00:00
00d38cb379 podman create/run need to load information from the image
We should be pulling information out of the image to set the
defaults to use when setting up the container.

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

Closes: #110
Approved by: mheon
2018-01-03 12:38:18 +00:00
8cf07b2ad1 libpod create and run
patched version of the same code that went into crio

Signed-off-by: baude <bbaude@redhat.com>
2017-11-01 14:19:19 -05:00
a031b83a09 Initial checkin from CRI-O repo
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-01 11:24:59 -04:00