Skip to content

Commit

Permalink
drop bionic support (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgildein authored Jan 9, 2024
1 parent e67bf70 commit ba80a6e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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']"
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ bases:
channel: "20.04"
architectures:
- amd64
- name: ubuntu
channel: "18.04"
architectures:
- amd64
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# remain compatible with bionic
ops < 2.0
ops
jinja2
22 changes: 11 additions & 11 deletions tests/functional/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,16 @@ 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"])
await apt_mirror_unit.run_action("synchronize")

# 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"])
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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"])
Expand All @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ba80a6e

Please sign in to comment.