From cdcfc35bb5d440e378a8108c0eb8613ca53f25af Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Thu, 26 Nov 2020 19:41:24 +0100 Subject: [PATCH 1/2] Update tests fedora-minimal:26 is no longer available --- conu/backend/docker/utils.py | 2 +- conu/backend/podman/utils.py | 2 +- tests/constants.py | 5 +++-- tests/integration/test_buildah.py | 28 +++++++++++++++++----------- tests/integration/test_docker.py | 13 +++++++------ tests/integration/test_filesystem.py | 14 +++++++------- tests/integration/test_podman.py | 6 +++--- 7 files changed, 39 insertions(+), 31 deletions(-) diff --git a/conu/backend/docker/utils.py b/conu/backend/docker/utils.py index 8e279b58..10b776a3 100644 --- a/conu/backend/docker/utils.py +++ b/conu/backend/docker/utils.py @@ -29,7 +29,7 @@ def inspect_to_metadata(metadata_object, inspect_data): metadata_object.identifier = identifier # format of Environment Variables from docker inspect: - # ['DISTTAG=f26container', 'FGC=f26'] + # ['DISTTAG=f33container', 'FGC=f33'] raw_env_vars = graceful_get(inspect_data, "Config", "Env") or [] if raw_env_vars: metadata_object.env_variables = {} diff --git a/conu/backend/podman/utils.py b/conu/backend/podman/utils.py index 119296fd..8c5e5f15 100644 --- a/conu/backend/podman/utils.py +++ b/conu/backend/podman/utils.py @@ -35,7 +35,7 @@ def inspect_to_metadata(metadata_object, inspect_data): metadata_object.identifier = identifier # format of Environment Variables from podman inspect: - # ['DISTTAG=f26container', 'FGC=f26'] + # ['DISTTAG=f33container', 'FGC=f33'] raw_env_vars = graceful_get(inspect_data, "Config", "Env") or [] if raw_env_vars: metadata_object.env_variables = {} diff --git a/tests/constants.py b/tests/constants.py index 25b6392c..a0b9005b 100644 --- a/tests/constants.py +++ b/tests/constants.py @@ -7,10 +7,11 @@ FEDORA_REPOSITORY = "registry.fedoraproject.org/fedora" FEDORA_MINIMAL_REPOSITORY = "registry.fedoraproject.org/fedora-minimal" -FEDORA_MINIMAL_REPOSITORY_TAG = "26" +FEDORA_MINIMAL_REPOSITORY_TAG = "33" FEDORA_MINIMAL_REPOSITORY_DIGEST = "registry.fedoraproject.org/fedora-minimal@" \ - "sha256:3b5147b65bf7d124b9ded3959b5e44bf392b405be219853dbcc346f8b9c06e88" + "sha256:51ff92dc28e9ef4bbd6400ea1d0845c00c25149bc6902897eeb73b0ad469b7e9" FEDORA_MINIMAL_IMAGE = "{}:{}".format(FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG) +FEDORA_RELEASE = "Fedora release 33 (Thirty Three)\n" S2I_IMAGE = "punchbag" THE_HELPER_IMAGE = "rudolph" diff --git a/tests/integration/test_buildah.py b/tests/integration/test_buildah.py index acb96c06..0e4153a6 100644 --- a/tests/integration/test_buildah.py +++ b/tests/integration/test_buildah.py @@ -10,7 +10,7 @@ from conu.backend.buildah.container import BuildahRunBuilder from conu.backend.buildah.image import BuildahImage, BuildahImagePullPolicy from conu.utils import check_buildah_command_works -from tests.constants import FEDORA_MINIMAL_IMAGE +from tests.constants import FEDORA_MINIMAL_IMAGE, FEDORA_MINIMAL_REPOSITORY_DIGEST from ..constants import FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG @@ -28,7 +28,7 @@ def test_buildah_image(buildah_backend): insp = image.inspect() assert "Config" in insp assert isinstance(insp["Config"], str) - assert "registry.fedoraproject.org/fedora-minimal:26" == str(image) + assert "registry.fedoraproject.org/fedora-minimal:33" == str(image) assert "BuildahImage(repository=%s, tag=%s)" % (FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG) == repr(image) assert isinstance(image.get_id(), string_types) @@ -128,7 +128,7 @@ def test_list_containers(buildah_backend): cont_under_test = [x for x in container_list if x.metadata.name == container_name][0] assert cont_under_test.metadata.image - assert cont_under_test.metadata.image.get_full_name() == FEDORA_MINIMAL_IMAGE + assert cont_under_test.metadata.image.get_full_name() == FEDORA_MINIMAL_REPOSITORY_DIGEST assert cont_under_test.metadata.command finally: c.delete(force=True) @@ -137,7 +137,7 @@ def test_list_containers(buildah_backend): def test_list_images(buildah_backend): image_list = buildah_backend.list_images() assert len(image_list) > 0 - # id of registry.fedoraproject.org/fedora-minimal:26 + # id of registry.fedoraproject.org/fedora-minimal:33 assert isinstance(image_list[0], BuildahImage) assert image_list[0].get_id() assert image_list[0].get_full_name() @@ -149,10 +149,13 @@ def test_image_metadata(buildah_backend): im_metadata = image.get_metadata() assert im_metadata.command == ["/bin/bash"] - assert im_metadata.name == FEDORA_MINIMAL_IMAGE - assert im_metadata.env_variables["FGC"] == "f26" - assert im_metadata.env_variables["DISTTAG"] == "f26container" - assert im_metadata.labels == {} + assert im_metadata.name == FEDORA_MINIMAL_REPOSITORY_DIGEST + assert im_metadata.env_variables["FGC"] == "f33" + assert im_metadata.env_variables["DISTTAG"] == "f33container" + assert im_metadata.labels == {'license': 'MIT', + 'name': 'fedora', + 'vendor': 'Fedora Project', + 'version': '33'} def test_container_metadata(buildah_backend): @@ -169,8 +172,11 @@ def test_container_metadata(buildah_backend): assert container_metadata.command == ["/bin/bash"] assert container_metadata.name == "mycontainer" - assert container_metadata.env_variables["FGC"] == "f26" - assert container_metadata.env_variables["DISTTAG"] == "f26container" - assert container_metadata.labels == {} + assert container_metadata.env_variables["FGC"] == "f33" + assert container_metadata.env_variables["DISTTAG"] == "f33container" + assert container_metadata.labels == {'license': 'MIT', + 'name': 'fedora', + 'vendor': 'Fedora Project', + 'version': '33'} finally: c.delete(force=True) diff --git a/tests/integration/test_docker.py b/tests/integration/test_docker.py index ee213913..0412b746 100644 --- a/tests/integration/test_docker.py +++ b/tests/integration/test_docker.py @@ -17,7 +17,7 @@ from conu.utils import parse_reference from ..constants import FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG, \ - FEDORA_REPOSITORY + FEDORA_REPOSITORY, FEDORA_RELEASE from conu.apidefs.metadata import ContainerStatus from conu.backend.docker.client import get_client @@ -125,8 +125,8 @@ def test_image(): image = backend.ImageClass(FEDORA_MINIMAL_REPOSITORY, tag=FEDORA_MINIMAL_REPOSITORY_TAG) assert "Config" in image.inspect() assert "Config" in image.inspect() - assert "fedora-minimal:26" in image.get_full_name() - assert "registry.fedoraproject.org/fedora-minimal:26" == str(image) + assert "fedora-minimal:33" in image.get_full_name() + assert "registry.fedoraproject.org/fedora-minimal:33" == str(image) assert "DockerImage(repository=%s, tag=%s)" % (FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG) == repr(image) assert isinstance(image.get_id(), string_types) @@ -184,9 +184,9 @@ def test_copy_from(tmpdir): command=["cat"], additional_opts=["-i", "-t"] ) try: - c.copy_from("/etc/fedora-release", str(tmpdir)) + c.copy_from("/usr/lib/fedora-release", str(tmpdir)) with open(os.path.join(str(tmpdir), "fedora-release")) as fd: - assert fd.read() == "Fedora release 26 (Twenty Six)\n" + assert fd.read() == FEDORA_RELEASE c.copy_from("/etc", str(tmpdir)) os.path.exists(os.path.join(str(tmpdir), "passwd")) @@ -456,7 +456,8 @@ def test_list_images(): with DockerBackend() as backend: image_list = backend.list_images() assert len(image_list) > 0 - the_id = "756d8881fb18271a1d55f6ee7e355aaf38fb2973f5fbb0416cf5de628624318b" + # buildah inspect --type image registry.fedoraproject.org/fedora-minimal:33 | grep FromImageID + the_id = "4963469931459d30a6645fcde7df97cd1778e073269304bc9002a56f24a6eb74" image_under_test = [x for x in image_list if x.metadata.identifier == the_id][0] assert image_under_test.metadata.digest assert image_under_test.metadata.repo_digests diff --git a/tests/integration/test_filesystem.py b/tests/integration/test_filesystem.py index 06a6cdc6..53747571 100644 --- a/tests/integration/test_filesystem.py +++ b/tests/integration/test_filesystem.py @@ -11,7 +11,7 @@ from conu.backend.docker.backend import DockerBackend from conu.backend.docker.container import ConuException -from ..constants import FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG +from ..constants import FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG, FEDORA_RELEASE @pytest.fixture() @@ -43,14 +43,14 @@ def test_container_read_file(docker_container): with pytest.raises(ConuException): fs.read_file("/i/lost/my/banana") content = fs.read_file("/etc/system-release") - assert content == "Fedora release 26 (Twenty Six)\n" + assert content == FEDORA_RELEASE def test_container_copy_from(docker_container, tmpdir): with docker_container.mount() as fs: fs.copy_from("/etc/system-release", str(tmpdir)) with open(os.path.join(str(tmpdir), "system-release")) as fd: - assert fd.read() == "Fedora release 26 (Twenty Six)\n" + assert fd.read() == FEDORA_RELEASE tmpdir.mkdir("etc") if six.PY2: @@ -66,7 +66,7 @@ def test_container_get_file(docker_container): f = fs.get_file("/etc/system-release") assert f.fileno() assert "/etc/system-release" in f.name - assert f.read() == "Fedora release 26 (Twenty Six)\n" + assert f.read() == FEDORA_RELEASE f.close() @@ -109,14 +109,14 @@ def test_image_read_file(docker_image): with pytest.raises(ConuException): fs.read_file("/i/lost/my/banana") content = fs.read_file("/etc/system-release") - assert content == "Fedora release 26 (Twenty Six)\n" + assert content == FEDORA_RELEASE def test_image_copy_from(docker_image, tmpdir): with docker_image.mount() as fs: fs.copy_from("/etc/system-release", str(tmpdir)) with open(os.path.join(str(tmpdir), "system-release")) as fd: - assert fd.read() == "Fedora release 26 (Twenty Six)\n" + assert fd.read() == FEDORA_RELEASE tmpdir.mkdir("etc") if six.PY2: @@ -132,7 +132,7 @@ def test_image_get_file(docker_image): f = fs.get_file("/etc/system-release") assert f.fileno() assert "/etc/system-release" in f.name - assert f.read() == "Fedora release 26 (Twenty Six)\n" + assert f.read() == FEDORA_RELEASE f.close() diff --git a/tests/integration/test_podman.py b/tests/integration/test_podman.py index d6d50015..3d82e59c 100644 --- a/tests/integration/test_podman.py +++ b/tests/integration/test_podman.py @@ -51,8 +51,8 @@ def test_podman_image(podman_backend): assert "%s:%s" % (FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG) == image.get_full_name() assert "%s:%s" % (FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG) in image.inspect()['RepoTags'] assert "Config" in image.inspect() - assert "fedora-minimal:26" in image.get_full_name() - assert "registry.fedoraproject.org/fedora-minimal:26" == str(image) + assert "fedora-minimal:33" in image.get_full_name() + assert "registry.fedoraproject.org/fedora-minimal:33" == str(image) assert "PodmanImage(repository=%s, tag=%s)" % (FEDORA_MINIMAL_REPOSITORY, FEDORA_MINIMAL_REPOSITORY_TAG) == repr(image) assert isinstance(image.get_id(), string_types) @@ -321,7 +321,7 @@ def test_list_containers(podman_backend): def test_list_images(podman_backend): image_list = podman_backend.list_images() assert len(image_list) > 0 - # id of registry.fedoraproject.org/fedora-minimal:26 + # id of registry.fedoraproject.org/fedora-minimal:33 the_id = subprocess.check_output(["podman", "inspect", "-f", "{{.Id}}", FEDORA_MINIMAL_REPOSITORY + ":" + FEDORA_MINIMAL_REPOSITORY_TAG]).decode("utf-8").strip() From 234a8a48a2650f122eda773f6ebdbcc522cbac91 Mon Sep 17 00:00:00 2001 From: Release bot Date: Thu, 26 Nov 2020 16:36:58 +0000 Subject: [PATCH 2/2] 1.0.0 release --- CHANGELOG.md | 7 +++++++ conu.spec | 20 ++++++++------------ conu/version.py | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dddc4068..af33f680 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 1.0.0 + +* Conu is now under MIT license +* New buildah backend +* Docker backend supports Skopeo for copying + + # 0.7.1 ## Breaking changes diff --git a/conu.spec b/conu.spec index 71bc89ef..4fe5729e 100644 --- a/conu.spec +++ b/conu.spec @@ -1,15 +1,15 @@ %global pypi_name conu Name: %{pypi_name} -Version: 0.7.1 -Release: 3%{?dist} +Version: 1.0.0 +Release: 1%{?dist} Summary: library which makes it easy to write tests for your containers License: MIT URL: https://github.com/fedora-modularity/conu Source0: https://files.pythonhosted.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch -# exclude ppc64 because there is no docker package +# exclude ppc64 because there is no moby-engine package # https://bugzilla.redhat.com/show_bug.cgi?id=1547049 ExcludeArch: ppc64 @@ -31,14 +31,7 @@ BuildRequires: python3-docker BuildRequires: python3-requests BuildRequires: python3-pyxattr BuildRequires: python3-six -Requires: python3-kubernetes -Requires: python3-docker -Requires: python3-requests -Requires: python3-pyxattr -Requires: python3-six -# this is the only way to create containers right now -Requires: docker -# these are optional but still recommended +Recommends: moby-engine Recommends: source-to-image Recommends: acl Recommends: libselinux-utils @@ -52,7 +45,6 @@ images and provides more, very helpful functions. %package -n python3-%{pypi_name}-pytest Summary: fixtures which can be utilized via pytest %{?python_provide:%python_provide python3-%{pypi_name}-pytest} -Requires: python3-pytest Requires: python3-%{pypi_name} %description -n python3-%{pypi_name}-pytest @@ -98,6 +90,10 @@ rm -rf html/.{doctrees,buildinfo} %license LICENSE %changelog +* Thu Nov 26 2020 Jiri Popelka - 1.0.0-1 +- 1.0.0 release +- removed explicit Requires + * Thu Nov 26 2020 Jiri Popelka - 0.7.1-3 - Change license from GPLv3+ to MIT diff --git a/conu/version.py b/conu/version.py index 7b685854..c41310be 100644 --- a/conu/version.py +++ b/conu/version.py @@ -4,4 +4,4 @@ # SPDX-License-Identifier: MIT # # https://www.python.org/dev/peps/pep-0440/ -__version__ = '0.7.1' +__version__ = '1.0.0'