1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-07 06:44:52 +01:00
Commit Graph

27 Commits

Author SHA1 Message Date
baude
93445eeb24 Atomic integration with kpod images and kpod ps
This allows you to see your images and containers across the
containers-storage backend and runc front-end. For example:

   CONTAINER ID IMAGE                NAME       COMMAND    CREATED          STATE      BACKEND    RUNTIME
   d6e7089cd9bc 15bc1f81701b0f19cacf adoring_bh /bin/true  2017-08-01 08:44 created    docker     docker
   3e8d4ab73739 15bc1f81701b0f19cacf awesome_wi /bin/true  2017-08-01 08:44 created    docker     docker
   061a9ca5d75d microsoft/azure-cli  reverent_e bash       2017-07-13 13:11 exited     docker     docker
   7ec00efa0138 babe9f398328af8bb1f6 dazzling_s /container 2017-07-06 09:07 exited     docker     docker
   2f6139e272fb babe9f398328af8bb1f6 kind_allen /container 2017-07-06 09:07 exited     docker     docker
   foobar       foobar:latest        foobar     /usr/bin/r 2017-08-08 15:04 running    ostree     runc
   foo          foo:latest           foo        /usr/bin/r 2017-08-08 15:16 failed     ostree     runc
   4261d79d6056 docker.io/library/re k8s_podsan ['/bin/sh' 2017-08-28 18:02 running    containers runc

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

Closes: #1084
Approved by: baude
2017-08-30 15:13:39 +00:00
Yu Qi Zhang
14e878dbfc Fix tests for f26
Fix test failures after updating papr to test with f26 atomic/cloud
images instead of f25, with the following changes:

1. Remove dependency on docker hub tester image. Instead, mimic
what ostree/rpm-ostree does and use a recursive .papr.sh script
to install the necessary packages to the base f26 image in the
fedora registry. This fixes tests on the atomic host since python3.6
is being used, and prevents future tests from testing the wrong
version. (Note this is slightly slower due to having to install
packages during the test rather than using a pre-built image).

2. Fix some pylint errors, and mask others for now

3. Fix failing integration tests due to inter-test interference

4. Remove unnecessary deepcopy in container filter

5. Add compatibility for both c-s-s and d-s-s in storage

6. Update expected sha256 values for dockertar test

Remaining issues:

1. test_storage should possibly be reworked. The current test
setup is conflicting with the new default of overlay as a driver.
For now, the test for generated d-s-s is disabled.

2. some storage commands are still using "docker-storage-setup"
instead of "container-storage-setup". There is a backward
compatible check in place that should be reworked in the future

3. some masked pylint errors should be further investigated

4. keep the dockerfile for the project atomic tester image for now
(bump to 26), since its a little easier and faster to set up with

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1076
Approved by: baude
2017-08-23 18:33:48 +00:00
Yu Qi Zhang
62f004c35a Fix tagged images not being displayed
Rework images list and image filtering to display images tagged
with `atomic images tag`. The output now matches `docker images`.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #1017
Approved by: baude
2017-05-31 16:22:55 +00:00
Yu Qi Zhang
7ad2f6371d Fix environment variable not being displayed
'atomic images info' on a system container image was not displaying
the environment variables in the container anymore. This was due to
get_backend_and_image_obj() function decomposing the img_obj.image
to not be the full image name. img_obj.name should be used instead.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #947
Approved by: giuseppe
2017-03-22 05:42:55 +00:00
Brent Baude
1f67164a96 Fix outdated container image message (BZ 1434430)
When running an image with atomic run, if the container already exists,
we were accidently displaying a message stating that the container's
image was old.  This was due to an invalid comparison between the container's
image id and the image's id.  The comparison was failing because we were
comparing two different variables and not the ids.

This was reported in bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1434430

Closes: #945
Approved by: rhatdan
2017-03-21 17:54:06 +00:00
Brent Baude
ce57e8e43d Atomic/update.py: Updating a local image
If the image is built (and updated) locally, we need to handle this
differently than if the image came from a registry.  We now
can try/except our way through things and properly handle.

Closes: #938
Approved by: rhatdan
2017-03-16 13:45:32 +00:00
Brent Baude
4e781bf777 Running command inside running container fails
An exception was being thrown when trying to run a command inside
an already running container.  For example:

sudo atomic run foobar echo true

The problem was a lack of a setter for user_command in the container
object as well as some mishandled string <-> list conversions.

Closes: #938
Approved by: rhatdan
2017-03-16 13:45:32 +00:00
Yu Qi Zhang
ba34cc0275 Fix filtering
Change the format of "Created" for images to match containers,
fix filtering for partial keywords, and update auto-complete
and man pages.

Signed-off-by: Yu Qi Zhang <jerzhang@redhat.com>

Closes: #923
Approved by: giuseppe
2017-03-10 18:02:57 +00:00
Brent Baude
358b97003e Refactor Scan
Refactor scan to use the backends as well as container and
image objects.

Closes: #919
Approved by: giuseppe
2017-02-28 14:47:12 +00:00
Brent Baude
b9b6ff378e Fix FQ Name for SystemContainers
When calling atomic images info --storage ostree <some_image>, the
FQ Name of the image being returned was incorrect.  We now call
Decompose to set the name correctly in the image object.

This was reported as a side issue in https://github.com/projectatomic/atomic/issues/870

Closes: #897
Approved by: rhatdan
2017-02-16 14:55:34 +00:00
Brent Baude
2ebeb1decd Fix run behavior
There were bugs in the run behavior in several scenarios:

* running an image with a command
* running a container that is stopped with and without a command
* running a container that is running with and without a command

Closes: #880
Approved by: rhatdan
2017-02-08 00:38:38 +00:00
Brent Baude
3d2acc23e8 Detect and install systemcontainer images
If an image from a registry has a label like:

    atomic.type=system

the Atomic CLI will now detect that prior to pulling
the image.  It will then switch the backend storage
to ostree.  In the case of install, it will both
pull to ostree and install it.

If the backend is switched, a message informing the user
as such will be shown.

The detection and switch of the backend can be overriden
 with the --storage option.

The following is an example of install:

$ sudo atomic install atomic-registry.usersys.redhat.com:5000/brentbaude/helloworld:latest

Note: Switching from the 'docker' backend to the 'ostree' backend based on the 'atomic.type' label in the image.  You can use --storage to override this behaviour.

Extracting to /var/lib/containers/atomic/helloworld.0
systemctl daemon-reload
systemctl enable helloworld

$ sudo ./atomic images list
   REPOSITORY                                                      TAG      IMAGE ID       CREATED            VIRTUAL SIZE   TYPE
   atomic-registry.usersys.redhat.com:5000/brentbaude/helloworld   latest   0056366e4ebd   2017-02-01 18:04                  ostree

$ sudo ./atomic containers list -a
   CONTAINER ID IMAGE                COMMAND              CREATED          STATE     BACKEND    RUNTIME
   helloworld   atomic-registry.user /usr/bin/run.sh      2017-02-01 18:04 failed    ostree     runc

Closes: #861
Approved by: baude
2017-02-04 17:05:24 +00:00
Brent Baude
b564751c01 Atomic/pull.py: Pull by Digest
Users wish to be able to pull images by digest.  This can be
done by docker and therefore parity is preferred.  The request
is described in https://github.com/projectatomic/atomic/issues/691.

$ atomic pull busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912
Pulling docker.io/busybox@sha256:29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912 ...
Copying blob sha256:56bec22e355981d8ba0878c6c2f23b21f422f30ab0aba188b54f1ffeff59c190
 495.23 KB / 652.49 KB [=========================================>-------------]
Copying config sha256:e02e811dd08fd49e7f6032625495118e63f597eb150403d02e3238af1df240ba
 0 B / 1.43 KB [---------------------------------------------------------------]
Writing manifest to image destination
Storing signatures
 1.43 KB / 1.43 KB [===========================================================]
$ docker images
REPOSITORY                         TAG                                                                IMAGE ID            CREATED             SIZE
docker.io/busybox                  29f5d56d12684887bdfa50dcd29fc31eea4aaf4ad3bec43daf19026a7ce69912   e02e811dd08f        3 months ago        1.093 MB

Note how the tag is populated with the digest.  Docker's default behaviour is
to populate the tag with nothing.  We cannot currently replicate that exactly.

Closes: #856
Approved by: baude
2017-02-01 20:02:00 +00:00
Brent Baude
f79d56bd13 Disconnect backends
Ideally, the atomic CLI should be able to operate independently
of the backends it supports.  For example, if dockerd is inactive,
the ostree backend and atomic cli should still work.

This requires some tweaking to the backendutils code and the work
flow.  We also need to specifically know if the user passes
--storage so that we treat that as an explicit override.  The work
flow is now roughly:

* a default storage can be defined in atomic.conf (was always this way)
* if not defined, defaults to docker.
* if --storage is passed, treat explictly and fail if cannot execute
* if no --storage is specified, use default.  if default is not available, move
 onto the next backend.
2017-01-25 19:07:20 -06:00
Brent Baude
add28f5b40 Leverage skopeo inspect and inspect --raw
Remove discovery code and use skopeo where possible.

Closes: #846
Approved by: jlebon
2017-01-23 19:00:24 +00:00
Brent Baude
00fa7f87c9 Atomic/objects/image.py: V1 Pull regression
In the case where the image is on a V1 registry, the id
will not be available.  If the id is None, we cannot
run the def no_shaw on it because you cannot run str.replace
on something that is None.

Closes: #843
Approved by: rhatdan
2017-01-20 15:11:37 +00:00
Brent Baude
5b6cd0ed8a Atomic/objects/image.py : Fix run when RUN label is present
The RUN label was not being used correctly by Atomic CLI and therefore
resulted in incorrect runargs being used. We should be leaning on using
the cmd and entry points as defined and not mess with those in the
building of the command itself.

This was reported in
issue https://github.com/projectatomic/atomic/issues/838.

Closes: #842
Approved by: rhatdan
2017-01-19 19:59:23 +00:00
Brent Baude
c7aafb3314 Refactor Pull, Update, Install, Run
Refactor several of the atomic verbs and subverbs to take advantage
of object refactoring.

Also, do not pull images with skopeo if the local image is already
at the latest.

$ sudo python ./atomic --debug pull busybox
Namespace(_class=<class 'Atomic.pull.Pull'>, assumeyes=False, debug=True, func='pull_image', image='busybox', reg_type=None, storage='docker')
Latest version of busybox already present.

Closes: #825
Approved by: baude
2017-01-17 22:16:36 +00:00
Brent Baude
1c16902b15 Atomic/objects/image.py: Fix verify for v1
Restructured conditional for obtaining the remote image id
for v1. This fixes a traceback related to verifying v1
images on the rhel registry.

Closes: #814
Approved by: rhatdan
2017-01-06 16:46:14 +00:00
Brent Baude
9f6612a9a2 Refactor atomic stop
Refactoring of atomic stop to use container objects and the new backend
methods.

Closes: #798
Approved by: rhatdan
2016-12-14 15:45:39 +00:00
Giuseppe Scrivano
997a27911a syscontainers: use the image id from the raw manifest
This is the ID used by Docker in "docker images", use the same ID it
so that images stored into OSTree, either from a Docker registry or
from the local Docker engine, have the same ID.

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

Closes: #779
Approved by: rhatdan
2016-12-09 15:29:18 +00:00
Brent Baude
e405c6a048 Refactor containers verb
With the exception of fstrim, the containers verb has now been
refactored.  It primarily now uses the containers object in its
implementation.

Closes: #792
Approved by: rhatdan
2016-12-09 14:05:49 +00:00
Brent Baude
dc30815599 Unify and refactor atomic verify
Using our refactoring model, verify is now streamlined. We no longer
compare base images as that is not currently possible for both
V1 and V2 schemas.

Verify will now always look at the release and version labels for
comparison.  Should those labels not exist, it will use the
manifest digest for ostree; and it will use the image IDs for
docker.

Closes: #785
Approved by: rhatdan
2016-12-07 15:18:22 +00:00
Brent Baude
ef984ed066 Refactor images
Covers all but verify and generate.  This is a refactoring of the
images subverbs (i.e. info, version, delete, ...)

Added in a unittest for list and info.

Closes: #771
Approved by: baude
2016-11-29 21:47:05 +00:00
Brent Baude
16c761447c backends: has image|container return objects
If the has_image|has_container evals to True, then return
the proper object; else None

Add unittest structure for backends/backendutils.py

We want to make sure we have a good backend/backendutils
unittest.  This should simplify unittests for all backends.

refactor.py: Remove the file used to help mini-test the
refactoring work.  It is not needed by upstream and was
only including during the development phases.

Closes: #757
Approved by: baude
2016-11-22 15:38:13 +00:00
Giuseppe Scrivano
35dceef3e1 backends: add skeleton for ostree backend
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

backend: fix pylint issues for ostree backend

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

Add layer object, image object updates, pylint

layer.py: Add layer object
image.py: Add fq name propert, image equality methods, and remote inspection.
backends.py: Begin documentation of common methods
_docker.py: Adding methods: pull, make_remote_image, layers
Full pylint run and cleanups.  Passes all tests.

Closes: #757
Approved by: baude
2016-11-22 15:38:13 +00:00
Brent Baude
5e4ef83304 Add refactoring structure
Atomic/backendutils.py: Class for working with unknown backend
Atomic/objects/image|layer|container.py: classes for objects
Atomic/backends/backend|_docker|_ostree.py: Abstract backends for ostree and docker

Closes: #757
Approved by: baude
2016-11-22 15:38:13 +00:00