1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-05 18:45:01 +01:00

277 Commits

Author SHA1 Message Date
Giuseppe Scrivano
6ce51fd4ec tests: skip system containers test if skopeo copy to ostree fails
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1244
Approved by: rhatdan
2018-06-27 13:19:55 +00:00
Giuseppe Scrivano
5a342e32cd docker: restore uninstall when no container name is specified
write_install does not write twice the same container id/name.

Closes: https://github.com/projectatomic/atomic/issues/1217

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

Closes: #1219
Approved by: rhatdan
2018-06-11 18:50:58 +00:00
Giuseppe Scrivano
b9d4ef7a07 tests: skip test_storage.sh if there are no extents available
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1227
Approved by: jlebon
2018-04-18 12:21:20 +00:00
Giuseppe Scrivano
ba23e76924 install: support multiple containers per image
Change the install data format to keep a list of containers for each
image installed, so that multiple containers for the same image can be
installed and uninstalled.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1559935

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

Closes: #1214
Approved by: baude
2018-03-27 13:06:11 +00:00
Giuseppe Scrivano
ab5453da97 dockertar-sha256-helper: drop it
it is not used anymore as we completely moved the pull logic to Skopeo.

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

Closes: #1215
Approved by: baude
2018-03-24 15:46:55 +00:00
Eldar Yusupov
21c11ebdc6 syscontainers: use util.Decompose in _parse_imagename
It also fixes an issue with incorrectly parsing postgres:9.6
as (postgres:9.6, postgres, 9:6).

Closes: #1206
Approved by: giuseppe
2018-03-13 10:44:22 +00:00
Ruixin Bao
c1676437b2 test: add pull test to verify skopeo
Add 3 cases to verify skopeo pulling from docker to ostree works.

The 3 cases include the following:
1: pull dockertar into ostree (custom name)
2: pull dockertar into ostree (default name)
3: pull docker image into ostree(e.g: docker:image:latest)

Also added a small change to ensure checkout are existant if
no installation of containers happens prior.

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Ruixin Bao
0fc987e8c2 test/syscontainer: relax the virtual size check between images
Before, we used the ostree copy, and the size difference between the
docker image and ostree image is minimal. However, the skopeo way
has a different way of handling image size, making the ostree image has
noticeable size difference compared to the docker image.

Therefore, to make the test pass, we will have a relaxed threshold for
virtual size difference. Since we only have the test check against one
image, we first leave the percent difference to be 4%.

Closes: #1180
Approved by: giuseppe
2018-03-02 15:21:32 +00:00
Giuseppe Scrivano
ca5d43a5fe syscontainers: rebase pulls the image when missing
atomic containers update --rebase=$TO $CONTAINER attempts to pull the
image if it is missing in the repository.

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

Closes: #1198
Approved by: rhatdan
2018-02-27 11:33:31 +00:00
Giuseppe Scrivano
df2c209c27 run: add option --runtime
it allows to select a different OCI runtime to use with atomic run.

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

Closes: #1196
Approved by: rhatdan
2018-02-23 15:15:05 +00:00
Giuseppe Scrivano
3161e59011 syscontainers: implement "atomic run IMAGE"
if we try "atomic run IMAGE" then the command creates a "oneshot"
container, modifies the args for the config.json file and it runs the
specified command.

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

Closes: #1186
Approved by: baude
2018-02-19 16:03:47 +00:00
Giuseppe Scrivano
279d4d4bb3 syscontainers: correctly setup the rootfs SELinux label
The files inside the container are labelled by Skopeo when the image is
pulled to the OSTree storage.

Instead the root directory is created by atomic and by default it gets
the label "unconfined_u:object_r:container_share_t:s0".

Make sure we label the rootfs with the same label of '/'.

We have changed the way files are labelled by Skopeo but we forgot to
change the label for the rootfs created by atomic.  This patch ensures
the SELinux label for the rootfs is set.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1544175

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

Closes: #1185
Approved by: cgwalters
2018-02-15 08:36:09 +00:00
Ruixin Bao
594ce2a1ae unit: add test for encode_to_ostree_ref
Add a unit test to verify that it is not possible for
an image to be hex after encoding, and a tag "latest" will
be appended if the image does not have a valid tag.

Closes: #1181
Approved by: giuseppe
2018-02-14 17:49:37 +00:00
Giuseppe Scrivano
f1d36a2126 syscontainers: allow the container name to end in .[01]
We skipped file names just based on their ending without checking if
it is a symlink.  This prevented container with a name ending in .0 or
.1 to be uninstalled.

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

Closes: #1166
Approved by: peterbaouoft
2018-02-01 09:46:58 +00:00
Ruixin Bao
6e55cc8e6b unit: add unit test for rpm_host_install
A unit test for rm_add_files_to_host is added. The basic/expected
functionality of that function is tested by the new test

