Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 78 additions & 34 deletions azure-pipelines-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,84 @@ variables:
value: "7.0"
- group: docker

jobs:
- job: "VersionValidate"
pool:
vmImage: "ubuntu-latest"
steps:
- task: UsePythonVersion@0
displayName: "Use Python 3.8"
inputs:
versionSpec: "3.8"

stages:

- stage: 'Validate'
jobs:
- template: templates/azp-job-version.yaml@azure
parameters:
ignoreDev: true

- stage: 'Build'
jobs:
- job: 'ReleaseDocker'
timeoutInMinutes: 240
pool:
vmImage: 'ubuntu-latest'
strategy:
maxParallel: 5
matrix:
amd64:
buildArch: 'amd64'
i386:
buildArch: 'i386'
buildMachine: 'qemux86'
armhf:
buildArch: 'armhf'
armv7:
buildArch: 'armv7'
aarch64:
buildArch: 'aarch64'
steps:
- template: templates/azp-step-su-version.yaml@azure
- script: |
setup_version="$(python setup.py -V)"
branch_version="$(Build.SourceBranchName)"

if [ "${branch_version}" == "dev" ]; then
exit 0
elif [ "${setup_version}" != "${branch_version}" ]; then
echo "Version of tag ${branch_version} don't match with ${setup_version}!"
exit 1
fi
displayName: "Check version of branch/tag"
- job: "Release"
dependsOn:
- "VersionValidate"
pool:
vmImage: "ubuntu-latest"
steps:
- script: sudo docker login -u $(dockerUser) -p $(dockerPassword)
displayName: "Docker hub login"
- script: sudo docker pull homeassistant/amd64-builder:$(versionBuilder)
displayName: "Install Builder"
docker login -u $(dockerUser) -p $(dockerPassword)
displayName: 'Docker hub login'
- script: docker pull homeassistant/amd64-builder:$(versionBuilder)
displayName: 'Install Builder'
- script: |
sudo docker run --rm --privileged \
-v ~/.docker:/root/.docker \
-v /run/docker.sock:/run/docker.sock:rw -v $(pwd):/data:ro \
homeassistant/amd64-builder:$(versionBuilder) \
--generic $(Build.SourceBranchName) --all -t /data
displayName: "Build Release"
-v ~/.docker:/root/.docker \
-v /run/docker.sock:/run/docker.sock:rw -v $(pwd):/data:ro \
homeassistant/amd64-builder:$(versionBuilder) \
--generic $(supervisorRelease) "--$(buildArch)" -t /data
displayName: 'Build Release'

- stage: 'Publish'
jobs:
- job: 'ReleaseHassio'
pool:
vmImage: 'ubuntu-latest'
steps:
- template: templates/azp-step-su-version.yaml@azure
- script: |
sudo apt-get install -y --no-install-recommends \
git jq curl

git config --global user.name "Pascal Vizeli"
git config --global user.email "pvizeli@syshack.ch"
git config --global credential.helper store

echo "https://$(githubToken):x-oauth-basic@github.com" > $HOME/.git-credentials
displayName: 'Install requirements'
- script: |
set -e

version="$(supervisorRelease)"

git clone https://github.com/home-assistant/hassio-version
cd hassio-version

dev_version="$(jq --raw-output '.supervisor' dev.json)"
beta_version="$(jq --raw-output '.supervisor' beta.json)"

if [[ "$version" =~ dev ]]; then
sed -i "s|\"supervisor\": \"$dev_version\"|\"supervisor\": \"$version\"|g" dev.json
else
sed -i "s|\"supervisor\": \"$beta_version\"|\"supervisor\": \"$version\"|g" beta.json
fi

git commit -am "Bump Supervisor $version"
git push
displayName: "Update version files"
10 changes: 10 additions & 0 deletions scripts/dev_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -eE

commit_count="$(git rev-list --count --since=yesterday HEAD)"
calver_date="$(date "+%Y.%m.dev%d")"

calver_version="${setup_version}.dev${calver_date}${commit_count}"

sed -i "s/SUPERVISOR_VERSION .*/SUPERVISOR_VERSION = \"${calver_version}\"/g" supervisor/const.py
echo "$calver_version"
7 changes: 7 additions & 0 deletions supervisor/addons/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ def version(self) -> Optional[str]:
"""Return installed version."""
return self.persist[ATTR_VERSION]

@property
def need_update(self) -> bool:
"""Return True if an update is available."""
if self.is_detached:
return False
return self.version != self.latest_version
Comment thread
ludeeus marked this conversation as resolved.

