feat: add coredns mysql image build and updater

This commit is contained in:
bryanpedini committed 2026-11-09 22:57:47 +01:00
1 parent c3ab4cfb70
commit 6835e480c1
7 files changed
+195 -1

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2026 Bryan Joshua Pedini
import json
import re
import urllib.request
from pathlib import Path
def fetch(url):
request = urllib.request.Request(url, headers={"Accept": "application/vnd.github+json", "User-Agent": "coredns-mysql-updater"})
with urllib.request.urlopen(request, timeout=30) as response:
return json.load(response)
release = fetch("https://api.github.com/repos/coredns/coredns/releases/latest")
plugin = fetch("https://api.github.com/repos/cloud66-oss/coredns_mysql/commits/HEAD")
tag = release["tag_name"]
revision = plugin["sha"]
if not re.fullmatch(r"v[0-9]+\.[0-9]+\.[0-9]+", tag):
raise SystemExit(f"Unexpected CoreDNS release: {tag}")
if not re.fullmatch(r"[0-9a-f]{40}", revision):
raise SystemExit("Unexpected plugin revision")
Path("versions.env").write_text(f"COREDNS_VERSION={tag[1:]}\nMYSQL_PLUGIN_REV={revision}\n")