about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-04-14T15·20+0200
committertazjin <mail@tazj.in>2021-04-14T15·23+0000
commit605302091d6f35f6c6cd56170fde1c932cdb28ee (patch)
tree90cef542b09b8fd5cabcec71936198ae2a342e18
parentb2c0b747442db4dd6d28091a4cd5ceb0ca2a159f (diff)
refactor(tazjin/dns): Add zone validity checks in CI r/2510
Same as //ops/dns

Change-Id: I0399efd2e48956ec91833386adff27d94d08ef1e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3013
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
-rw-r--r--users/tazjin/dns/default.nix14
-rwxr-xr-xusers/tazjin/dns/import (renamed from users/tazjin/cloud-dns/import)5
-rw-r--r--users/tazjin/dns/kontemplate.works.zone (renamed from users/tazjin/cloud-dns/kontemplate-works)0
-rw-r--r--users/tazjin/dns/tazj.in.zone (renamed from users/tazjin/cloud-dns/root-tazj-in)0
4 files changed, 17 insertions, 2 deletions
diff --git a/users/tazjin/dns/default.nix b/users/tazjin/dns/default.nix
new file mode 100644
index 000000000000..14b9d428641c
--- /dev/null
+++ b/users/tazjin/dns/default.nix
@@ -0,0 +1,14 @@
+# Performs simple (local-only) validity checks on DNS zones.
+{ depot, pkgs, ... }:
+
+let
+  inherit (depot.nix.utils) drvTargets;
+
+  checkZone = zone: file: pkgs.runCommandNoCC "${zone}-check" {} ''
+    ${pkgs.bind}/bin/named-checkzone -i local ${zone} ${file} | tee $out
+  '';
+
+in drvTargets {
+  kontemplate-works = checkZone "kontemplate.works"./kontemplate.works.zone;
+  tazj-in = checkZone "tazj.in" ./tazj.in.zone;
+}
diff --git a/users/tazjin/cloud-dns/import b/users/tazjin/dns/import
index e79e426b5553..8ea1d694c9a1 100755
--- a/users/tazjin/cloud-dns/import
+++ b/users/tazjin/dns/import
@@ -1,10 +1,11 @@
 #!/bin/sh
 set -ue
 
-# Imports a zone file into a Google Cloud DNS zone of the same name
+# Imports a zone file into Google Cloud DNS
 readonly ZONE="${1}"
+readonly FILE="${2}"
 
-gcloud dns record-sets import "${ZONE}" \
+gcloud dns record-sets import "${FILE}" \
        --project composite-watch-759 \
        --zone-file-format \
        --delete-all-existing \
diff --git a/users/tazjin/cloud-dns/kontemplate-works b/users/tazjin/dns/kontemplate.works.zone
index 326a129d2105..326a129d2105 100644
--- a/users/tazjin/cloud-dns/kontemplate-works
+++ b/users/tazjin/dns/kontemplate.works.zone
diff --git a/users/tazjin/cloud-dns/root-tazj-in b/users/tazjin/dns/tazj.in.zone
index 43db5834a0ca..43db5834a0ca 100644
--- a/users/tazjin/cloud-dns/root-tazj-in
+++ b/users/tazjin/dns/tazj.in.zone