@property
def dns(self) -> List[str]:
"""Return list of DNS name for that add-on."""
Expand Down
11 changes: 9 additions & 2 deletions supervisor/api/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
ATTR_STATE,
ATTR_STDIN,
ATTR_UDEV,
ATTR_UPDATE_AVAILABLE,
ATTR_URL,
ATTR_USB,
ATTR_VALID,
Expand Down Expand Up @@ -161,8 +162,12 @@ async def list(self, request: web.Request) -> Dict[str, Any]:
ATTR_DESCRIPTON: addon.description,
ATTR_ADVANCED: addon.advanced,
ATTR_STAGE: addon.stage,
ATTR_VERSION: addon.latest_version,
ATTR_INSTALLED: addon.version if addon.is_installed else None,
ATTR_VERSION: addon.version if addon.is_installed else None,
ATTR_VERSION_LATEST: addon.latest_version,
ATTR_UPDATE_AVAILABLE: addon.need_update
if addon.is_installed
else None,
Comment thread
pvizeli marked this conversation as resolved.
Outdated
ATTR_INSTALLED: addon.is_installed,
ATTR_AVAILABLE: addon.available,
ATTR_DETACHED: addon.is_detached,
ATTR_REPOSITORY: addon.repository,
Expand Down Expand Up @@ -209,6 +214,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
ATTR_REPOSITORY: addon.repository,
ATTR_VERSION: None,
ATTR_VERSION_LATEST: addon.latest_version,
ATTR_UPDATE_AVAILABLE: None,
Comment thread
pvizeli marked this conversation as resolved.
Outdated
ATTR_PROTECTED: addon.protected,
ATTR_RATING: rating_security(addon),
ATTR_BOOT: addon.boot,
Expand Down Expand Up @@ -278,6 +284,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
ATTR_AUTO_UPDATE: addon.auto_update,
ATTR_IP_ADDRESS: str(addon.ip_address),
ATTR_VERSION: addon.version,
ATTR_UPDATE_AVAILABLE: addon.need_update,
ATTR_WATCHDOG: addon.watchdog,
}
)
Expand Down
2 changes: 2 additions & 0 deletions supervisor/api/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ATTR_NETWORK_RX,
ATTR_NETWORK_TX,
ATTR_OUTPUT,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_VOLUME,
Expand Down Expand Up @@ -71,6 +72,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
return {
ATTR_VERSION: self.sys_plugins.audio.version,
ATTR_VERSION_LATEST: self.sys_plugins.audio.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_plugins.audio.need_update,
ATTR_HOST: str(self.sys_docker.network.audio),
ATTR_AUDIO: {
ATTR_CARD: [attr.asdict(card) for card in self.sys_host.sound.cards],
Expand Down
2 changes: 2 additions & 0 deletions supervisor/api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ATTR_MEMORY_USAGE,
ATTR_NETWORK_RX,
ATTR_NETWORK_TX,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
)
Expand All @@ -36,6 +37,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
return {
ATTR_VERSION: self.sys_plugins.cli.version,
ATTR_VERSION_LATEST: self.sys_plugins.cli.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_plugins.cli.need_update,
}

@api_process
Expand Down
2 changes: 2 additions & 0 deletions supervisor/api/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
ATTR_NETWORK_RX,
ATTR_NETWORK_TX,
ATTR_SERVERS,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
CONTENT_TYPE_BINARY,
Expand All @@ -44,6 +45,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
return {
ATTR_VERSION: self.sys_plugins.dns.version,
ATTR_VERSION_LATEST: self.sys_plugins.dns.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_plugins.dns.need_update,
ATTR_HOST: str(self.sys_docker.network.dns),
ATTR_SERVERS: self.sys_plugins.dns.servers,
ATTR_LOCALS: self.sys_host.network.dns_servers,
Expand Down
2 changes: 2 additions & 0 deletions supervisor/api/homeassistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ATTR_PORT,
ATTR_REFRESH_TOKEN,
ATTR_SSL,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_WAIT_BOOT,
Expand Down Expand Up @@ -65,6 +66,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
return {
ATTR_VERSION: self.sys_homeassistant.version,
ATTR_VERSION_LATEST: self.sys_homeassistant.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_homeassistant.need_update,
ATTR_MACHINE: self.sys_homeassistant.machine,
ATTR_IP_ADDRESS: str(self.sys_homeassistant.ip_address),
ATTR_ARCH: self.sys_homeassistant.arch,
Expand Down
2 changes: 2 additions & 0 deletions supervisor/api/multicast.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ATTR_MEMORY_USAGE,
ATTR_NETWORK_RX,
ATTR_NETWORK_TX,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
CONTENT_TYPE_BINARY,
Expand All @@ -38,6 +39,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
return {
ATTR_VERSION: self.sys_plugins.multicast.version,
ATTR_VERSION_LATEST: self.sys_plugins.multicast.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_plugins.multicast.need_update,
}

@api_process
Expand Down
2 changes: 2 additions & 0 deletions supervisor/api/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
ATTR_MEMORY_USAGE,
ATTR_NETWORK_RX,
ATTR_NETWORK_TX,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
)
Expand All @@ -38,6 +39,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
ATTR_HOST: str(self.sys_docker.network.observer),
ATTR_VERSION: self.sys_plugins.observer.version,
ATTR_VERSION_LATEST: self.sys_plugins.observer.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_plugins.observer.need_update,
}

@api_process
Expand Down
9 changes: 8 additions & 1 deletion supervisor/api/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
from aiohttp import web
import voluptuous as vol

from ..const import ATTR_BOARD, ATTR_BOOT, ATTR_VERSION, ATTR_VERSION_LATEST
from ..const import (
ATTR_BOARD,
ATTR_BOOT,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
)
from ..coresys import CoreSysAttributes
from ..validate import version_tag
from .utils import api_process, api_validate
Expand All @@ -25,6 +31,7 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
return {
ATTR_VERSION: self.sys_hassos.version,
ATTR_VERSION_LATEST: self.sys_hassos.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_hassos.need_update,
ATTR_BOARD: self.sys_hassos.board,
ATTR_BOOT: self.sys_dbus.rauc.boot_slot,
}
Expand Down
13 changes: 7 additions & 6 deletions supervisor/api/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
ATTR_DIAGNOSTICS,
ATTR_HEALTHY,
ATTR_ICON,
ATTR_INSTALLED,
ATTR_IP_ADDRESS,
ATTR_LOGGING,
ATTR_LOGO,
Expand All @@ -35,11 +34,11 @@
ATTR_STATE,
ATTR_SUPPORTED,
ATTR_TIMEZONE,
ATTR_UPDATE_AVAILABLE,
ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_WAIT_BOOT,
CONTENT_TYPE_BINARY,
SUPERVISOR_VERSION,
LogLevel,
UpdateChannel,
)
Expand Down Expand Up @@ -87,17 +86,19 @@ async def info(self, request: web.Request) -> Dict[str, Any]:
ATTR_SLUG: addon.slug,
ATTR_DESCRIPTON: addon.description,
ATTR_STATE: addon.state,
ATTR_VERSION: addon.latest_version,
ATTR_INSTALLED: addon.version,
ATTR_VERSION: addon.version,
ATTR_VERSION_LATEST: addon.latest_version,
ATTR_UPDATE_AVAILABLE: addon.need_update,
ATTR_REPOSITORY: addon.repository,
ATTR_ICON: addon.with_icon,
ATTR_LOGO: addon.with_logo,
}
)

