Skip to content

Commit

Permalink
Add linting against new mapping changes (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Nov 10, 2023
1 parent fa2b20f commit 2c8dad9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
},
"map": {
"items": {
"pattern": "^(config|ssl|addons|backup|share|media)(:(rw|ro))?$"
"pattern": "^(addon_config|all_addon_configs|config|homeassistant_config|ssl|addons|backup|share|media)(:(rw|ro))?$"
},
"type": "array"
},
Expand Down
17 changes: 15 additions & 2 deletions src/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def is_default(validator, properties, instance, schema):
exit_code = 1

if configuration.get("ingress", False):

if configuration.get("webui"):
print(f"::error file={config}::'webui' should be removed, Ingress is enabled.")
exit_code = 1
Expand Down Expand Up @@ -125,6 +124,16 @@ def is_default(validator, properties, instance, schema):
)
exit_code = 1

if configuration.get("map") and (
"config" in configuration["map"]
or "config:rw" in configuration["map"]
or "config:ro" in configuration["map"]
):
print(
f"::warning file={config}::'map' contains the 'config' folder, which has been replaced by 'homeassistant_config'. See: https://developers.home-assistant.io/blog/2023/11/06/public-addon-config"
)


# Checks regarding build file(if found)
for file_type in ("json", "yaml", "yml"):
build = path / f"build.{file_type}"
Expand Down Expand Up @@ -159,7 +168,11 @@ def is_default(validator, properties, instance, schema):
print(f"::error file={build}::The build.json file is missing")
sys.exit(1)

if "build_from" in build_configuration and not isinstance(build_configuration["build_from"], str) and set(configuration["arch"]) != set(build_configuration["build_from"]):
if (
"build_from" in build_configuration
and not isinstance(build_configuration["build_from"], str)
and set(configuration["arch"]) != set(build_configuration["build_from"])
):
print(f"::error file={build}::Architectures in config and build do not match")
exit_code = 1

Expand Down

0 comments on commit 2c8dad9

Please sign in to comment.