[New addon] automatically update addons based on github upstream new releases

Hi all,

I love homeassistant and its addons. I’ve actually created my own repository where both I created my own addons (mostly a shell around linuxserver images), or cloned current addons (with proper reference) when I wanted more updated versions. However, I got frustrated with maintenance so I created an addon to automatically update the addons based on github upstream new releases.

Addon : hassio-addons/addons_updater at master · alexbelgium/hassio-addons (github.com)

How it works :

  • In my repo, the addon version corresponds to the upstream version tag “ex : v1.0.5-ls23”. The dockerfile pulls the image that corresponds to this tag using the $BUILD_VERSION tag. The rest of the build url is described per architecture in the build.json. That way, I only need to update the addon version to update the image from which the addon is built
  • I created an addon that compares the addon version with the latest releases on github. If there is a new version, it updates the “versions” tag in “config.json” then uploads it to github.
  • An automation allows for the addon to run daily and update all configured addons.

The addon configuration :

addon:
  - slug: the exact slug name from your repo
    beta: true/false ; should it look only for releases or also prereleases
    fulltag: true is for example "v3.0.1-ls67" false is "3.0.1" ; depends if you want more frequent updates or not
    repository: 'name/repo' coming from github, example is "alexbelgium/hassio-addons"
    upstream: 'name/repo', example is "linuxserver/docker-emby"
gituser: your github username
gituser: your github email
gitpass: add your github password here, or a specific key if you have two factor identification enabled
gitapi: if you want to make many requests to github, you can set your API key

I’m interested in any other ideas or how to make the code better!

1 Like

Logic update : the addon now pulls the current version from an {upstream} tag that is both in the config.json (manually added) and the Dockerfile. It compares this upstream tag with the latest release of the github from the upstream repo, and updates it if needed. The {version} tag is updated at the same time as the {upstream}, however is not used in the dockerfile. This allows to increment the version without changing the upstream image pulled, in case of need for updates between upstream new releases.

For examples, see in my repo (illustration with nextcloud hassio-addons/nextcloud at master · alexbelgium/hassio-addons · GitHub)

  1. Reference upstream image without version in build.conf
"armhf": "linuxserver/nextcloud:arm32v7-version-",
  1. Add upstream tag in config.json
  "version": "21.0.1",
  "upstream": "21.0.1",
  1. Add upstream tag in dockerfile with ARG exemple
ARG BUILD_UPSTREAM="21.0.1" 
FROM ${BUILD_FROM}${BUILD_UPSTREAM}
  1. Configure the addon options to reference the slug, base repo and upstream repo, whether to use beta versions, and fulltag or not
addon:
  - slug: nextcloud
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-nextcloud
gituser: alexbelgium
gitpass: MYPASS
gitmail: MYMAIL
verbose: 'false'
gitapi: MYAPI
  1. Create an automation to run the addon each night

This allows all my addons in my repo to update daily and always in sync with upstream !

I’m sorry, what does this do again? Update addons from your repo? I feel the language is needlessly obtuse. Also, what’s a github slug? I see the example is for the Nextcloud addon, does this mean we have to manually enter this info for each addon separately?

1 Like

Hi, thanks for your interest!

This addon is a tool for anyone developing addons (me included), to update automatically your github repo containing the addons you are developing when a new version is released of the app contained in your addon.

It verifies the latest release of a github repo, and compare it with the current version of an addon. If the latest release is different than the addon version, it updates the addon code to match version.

Terminology:

  • SLUG is the short name of the addon, as defined in the config.yaml (see HA documentation here)
  • BETA, when true, also includes beta releases when checking upstream versions
  • FULLTAG, when true, fetches the complete upstream version tag (example : v1.2-5dev), when false fetches a simplified version (example: 1.2)
  • Repository: your github repo where addons are stored, you need to have write access
  • Upstream: the github repo to check for releases

Here is my options yaml when running this addon:

addon:
  - slug: bazarr
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-bazarr
  - slug: bitwarden
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: dani-garcia/bitwarden_rs
  - slug: cloudcommander
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: coderaiser/cloudcmd
  - slug: code-server
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-code-server
  - slug: doublecommander
    beta: false
    fulltag: true
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-doublecommander
  - slug: emby
    beta: true
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-emby
  - slug: filebrowser
    beta: true
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: hurlenko/filebrowser-docker
  - slug: flexget
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: flexget/flexget
  - slug: inadyn
    beta: true
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: troglobit/inadyn
  - slug: jackett
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-jackett
  - slug: jellyfin
    beta: false
    fulltag: true
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-jellyfin
  - slug: joal
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: anthonyraymond/joal
  - slug: joplin
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: laurent22/joplin
  - slug: mealie
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: hay-kot/mealie
  - slug: nextcloud
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-nextcloud
  - slug: ombi
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-ombi
  - slug: organizr
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: causefx/organizr
  - slug: papermerge
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-papermerge
  - slug: piwigo
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-piwigo
  - slug: plex
    beta: false
    fulltag: true
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-plex
  - slug: portainer
    beta: false
    fulltag: false
    having_asset: true
    repository: alexbelgium/hassio-addons
    upstream: portainer/portainer
  - slug: prowlarr
    beta: true
    fulltag: true
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-prowlarr
  - slug: qbittorrent
    beta: false
    fulltag: true
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-qbittorrent
  - slug: radarr
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-radarr
  - slug: resiliosync
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-resilio-sync
  - slug: sonarr
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-sonarr
  - slug: transmission
    beta: false
    fulltag: true
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-transmission
  - slug: ubooquity
    beta: false
    fulltag: false
    repository: alexbelgium/hassio-addons
    upstream: linuxserver/docker-ubooquity
gituser: your github username
gitpass: your github password 
gitmail: your github email
verbose: 'false'
gitapi: optional, it is the API key from your github repo

To make sure to be perfectly clear, this is only an helper tool for developers. End users don’t need that to update their addons - they are automatically alerted by HA when an update is available

Oh, right! I was wondering if 3rd-party repos need an extra tool for updates. Not for me then :slight_smile: I was looking at ways to update the Mealie addon from your awesome repo. It’s kinda lagging, the addon has version 0.4.3 and there’s already 0.5.2.

1 Like

Ah… That’s because you’re probably using an armv7 system (like rpi3) : Mealie has stopped supporting armv7! The more recent versions only support armv8 or x64… if you installed the addon on an armv8 or x64 system you would receive the version 0.5.2…

This can be seen here : Docker Hub the Mealie developer stopped providing armv7 images since version 0.4.3…

And thanks for the kind feedback on my repo :slight_smile:

1 Like

It’s a Rpi4, isn’t that ARM8?

It depends which version of HA os you installed 32 or 64 bits… I think both versions can be installed on a rpi4 as can be seen here : Raspberry Pi - Home Assistant

Thanks, it’s probably 32bit IIRC but I haven’t found a way to tell in HassOS. Commands such as lscpu aren’t available.

The easiest way is to check the log of a starting addon. In most addons (at least official, community, and most of my addons) there is an initial text that states how your system is interpreted by HA. another way could be by using the terminal addon

Or in Configuration. > Infos

Yea, the log reports “Machine model: Raspberry Pi 4 Model B Rev 1.1” and “ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d”, so I gather it’s probably 32bit.

1 Like