Hacs tries to downgrade component to beta version
See original GitHub issueSystem Health details
System Health
version | core-2021.9.7 |
---|---|
installation_type | Home Assistant Container |
dev | false |
hassio | false |
docker | true |
user | root |
virtualenv | false |
python_version | 3.9.7 |
os_name | Linux |
os_version | 5.4.0-88-generic |
arch | x86_64 |
timezone | Europe/Rome |
Home Assistant Community Store
GitHub API | ok |
---|---|
Github API Calls Remaining | 4747 |
Installed Version | 1.15.2 |
Stage | running |
Available Repositories | 882 |
Installed Repositories | 16 |
Lovelace
dashboards | 6 |
---|---|
resources | 10 |
views | 16 |
mode | storage |
Checklist
- I’m running the newest version of HACS https://github.com/hacs/integration/releases/latest
- I have enabled debug logging for my installation.
- I have filled out the issue template to the best of my ability.
- I have read https://hacs.xyz/docs/issues
- This issue is related to the backend (integration part) of HACS.
- This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
Describe the issue
Hacs informs the user about an update, but in fact it’s a downgrade as you can see in the screenshot.
I started my investigation at the manifest of both version, but they are set correctly. Also the tags are set correctly so it must be a bug in hacs.
During my investigation in the hacs code base (sorry I’m not familiar with the code) I found out, that the function custom_components.hacs.helpers.functions.information.get_releases
is getting the releases via aiogithubapi
.
The returned list from aiogithubapi.objects.repository.AIOGitHubAPIRepository.get_releases
is not sorted correctly by semantic versioning.
On the specific example of “Deebot-for-Home-Assistant” the returned list included the version in the following order:
3.1.4b3
3.1.4b2
3.2.0
3.1.4b1
I think this is the problem as hacs probably checks only the first entry and shows an update notification if the version don’t match. Please correct me if I’m wrong but this is my assumption and I didn’t checked it. (My not familiar with the code and it takes some time to find the correct information)
I had to release a quick bug fix so the update window is showing now the correct version, but if you open the “reinstall” dialog, you can still see that the version are ordered wrong.
Reproduction steps
- Open the install dialog of the integration “Deebot for Home Assistant” and toggle “Show beta versions” 1a. If you have already selected or installed the integration please click on “Update Information” to fetch the latest information
- As you can in the screenshot above the releases are sorted in the wrong order
For Devs:
- Create a breakpoint in
config.custom_components.hacs.helpers.functions.information.get_releases
on Line 79 - Click again on “Update Informations”
- When the debugger stops at the break point, modify the releases variable by sorting the versions correctly
[releases[0], releases[3], releases[1], releases[2], releases[4]]
- Reopen the “reinstall” dialog and you can see that the versions are sorted correctly
Debug logs
2021-10-06 14:41:58 DEBUG (MainThread) [custom_components.hacs] Running update for And3rsL/Deebot-for-Home-Assistant
2021-10-06 14:41:58 DEBUG (MainThread) [custom_components.hacs] <Integration And3rsL/Deebot-for-Home-Assistant> Getting repository information
2021-10-06 14:41:59 DEBUG (MainThread) [custom_components.hacs] <Integration And3rsL/Deebot-for-Home-Assistant> Running checks against 3.2.1
2021-10-06 14:42:00 DEBUG (MainThread) [custom_components.hacs] 'states' is undefined
2021-10-06 14:42:00 DEBUG (MainThread) [custom_components.hacs] Saving data
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Thanks for your help 😊 Than I will follow your release cycle on hacs and only release version on master without betas 😊
As always thanks for all your work here and on HA and a nice release party tonight 😂
Until GitHub adds a sort param to https://docs.github.com/en/rest/reference/repos#list-releases I don’t see that happening. You most likely got in this situation because your releases target 2 different branches.
master
and the now-deletedrefactor-events
, it uses the time from the last commit in the target branch to determine the order.