return {
ATTR_VERSION: SUPERVISOR_VERSION,
ATTR_VERSION_LATEST: self.sys_updater.version_supervisor,
ATTR_VERSION: self.sys_supervisor.version,
ATTR_VERSION_LATEST: self.sys_supervisor.latest_version,
ATTR_UPDATE_AVAILABLE: self.sys_supervisor.need_update,
ATTR_CHANNEL: self.sys_updater.channel,
ATTR_ARCH: self.sys_supervisor.arch,
ATTR_SUPPORTED: self.sys_core.supported,
Expand Down
3 changes: 1 addition & 2 deletions supervisor/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .auth import Auth
from .const import (
ENV_HOMEASSISTANT_REPOSITORY,
ENV_SUPERVISOR_DEV,
ENV_SUPERVISOR_MACHINE,
ENV_SUPERVISOR_NAME,
ENV_SUPERVISOR_SHARE,
Expand Down Expand Up @@ -180,7 +179,7 @@ def initialize_system_data(coresys: CoreSys) -> None:
coresys.config.modify_log_level()

# Check if ENV is in development mode
if bool(os.environ.get(ENV_SUPERVISOR_DEV, 0)):
if coresys.dev:
_LOGGER.warning("Environment variables 'SUPERVISOR_DEV' is set")
coresys.updater.channel = UpdateChannel.DEV
coresys.config.logging = LogLevel.DEBUG
Expand Down
3 changes: 2 additions & 1 deletion supervisor/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ipaddress import ip_network
from pathlib import Path

SUPERVISOR_VERSION = "250"
SUPERVISOR_VERSION = "2020.10.0"

URL_HASSIO_ADDONS = "https://github.com/home-assistant/hassio-addons"
URL_HASSIO_APPARMOR = "https://version.home-assistant.io/apparmor.txt"
Expand Down Expand Up @@ -280,6 +280,7 @@
ATTR_WATCHDOG = "watchdog"
ATTR_WEBUI = "webui"
ATTR_OBSERVER = "observer"
ATTR_UPDATE_AVAILABLE = "update_available"

PROVIDE_SERVICE = "provide"
NEED_SERVICE = "need"
Expand Down
9 changes: 0 additions & 9 deletions supervisor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,6 @@ async def connect(self):
# Check supervisor version/update
if self.sys_dev:
self.sys_config.version = self.sys_supervisor.version
elif (
Comment thread
ludeeus marked this conversation as resolved.
self.sys_config.version == "dev"
or self.sys_supervisor.instance.version == "dev"
):
self.healthy = False
_LOGGER.warning(
"Found a development Supervisor outside dev channel (%s)",
self.sys_updater.channel,
)
elif self.sys_config.version != self.sys_supervisor.version:
self.sys_resolution.create_issue(
IssueType.UPDATE_ROLLBACK, ContextType.SUPERVISOR
Expand Down
Loading