Unable to update new version of customized addon

helllo guys, I’ve customized an addon and hosted on Docker hub. It works well and able to update new version some months ago.

By the way, recently when I updated new image on Docker hub as well as the the config.json of the addon’s configuration, it is unable to update new version of my addon. I got the following error on the supervisor’s log:

22-09-27 21:16:29 INFO (SyncWorker_5) [supervisor.docker.interface] Updating image javishome/zigbee2mqtt1272:1.27.2-1 to javishome/zigbee2mqtt1272:1.27.2-6
22-09-27 21:16:29 INFO (SyncWorker_5) [supervisor.docker.interface] Downloading docker image javishome/zigbee2mqtt1272 with tag 1.27.2-6.
22-09-27 21:16:40 INFO (MainThread) [supervisor.addons] Add-on '284bc3ff_zigbee2mqtt1272' successfully updated
22-09-27 21:16:40 INFO (SyncWorker_4) [supervisor.docker.interface] Cleanup images: ['javishome/zigbee2mqtt1272:1.27.2-6']
22-09-27 21:16:40 INFO (SyncWorker_4) [supervisor.docker.interface] Cleanup images: ['javishome/zigbee2mqtt1272:1.27.2-3', 'javishome/zigbee2mqtt1272:latest']

As the sample above, the current version of is javishome/zigbee2mqtt1272 is 1.27.2-1 and the newest version is 1.27.2-6.
As the log above, during the time of updating new version, the image javishome/zigbee2mqtt1272:1.27.2-6 already downloaded but after that, it is cleanup immediately.

I already tried to pull the image javishome/zigbee2mqtt1272:1.27.2-6 manually and it works well.

So the reason this happened to you is because the io.hass.version label is wrong in your image. Here’s what I see when I inspect it:

            "Labels": {
                "io.hass.arch": "aarch64",
                "io.hass.base.arch": "aarch64",
                "io.hass.base.image": "arm64v8/alpine:3.16",
                "io.hass.base.name": "alpine",
                "io.hass.base.version": "2022.08.0",
                "io.hass.description": "Use your ZigBee devices without the vendors bridge or gateway",
                "io.hass.name": "Zigbee2MQTT",
                "io.hass.type": "addon",
                "io.hass.url": "https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/tree/master/zigbee2mqtt",
                "io.hass.version": "1.27.2-1",
                "org.opencontainers.image.created": "2022-09-01 09:29:31+00:00",
                "org.opencontainers.image.source": "https://github.com/home-assistant/docker-base",
                "org.opencontainers.image.version": "1.27.2-1"
            },

I’m guessing you forked z2m and didn’t change the dockerfile? Or at least not that part. That breaks it because supervisor looks at this label a lot. In this case the particular issue is when trying to clean up the old image after installing the new one it assumes javishome/zigbee2mqtt1272:1.27.2-1 is the current image it needs to keep rather then javishome/zigbee2mqtt1272:1.27.2-6 due to this label.

I’m not actually sure why it does this tbh. I put in a PR to change it:

Currently “legacy” addons exclusively look at the version in the configuration file whereas non-legacy addons only look at that version for install and then look at this label post install. Seems better to me to always rely on the version in the config file but I don’t know the reason for that switch.

For now the way to fix your addon is to set that label correctly to match the version in your config file.

2 Likes

Actually small update, my PR was merged and now shipped in the current beta (2022.09.2). So if you want to try it again after installing the beta you should see it working correctly now.

Thank you for very quick support. I will try to use new beta version to check again and report you result soon.

I made the customized Dockerfile based on the z2m image as below:

FROM zigbee2mqtt/zigbee2mqtt-aarch64:1.27.2-1
COPY freepad_ext.js /
COPY /devices/* /app/node_modules/zigbee-herdsman-converters/devices/
COPY run.sh /etc/cont-init.d

Here is the main part in the config.json file:

{
  "name": "Zigbee2mqtt1272",
  "version": "1.27.2-6",
  "slug": "zigbee2mqtt1272",
  "description": "Zigbee2mqtt add-on",
  "uart": true,
  "url": "https://github.com/zigbee2mqtt/hassio-zigbee2mqtt#installation",
  "startup": "application",
  "services": [
    "mqtt:need"
  ],
  "arch": [
    "aarch64"
  ],
/// some other config here
  "image": "javishome/zigbee2mqtt1272"
}

Yea that explains it. Since you have FROM hard coded I’m guessing you aren’t using home assistant builder to make the images you’re publishing to docker hub. Which means io.hass.version and the other standard addon labels aren’t being set for you and you have to set them yourselves like it says here:

Right now your image is inheriting those labels as they have been set in the z2m image which is incorrect for your addon.

1 Like

I confirm 2022.09.2 works well and I can update new addon version successfully.

1 Like