From ba80a6ef4e1aa340b846c83055dd9476113b597a Mon Sep 17 00:00:00 2001 From: Robert Gildein Date: Tue, 9 Jan 2024 19:19:09 +0100 Subject: [PATCH] drop bionic support (#27) --- .github/workflows/pr.yaml | 2 +- README.md | 14 +++++++------- charmcraft.yaml | 4 ---- config.yaml | 2 +- requirements.txt | 3 +-- tests/functional/test_charm.py | 22 +++++++++++----------- tests/unit/test_charm.py | 2 +- 7 files changed, 22 insertions(+), 27 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 60d37ad..39ddbd5 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -21,4 +21,4 @@ jobs: python-version-func: "3.10" tox-version: "<4" juju-channel: "3.1/stable" - commands: "['FUNC_ARGS=\"--series bionic\" make functional', 'FUNC_ARGS=\"--series focal\" make functional', 'FUNC_ARGS=\"--series jammy\" make functional']" + commands: "['FUNC_ARGS=\"--series focal\" make functional', 'FUNC_ARGS=\"--series jammy\" make functional']" diff --git a/README.md b/README.md index 6bb4cf4..26d3e09 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ The charm can be deployed using `Juju`: juju deploy apt-mirror ``` -The charm can handle arbitrary set of upstream DEB sources via setting `mirror-list`. Example below shows a bundle with this charm configured to mirror multiple Ubuntu series (Bionic and Focal) in a single repository and expose this repository via NGINX. Additionally PPAs and external repositories can be mirrored. +The charm can handle arbitrary set of upstream DEB sources via setting `mirror-list`. Example below shows a bundle with this charm configured to mirror multiple Ubuntu series (Focal and Jammy) in a single repository and expose this repository via NGINX. Additionally PPAs and external repositories can be mirrored. ``` -series: bionic +series: jammy machines: '0': - series: bionic + series: jammy services: nginx: charm: nginx @@ -34,14 +34,14 @@ services: num_units: 1 options: mirror-list: |- - deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse - deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse - deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse - deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse + deb http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse to: - '0' relations: diff --git a/charmcraft.yaml b/charmcraft.yaml index 1f207cc..94d1210 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -18,7 +18,3 @@ bases: channel: "20.04" architectures: - amd64 - - name: ubuntu - channel: "18.04" - architectures: - - amd64 diff --git a/config.yaml b/config.yaml index 1d3aa1a..2338aa4 100644 --- a/config.yaml +++ b/config.yaml @@ -4,7 +4,7 @@ options: mirror-list: default: |- - deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse description: A list of repositories to mirror. type: string base-path: diff --git a/requirements.txt b/requirements.txt index babecd6..a8bca45 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -# remain compatible with bionic -ops < 2.0 +ops jinja2 diff --git a/tests/functional/test_charm.py b/tests/functional/test_charm.py index c3fc369..c26ab7d 100644 --- a/tests/functional/test_charm.py +++ b/tests/functional/test_charm.py @@ -290,8 +290,8 @@ async def test_unreferenced_packages_config_changed( # Start with 2 mirror lists. mirror_list = """\ -deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main -deb http://ppa.launchpad.net/landscape/19.10/ubuntu bionic main\ +deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main +deb http://ppa.launchpad.net/landscape/self-hosted-23.10/ubuntu jammy main\ """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) @@ -299,7 +299,7 @@ async def test_unreferenced_packages_config_changed( # End up with 1 mirror lists. mirror_list = """\ -deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main +deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) @@ -328,7 +328,7 @@ async def test_unreferenced_packages_config_changed_snapshoted( # Start with 2 mirror lists. mirror_list = """\ deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main -deb http://ppa.launchpad.net/landscape/19.10/ubuntu bionic main\ +deb http://ppa.launchpad.net/landscape/self-hosted-23.10/ubuntu jammy main\ """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) @@ -417,15 +417,15 @@ async def test_outdated_packages_distro_changed( # Start with a test mirror mirror_list = """\ -deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu bionic main +deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) await apt_mirror_unit.run_action("synchronize") - # Upgrade the distro to focal + # Upgrade the distro to Jammy mirror_list = """\ -deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main +deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) @@ -437,17 +437,17 @@ async def test_outdated_packages_distro_changed( count = int(results.get("count")) assert count == 0 - # Let's switch back to bionic and create a snapshot before switching to - # focal. + # Let's switch back to Focal and create a snapshot before switching to + # Jammy. mirror_list = """\ -deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu bionic main +deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) await apt_mirror_unit.run_action("synchronize") await helper.run_action_wait(apt_mirror_unit, "create-snapshot") mirror_list = """\ -deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu focal main +deb https://ppa.launchpadcontent.net/canonical-bootstack/public/ubuntu jammy main """ await apt_mirror_app.set_config({"mirror-list": mirror_list}) await ops_test.model.wait_for_idle(apps=["apt-mirror"]) diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 05d25a8..2b66fdc 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -156,7 +156,7 @@ def test_cron_schedule_remove(self, mock_open_call, os_path_exists, os_unlink): @patch("charm.open", new_callable=mock_open) def test_apt_mirror_list(self, mocked_open): url = "http://archive.ubuntu.com/ubuntu" - opts = "bionic main restricted universe multiverse" + opts = "jammy main restricted universe multiverse" self.harness.update_config({"mirror-list": "deb {} {}".format(url, opts)}) mocked_open.assert_called_with(Path("/etc/apt/mirror.list"), "wb") mocked_open().write.assert_called_once_with(