Other functions in rpm_host_install are mostly covered
by the integration test already, and thus not tested here

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
deb87057c5 unit: add unit test for refactored 'system_package' function
A 'high-level' unit test is added that covers basic functionality
check for refactored function '_handle_system_package_files'.

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
dfb54df58c syscontainer/unit: refactor writing info into a function
This commit refactors the writing info part from 'do_checkout'
into a function.

Also, because of the above action, two of the local variables
'installed_files_template' and 'rename_files' are also removed

Other than those, an extra error case was added to the except list.

A unit test is added for future regression

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
c25101e7db syscontainers/unit: refactor rename files part
This commit refactors the "rename file value substitution" code
section in '_do_checkout' function

There should not be any functional impact with this commit

A unit test is added for future regression

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Ruixin Bao
676ad7cb5f syscontainer: refactor tmpfile cleanup and manifest
This commit contains small refactoring of getting manifest
attributes and refactoring of the "tempfile cleaning during
upgrade" code section in '_do_checkout'

Also, 'has_container_service' local variable is genereated in the
function instead of being passed in as a parameter. This is done
because in the future refactoring we might want to elminate the
usage of local variables related to manifest completly.

A unit test is added to verify getting manifest attribute works
as expected

Closes: #1155
Approved by: giuseppe
2018-01-31 14:45:14 +00:00
Giuseppe Scrivano
5fcc8051db tests, syscontainers: add tests for useLinks
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1163
Approved by: peterbaouoft
2018-01-25 14:33:37 +00:00
Ruixin Bao
c41a3c55b2 syscontainers: refactoring duplicated write config function
This commit contains refactoring for write config in '_do_checkout' function,
this refactoring also removes the duplication of writing config in 'run_once'

There should not be functional impact with this commit.

A unit test is added for future regression

Closes: #1160
Approved by: giuseppe
2018-01-17 09:21:09 +00:00
Tomas Tomecek
7179eab364 add support for mounting overlay objects live
using bind-mount

Fixes #1153

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>

Closes: #1156
Approved by: rhatdan
2018-01-10 19:12:47 +00:00
Giuseppe Scrivano
9218fe0516 containers, update: add --all option
If specified, tries to update all the installed containers.

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

Closes: #1136
Approved by: baude
2018-01-04 15:46:33 +00:00
Ruixin Bao
78340b47c7 syscontainers: refactor handling rootfs into a function
In _do_checkout, we refactor the part for getting rootfs location
into a function.

A todo comment( refactoring 'missing image layer check') is also added
in this commit based on discussions on irc

A unit test is added for future regression

Closes: #1154
Approved by: giuseppe
2018-01-04 15:35:16 +00:00
Ruixin Bao
340a172108 syscontainer: make '_get_remote_location' into static method
This is regression from https://github.com/projectatomic/atomic/pull/1152.

It appears that 'self' is no longer used when '_resolve_remote_path' is moved into
'_get_remote_location'. Thus, '_get_remote_location' is made to be static

Closes: #1154
Approved by: giuseppe
2018-01-04 15:35:16 +00:00
Ruixin Bao
64cc86e7ca syscontainer/unit: add test to test remote refactoring
Made a new class to track all the refactored functions' unit tests
(for future usage)

Added a unit test to test the functionality of the factored out
_get_remote_location function.

Closes: #1152
Approved by: giuseppe
2018-01-03 12:36:16 +00:00
Giuseppe Scrivano
3241b63f67 tests: check copied files have the correct SELinux label
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1143
Approved by: rhatdan
2017-12-18 16:31:48 +00:00
Giuseppe Scrivano
df5dfa9b84 syscontainers: drop check for bwrap-oci
Since we allow to customize the runtime to use, there is no hard
requirement for bwrap-oci anymore.

Also add the same check for system containers, let's error immediately
if the specified runtime is not present.

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

Closes: #1141
Approved by: baude
2017-12-15 14:35:27 +00:00
Giuseppe Scrivano
0ce66a038d syscontainers: do not delete modified files with --system-package=no
Store the checksum of files copied to the host, so that on an update or
an uninstall we can skip the files that have a mismatch in the
checksum.

This reflects in the --system-package=no case what the rpm backend
already does.

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

Closes: #1131
Approved by: ashcrow
2017-11-27 16:36:34 +00:00
Giuseppe Scrivano
0999b88404 mount: drop prefixes from the ostree image
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1127
Approved by: ashcrow
2017-11-14 15:40:58 +00:00
Giuseppe Scrivano
e78ecdd216 install: add new option --runtime=PATH to choose the OCI runtime
it is supported by system and user containers.

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

Closes: #1125
Approved by: TomSweeneyRedHat
2017-11-14 10:27:00 +00:00
Giuseppe Scrivano
c4c3f83242 syscontainers: introduce ALL_PROCESS_CAPABILITIES
it can be used by privileged containers to add all the capabilities
known to the host.  It prevents hard coding the list in the
config.json.template file so that the same image can be used on
different kernel versions where there can be different capabilities
supported.

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

