From 299ec2cf1b9257aa81da9fba8964f6bf231dfd41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20Mr=C3=A1zek?= Date: Fri, 15 Sep 2023 01:22:31 +0200 Subject: [PATCH] manager: ci: validate all config examples --- manager/.gitlab-ci.yml | 9 ++++++++- manager/pyproject.toml | 1 + manager/scripts/examples | 11 +++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 manager/scripts/examples diff --git a/manager/.gitlab-ci.yml b/manager/.gitlab-ci.yml index 60d8b361a..c709e733b 100644 --- a/manager/.gitlab-ci.yml +++ b/manager/.gitlab-ci.yml @@ -12,6 +12,14 @@ default: - linux - amd64 +examples:py3.11: + stage: check + script: + - poetry install --only main,dev + - poe examples + variables: + PYTHON_INTERPRETER: python3.11 + lint:py3.11: stage: check script: @@ -20,7 +28,6 @@ lint:py3.11: variables: PYTHON_INTERPRETER: python3.11 - .unit: &unit stage: check script: diff --git a/manager/pyproject.toml b/manager/pyproject.toml index 03cb2ac7f..e9615b7dc 100644 --- a/manager/pyproject.toml +++ b/manager/pyproject.toml @@ -68,6 +68,7 @@ format = { shell = "black knot_resolver_manager/ tests/ scripts/ build.py; isort fixdeps = { shell = "poetry install; npm install; npm update", help = "Install/update dependencies according to configuration files"} commit = { shell = "scripts/commit", help = "Invoke every single check before commiting" } container = { cmd = "scripts/container.py", help = "Manage containers" } +examples = { cmd = "scripts/examples", help = "Validate all configuration examples" } kresctl = { script = "knot_resolver_manager.cli.main:main", cwd="${POE_PWD}", help="run kresctl" } kresctl-nocwd = { script = "knot_resolver_manager.cli.main:main", help="run kresctl" } # Python <3.8 and poethepoet <0.22.0 compatibility (see also `./poe`) clean = """ diff --git a/manager/scripts/examples b/manager/scripts/examples new file mode 100755 index 000000000..a5de766eb --- /dev/null +++ b/manager/scripts/examples @@ -0,0 +1,11 @@ +#!/bin/bash + +# ensure consistent behaviour +src_dir="$(dirname "$(realpath "$0")")" +source $src_dir/_env.sh + +# validate all configuration examples +for example in $PWD/etc/knot-resolver/config.example.*.yaml; +do + poe kresctl validate --no-strict $example; +done -- 2.47.2