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

Add ingress_port checks #25

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions src/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,31 @@ def is_default(validator, properties, instance, schema):
print(f"::error file={config}::{error.message}")
exit_code = 1

if configuration.get("ingress", False) and configuration.get("webui"):
print(f"::error file={config}::'webui' should be removed, Ingress is enabled.")
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

if (
configuration.get("host_network", False)
and configuration.get("ingress_port", 8099) != 0
):
print(
f"::error file={config}::'ingress_port' this add-on runs on the host network. "
"Ingress port should be set to 0."
)
exit_code = 1

if (
not configuration.get("host_network", False)
and configuration.get("ingress_port", 8099) == 0
):
print(
f"::error file={config}::'ingress_port' this does not run on the host network. "
"In Ingress port doesn't have to be randomized (not 0)."
)
exit_code = 1

if "ports" in configuration and "ports_description" not in configuration:
print(f"::error file={config}::'ports' is defined without 'ports_description'.")
Expand All @@ -71,6 +93,7 @@ def is_default(validator, properties, instance, schema):
print(f"::error file={config}::'ports' and 'ports_description' do not match.")
exit_code = 1

# Checks regarding build.json (if found)
build = path / "build.json"
if build.exists():
with open(build) as fp:
Expand All @@ -85,6 +108,7 @@ def is_default(validator, properties, instance, schema):
print(f"::error file={build}::{error.message}")
exit_code = 1

# Start of additional community checks
if os.environ["INPUT_COMMUNITY"] != "true":
sys.exit(exit_code)

Expand All @@ -100,4 +124,5 @@ def is_default(validator, properties, instance, schema):
print(f"::error file={build}::Architectures in config and build do not match")
exit_code = 1

# All good things, come to an end \o/!
sys.exit(exit_code)