Closes: #1119
Approved by: ashcrow
2017-10-26 13:38:40 +00:00
Giuseppe Scrivano
25a5a15a31 util.py: add function for retrieving the known proc capabilities
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1119
Approved by: ashcrow
2017-10-26 13:38:40 +00:00
Jonathan Lebon
a955fb8a6d tests/storage: check for grep failure
Split the pipeline in two so that we check that there's something to
unmount before doing it. This is needed now because the new CI
infrastructure provisions a true uninitialized block device that doesn't
need to be unmounted, so the `grep` would fail (because of the
`pipefail` option). Previously, `/dev/vdb` was actually itself a
pre-formatted ext4 partition and thus was automounted.

This should now catch both the old CI style (in case local developers
were mirroring that setup), as well as more conventional partitioning
schemes.

I dropped the `-r` since we *know* at that point that there is at least
one entry to unmount.

Closes: #1106
Approved by: rhatdan
2017-10-12 14:26:37 +00:00
Giuseppe Scrivano
47478024dc syscontainers: create empty directories in the .rpm case
We already do this when copying directly to the host.

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

Closes: #1104
Approved by: ashcrow
2017-09-25 20:25:46 +00:00
Steve Milner
3fb193345b test: Basic unittest for SystemContainers._get_skopeo_args
Signed-off-by: Steve Milner <smilner@redhat.com>

Closes: #1096
Approved by: giuseppe
2017-09-09 09:17:06 +00:00
Steve Milner
6e1aee7db8 tests: unit tests for system containers container_exec
Closes: #1075
Approved by: ashcrow
2017-08-29 07:11:54 +00:00
Giuseppe Scrivano
4a5de16cdc tests: integration tests for 'run' with system containers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1075
Approved by: ashcrow
2017-08-29 07:11:54 +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
Giuseppe Scrivano
35f7b5202b syscontainers: fix copy to host of symlinks
copy2 fails when the source file is a broken symlink.  If we are trying
to copy a symlink, read where it points to and create a new symlink.

More information here:
https://github.com/openshift/openshift-ansible/pull/4898#issuecomment-318734884

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

Closes: #1058
Approved by: baude
2017-08-23 07:33:22 +00:00
baude
64843d3e84 Fix Python3 issues for F26
Several tests failed (as reported in issues #1057) on Fedora 26.

Closes: #1060
Approved by: rhatdan
2017-08-07 17:45:45 +00:00
Giuseppe Scrivano
f3c6b8bb74 uninstall: inhibit UNINSTALL if there are running containers
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1456451

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

Closes: #1050
Approved by: rhatdan
2017-07-18 21:48:46 +00:00
Petr Kubat
62cae10482 tests: add test for table preprocessing
Signed-off-by: Petr Kubat <pkubat@redhat.com>

Closes: #1044
Approved by: giuseppe
2017-07-13 09:55:48 +00:00
Giuseppe Scrivano
890d0e779b test_system_containers_images.sh: make test clearer
move the filter inside the Python script since the
"images -f" can include other results and make the comparison fail only
if the difference between the two sizes is > 1%.

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

Closes: #1047
Approved by: TomasTomecek
2017-07-13 08:14:14 +00:00
Brent Baude
2c9aae9873 Atomic/containers.py: Add NAME field to container list
Issue #1021 requested we add the NAME field to the containers list command,
so that debugging container failures would be easier.

Closes: #1024
Approved by: baude
2017-06-29 18:35:25 +00:00
Steve Milner
640fccc1b8 test: Update unit test template
This change adds documentation areas and the pylint skip used in the
other tests.

Closes: #1009
Approved by: giuseppe
2017-06-29 08:11:14 +00:00
Steve Milner
ee5e246d7a test: Add test for atomic.conf validation
The atomic.conf file is now tested to validate it is valid YAML. The two
cases checked are:

- The file contents in it's shipped state
- The file contents with examples uncommented

An example has no space between the hash and the start of the example:

    #example: value

While a comment is expected to have a space:

    # I am a comment

Closes: #1009
Approved by: giuseppe
2017-06-29 08:11:14 +00:00
Brent Baude
69f6d52370 Atomic/install.py: Don't write the install data if the install fails
A bug was reported in issue #1022 where if the atomic install data failed,
the installation data was still written allowing the user to proceed
with an atomic run.

Disabling test_install.sh until i can follow up with Thomas.

Closes: #1025
Approved by: baude
2017-06-21 20:09:14 +00:00
Ruixin Bao
a33431fb68 Fix the _mark_used function to identify image as being used
When image is being referenced by a container,
_mark_used function should mark image as being
used if the image id is found inside the information of
containers.

In this case, the image id for containers should be
referenced as container.image instead of container.id

Some tests are added for future regression.

Closes: #1030
Approved by: baude
2017-06-20 16:33:52 +00:00
Giuseppe Scrivano
91f1e1621d tests: check virtual size is correct for syscontainers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #1029
Approved by: baude
2017-06-14 16:51:23 +00:00