From a4a0b43d911a1a13f8dfa5b455b23a2b3d69acc2 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 14 Jun 2021 20:07:44 +0200 Subject: [PATCH] Using ghcr.io/home-assistant + fallback (#2959) --- supervisor/addons/build.py | 2 +- supervisor/homeassistant/module.py | 2 +- supervisor/plugins/base.py | 2 +- tests/addons/test_config.py | 2 +- tests/conftest.py | 2 +- tests/fixtures/basic-build-config.json | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/supervisor/addons/build.py b/supervisor/addons/build.py index b033b0eeb..58a66885e 100644 --- a/supervisor/addons/build.py +++ b/supervisor/addons/build.py @@ -48,7 +48,7 @@ class AddonBuild(FileConfiguration, CoreSysAttributes): def base_image(self) -> str: """Return base image for this add-on.""" if not self._data[ATTR_BUILD_FROM]: - return f"homeassistant/{self.sys_arch.default}-base:latest" + return f"ghcr.io/home-assistant/{self.sys_arch.default}-base:latest" # Evaluate correct base image arch = self.sys_arch.match(list(self._data[ATTR_BUILD_FROM].keys())) diff --git a/supervisor/homeassistant/module.py b/supervisor/homeassistant/module.py index cd177cf4f..e5e3b8866 100644 --- a/supervisor/homeassistant/module.py +++ b/supervisor/homeassistant/module.py @@ -144,7 +144,7 @@ class HomeAssistant(FileConfiguration, CoreSysAttributes): """Return image name of the Home Assistant container.""" if self._data.get(ATTR_IMAGE): return self._data[ATTR_IMAGE] - return f"homeassistant/{self.sys_machine}-homeassistant" + return f"ghcr.io/home-assistant/{self.sys_machine}-homeassistant" @image.setter def image(self, value: str) -> None: diff --git a/supervisor/plugins/base.py b/supervisor/plugins/base.py index 0eea02d2a..d24618262 100644 --- a/supervisor/plugins/base.py +++ b/supervisor/plugins/base.py @@ -29,7 +29,7 @@ class PluginBase(ABC, FileConfiguration, CoreSysAttributes): """Return current image of plugin.""" if self._data.get(ATTR_IMAGE): return self._data[ATTR_IMAGE] - return f"homeassistant/{self.sys_arch.supervisor}-hassio-{self.slug}" + return f"ghcr.io/home-assistant/{self.sys_arch.supervisor}-hassio-{self.slug}" @image.setter def image(self, value: str) -> None: diff --git a/tests/addons/test_config.py b/tests/addons/test_config.py index 93fc1d969..47635a0db 100644 --- a/tests/addons/test_config.py +++ b/tests/addons/test_config.py @@ -87,7 +87,7 @@ def test_invalid_repository(): with pytest.raises(vol.Invalid): vd.SCHEMA_ADDON_CONFIG(config) - config["image"] = "homeassistant/no-valid-repo:no-tag-allow" + config["image"] = "ghcr.io/home-assistant/no-valid-repo:no-tag-allow" with pytest.raises(vol.Invalid): vd.SCHEMA_ADDON_CONFIG(config) diff --git a/tests/conftest.py b/tests/conftest.py index e863ed970..86baff22a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,7 +34,7 @@ async def mock_async_return_true() -> bool: @pytest.fixture def docker() -> DockerAPI: """Mock DockerAPI.""" - images = [MagicMock(tags=["homeassistant/amd64-hassio-supervisor:latest"])] + images = [MagicMock(tags=["ghcr.io/home-assistant/amd64-hassio-supervisor:latest"])] with patch("docker.DockerClient", return_value=MagicMock()), patch( "supervisor.docker.DockerAPI.images", return_value=MagicMock() diff --git a/tests/fixtures/basic-build-config.json b/tests/fixtures/basic-build-config.json index 9b0cd3b65..392664f9b 100644 --- a/tests/fixtures/basic-build-config.json +++ b/tests/fixtures/basic-build-config.json @@ -2,10 +2,10 @@ "build_from": { "armhf": "mycustom/base-image:latest", "aarch64": "mycustom/base-image", - "amd64": "homeassistant/amd64-base-ubuntu:18.04" + "amd64": "ghcr.io/home-assistant/amd64-base-ubuntu:18.04" }, "squash": false, "args": { "my_build_arg": "xy" } -} \ No newline at end of file +}