]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
.gitlab-ci.yml: added python:migrate
authorAleš Mrázek <ales.mrazek@nic.cz>
Thu, 22 May 2025 12:57:42 +0000 (14:57 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Tue, 5 Aug 2025 09:23:53 +0000 (11:23 +0200)
scripts/po-tasks/migrate task added to migrate and validate configuration using kresctl

.gitlab-ci.yml
etc/config/config.migrate-test.yaml [moved from etc/config/config.migrate.yaml with 89% similarity]
etc/config/config.migrate-test2.yaml [new file with mode: 0644]
pyproject.toml
scripts/poe-tasks/check
scripts/poe-tasks/migrate [new file with mode: 0755]

index 16917bb11cfd4d4a81aa662dd2b5147723a266b8..a69fe33d8d8c5acb030fc8784658db23f8dfb0d2 100644 (file)
@@ -857,6 +857,12 @@ python:examples:
     - poetry install --all-extras --only main,dev
     - poe examples
 
+python:migrate:
+  <<: *python
+  script:
+    - poetry install --all-extras --only main,dev
+    - poe migrate
+
 python:check:
   <<: *python
   script:
similarity index 89%
rename from etc/config/config.migrate.yaml
rename to etc/config/config.migrate-test.yaml
index 9cd490fe0fdf19c18ca8917217fde1b62fb4bab9..ccb1fadb8f1572c7e08c5bcce6670db7374f334c 100644 (file)
@@ -1,14 +1,10 @@
-
 cache:
-  # garbage-collector: false
   garbage-collector:
     interval: 2s
 
-# dns64: true
 dns64:
   rev-ttl: 1d
 
-# dnssec: false
 dnssec:
   refresh-time: 10m
   hold-down-time: 30d
@@ -32,7 +28,7 @@ logging:
     assertion-fork: 5m
 
 monitoring:
-  # graphite: false
+  enabled: always
   graphite:
     host: 127.0.0.1
 
diff --git a/etc/config/config.migrate-test2.yaml b/etc/config/config.migrate-test2.yaml
new file mode 100644 (file)
index 0000000..2b309be
--- /dev/null
@@ -0,0 +1,10 @@
+
+cache:
+  garbage-collector: false
+
+dns64: true
+
+dnssec: false
+
+monitoring:
+  graphite: false
index 6bd77adc68b505b550d4cbd0e8ab0640c0269dbe..673de37eba62f19d210befc5be3bca8fc459a174 100644 (file)
@@ -84,6 +84,7 @@ gen-setuppy = { cmd = "scripts/poe-tasks/gen-setuppy", help = "Generate 'setup.p
 format = { cmd = "scripts/poe-tasks/format", help = "Check and fix code formatting using Ruff." }
 kresctl = { cmd = "scripts/poe-tasks/kresctl", help="Run kresctl utility" }
 clean = { cmd = "scripts/poe-tasks/clean", help="Cleanup build directories and files" }
+migrate = { cmd = "scripts/poe-tasks/migrate", help = "Migrate testing configuration using 'kresctl migrate' utility and validate it" }
 
 [tool.ruff]
 line-length = 120
index f5033f174913af47aca9fedc69571fd1ab8d2280..76da1209a099e19f78776a2c10d91aa10dca4b5d 100755 (executable)
@@ -41,12 +41,6 @@ python -m knot_resolver.client schema | diff - doc/_static/config.schema.json
 check_rv $?
 echo
 
-# check etc/config/config.migrate.yaml
-echo -e "${yellow}Checking etc/config/config.migrate.yaml${reset}"
-python -m knot_resolver.client migrate etc/config/config.migrate.yaml > /dev/null
-check_rv $?
-echo
-
 # fancy messages at the end :)
 fancy_message
 
diff --git a/scripts/poe-tasks/migrate b/scripts/poe-tasks/migrate
new file mode 100755 (executable)
index 0000000..6ce0303
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# ensure consistent behaviour
+src_dir="$(dirname "$(realpath "$0")")"
+source $src_dir/utils/_env.sh
+
+# stop failing early, because we wouldn't do anything else than fail
+set +e
+
+# migrate all testing configuration
+for config in $PWD/etc/config/config.migrate-test*.yaml;
+do
+    python3 -m knot_resolver.client migrate $config migrated.yaml;
+    python3 -m knot_resolver.client validate --no-strict migrated.yaml;
+    check_rv $?
+done