mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 12:46:32 +00:00
Using ghcr.io/home-assistant + fallback (#2959)
This commit is contained in:
parent
adf355e54f
commit
a4a0b43d91
@ -48,7 +48,7 @@ class AddonBuild(FileConfiguration, CoreSysAttributes):
|
|||||||
def base_image(self) -> str:
|
def base_image(self) -> str:
|
||||||
"""Return base image for this add-on."""
|
"""Return base image for this add-on."""
|
||||||
if not self._data[ATTR_BUILD_FROM]:
|
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
|
# Evaluate correct base image
|
||||||
arch = self.sys_arch.match(list(self._data[ATTR_BUILD_FROM].keys()))
|
arch = self.sys_arch.match(list(self._data[ATTR_BUILD_FROM].keys()))
|
||||||
|
@ -144,7 +144,7 @@ class HomeAssistant(FileConfiguration, CoreSysAttributes):
|
|||||||
"""Return image name of the Home Assistant container."""
|
"""Return image name of the Home Assistant container."""
|
||||||
if self._data.get(ATTR_IMAGE):
|
if self._data.get(ATTR_IMAGE):
|
||||||
return self._data[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
|
@image.setter
|
||||||
def image(self, value: str) -> None:
|
def image(self, value: str) -> None:
|
||||||
|
@ -29,7 +29,7 @@ class PluginBase(ABC, FileConfiguration, CoreSysAttributes):
|
|||||||
"""Return current image of plugin."""
|
"""Return current image of plugin."""
|
||||||
if self._data.get(ATTR_IMAGE):
|
if self._data.get(ATTR_IMAGE):
|
||||||
return self._data[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
|
@image.setter
|
||||||
def image(self, value: str) -> None:
|
def image(self, value: str) -> None:
|
||||||
|
@ -87,7 +87,7 @@ def test_invalid_repository():
|
|||||||
with pytest.raises(vol.Invalid):
|
with pytest.raises(vol.Invalid):
|
||||||
vd.SCHEMA_ADDON_CONFIG(config)
|
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):
|
with pytest.raises(vol.Invalid):
|
||||||
vd.SCHEMA_ADDON_CONFIG(config)
|
vd.SCHEMA_ADDON_CONFIG(config)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ async def mock_async_return_true() -> bool:
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def docker() -> DockerAPI:
|
def docker() -> DockerAPI:
|
||||||
"""Mock 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(
|
with patch("docker.DockerClient", return_value=MagicMock()), patch(
|
||||||
"supervisor.docker.DockerAPI.images", return_value=MagicMock()
|
"supervisor.docker.DockerAPI.images", return_value=MagicMock()
|
||||||
|
4
tests/fixtures/basic-build-config.json
vendored
4
tests/fixtures/basic-build-config.json
vendored
@ -2,10 +2,10 @@
|
|||||||
"build_from": {
|
"build_from": {
|
||||||
"armhf": "mycustom/base-image:latest",
|
"armhf": "mycustom/base-image:latest",
|
||||||
"aarch64": "mycustom/base-image",
|
"aarch64": "mycustom/base-image",
|
||||||
"amd64": "homeassistant/amd64-base-ubuntu:18.04"
|
"amd64": "ghcr.io/home-assistant/amd64-base-ubuntu:18.04"
|
||||||
},
|
},
|
||||||
"squash": false,
|
"squash": false,
|
||||||
"args": {
|
"args": {
|
||||||
"my_build_arg": "xy"
|
"my_build_arg": "xy"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user