Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refuses to build locally from specific images due to faulty regular expression #219

Closed
frenck opened this issue Oct 15, 2017 · 3 comments
Closed

Comments

@frenck
Copy link
Member

frenck commented Oct 15, 2017

Problem/Motivation

Hassio local build seems to have a faulty regular expression in place, responsible for validating build_from images. This causes troubles with building an add-on locally within Hass.io/Home Assistant.

Example from a local build that fails:

�[31m17-10-15 19:09:27 ERROR (SyncWorker_6) [hassio.tools] Can't parse /data/addons/local/addon-example/example/build.json -> does not match regular expression for dictionary value @ data['build_from']['aarch64']. Got 'hassioaddons/base-aarch64:1.0.0'
does not match regular expression for dictionary value @ data['build_from']['amd64']. Got 'hassioaddons/base-amd64:1.0.0'
does not match regular expression for dictionary value @ data['build_from']['armhf']. Got 'hassioaddons/base-armhf:1.0.0'
does not match regular expression for dictionary value @ data['build_from']['i386']. Got 'hassioaddons/base-i386:1.0.0'�[0m

In the above case hassioaddons/base-aarch64:1.0.0 is not accepted as a valid container name, while it is. I've been able to reproduce it with other containers as well, like alpine:3.6.

Currently used regular expression: ^[\-\w{}]+/[\-\w{}]+:[\-\w{}]+$
Demo with missing matches: http://regexr.com/3gve8

Proposed changes

Change the Voluptuous build config schema to allows for these images.

Change the regular expression to: ^([\-\w{}]+/)?[\-\w{}]+:[\-\.\w{}]+$
Tests over here: https://regexr.com/3gve2

@frenck
Copy link
Member Author

frenck commented Oct 16, 2017

Some examples:

# Should not match, `-` is not allowed in vendor (not sure if this is a Docker Hub limitation)
home-assistant/base:latest

# These all match perfectly
homeassistant/base:latest
homeassistant/base:latest

# These don't match, but should
homeassistant/base-test:1.0.0
homeassistant/base-test:1.0
homeassistant/base:1.0.0
homeassistant/base:1.0
alpine:3.6

@frenck
Copy link
Member Author

frenck commented Oct 18, 2017

Fixed in Supervisor v0.72.
Works like a charm, thx @pvizeli

@frenck frenck closed this as completed Oct 18, 2017
@MitschiBoy
Copy link

This problem is not fixed for the key "image".

WARNING (MainThread) [hassio.store.data] Can't read /data/addons/local/my-addon/config.json: does not match regular expression for dictionary value @ data['image']. Got 'dockeruser/nice-app-1.2'

Current used regular expression: ^[\w{}]+/[\-\w{}]+$
It should be: ^[\w{}]+/[\-\.\w{}]+$

  • This matches:

    dockeruser/nice-app

  • This does not match, but should:

    dockeruser/nice-app-1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants