strip docker type — site-publish is static-content only
Removes type: docker handling from action.yaml, scripts (build/deploy/utils/setup), and templates (deployment.yaml.j2, service-docker.yaml.j2). Renamed service-static.yaml.j2 -> service.yaml.j2. If site.yaml has type: docker, parse_site_yaml() now dies with a clear message pointing to action/image-build + action/image-push + action/image-deploy with hand-authored apps-repo manifests. rainsounds.vino.network was the only docker consumer and has already migrated. Drops registry-password input from action.yaml (no longer needed).
This commit is contained in:
+31
-27
@@ -1,4 +1,4 @@
|
||||
"""Shared utilities for the publish-site action."""
|
||||
"""Shared utilities for the site-publish action."""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
@@ -20,7 +20,26 @@ EXCLUDE_FILES = {
|
||||
"Dockerfile", ".dockerignore", "go.mod", "go.sum",
|
||||
}
|
||||
|
||||
VALID_TYPES = {"static", "hugo", "mkdocs", "docker"}
|
||||
VALID_TYPES = {"static", "hugo", "mkdocs"}
|
||||
|
||||
DOCKER_DEPRECATION_MSG = """\
|
||||
type: docker is no longer supported by action/site-publish.
|
||||
|
||||
site-publish handles only static-content sites (static, hugo, mkdocs)
|
||||
that ship to Garage S3. For containerized web apps, use the standard
|
||||
image-producer chain:
|
||||
|
||||
- uses: action/image-build@v1 # build + smoke-test
|
||||
- uses: action/image-push@v1 # push + prune
|
||||
- uses: action/image-deploy@v1 # apps repo image-pin
|
||||
|
||||
Hand-author your apps-repo manifests once (Deployment, Service, Ingress,
|
||||
Certificate, kustomization with images: block) under
|
||||
sjc001/websites/<repo>/manifests/. image-deploy will pin the tag on
|
||||
every CI run. See action/image-deploy README and
|
||||
sjc001/websites/rainsounds.vino.network/manifests/ for the canonical
|
||||
example.\
|
||||
"""
|
||||
|
||||
|
||||
def k8s_name(name):
|
||||
@@ -57,6 +76,10 @@ def parse_site_yaml(site_dir):
|
||||
die("domain is required in site.yaml")
|
||||
|
||||
site_type = cfg.get("type", "static")
|
||||
|
||||
if site_type == "docker":
|
||||
die(DOCKER_DEPRECATION_MSG)
|
||||
|
||||
if site_type not in VALID_TYPES:
|
||||
die(f"Unknown site type: {site_type} (valid: {', '.join(sorted(VALID_TYPES))})")
|
||||
|
||||
@@ -65,20 +88,10 @@ def parse_site_yaml(site_dir):
|
||||
"type": site_type,
|
||||
"enabled": cfg.get("enabled", True),
|
||||
"aliases": cfg.get("aliases") or [],
|
||||
"content_dir": cfg.get("content_dir", ""),
|
||||
"tidy": cfg.get("tidy", True),
|
||||
}
|
||||
|
||||
if site_type == "docker":
|
||||
if not cfg.get("image"):
|
||||
die("image is required in site.yaml for type: docker")
|
||||
site["image"] = cfg["image"]
|
||||
site["port"] = cfg.get("port", 8080)
|
||||
site["build_args"] = cfg.get("build_args") or {}
|
||||
site["health_path"] = cfg.get("health_path", "/healthz")
|
||||
site["replicas"] = cfg.get("replicas", 1)
|
||||
else:
|
||||
site["content_dir"] = cfg.get("content_dir", "")
|
||||
site["tidy"] = cfg.get("tidy", True)
|
||||
|
||||
print("Site config:")
|
||||
for k, v in site.items():
|
||||
print(f" {k}: {v}")
|
||||
@@ -96,30 +109,21 @@ def clone_apps(token):
|
||||
return apps_dir
|
||||
|
||||
|
||||
def render_templates(action_dir, template_vars, app_dir, manifests_dir, site_type):
|
||||
"""Render Jinja2 templates, selecting the right set for the site type."""
|
||||
def render_templates(action_dir, template_vars, app_dir, manifests_dir):
|
||||
"""Render Jinja2 templates for a static-content site."""
|
||||
templates_dir = Path(action_dir) / "templates"
|
||||
jinja_env = Environment(
|
||||
loader=FileSystemLoader(str(templates_dir)),
|
||||
keep_trailing_newline=True,
|
||||
)
|
||||
|
||||
if site_type == "docker":
|
||||
service_tmpl = "service-docker.yaml.j2"
|
||||
tmpl_names = ["app.yaml.j2", "certificate.yaml.j2", "ingress.yaml.j2",
|
||||
"kustomization.yaml.j2", service_tmpl, "deployment.yaml.j2"]
|
||||
else:
|
||||
service_tmpl = "service-static.yaml.j2"
|
||||
tmpl_names = ["app.yaml.j2", "certificate.yaml.j2", "ingress.yaml.j2",
|
||||
"kustomization.yaml.j2", service_tmpl]
|
||||
tmpl_names = ["app.yaml.j2", "certificate.yaml.j2", "ingress.yaml.j2",
|
||||
"kustomization.yaml.j2", "service.yaml.j2"]
|
||||
|
||||
for tmpl_name in tmpl_names:
|
||||
tmpl = jinja_env.get_template(tmpl_name)
|
||||
rendered = tmpl.render(**template_vars)
|
||||
out_name = tmpl_name.replace(".j2", "")
|
||||
# service-docker.yaml / service-static.yaml → service.yaml
|
||||
if out_name.startswith("service-"):
|
||||
out_name = "service.yaml"
|
||||
dest = app_dir / out_name if tmpl_name == "app.yaml.j2" else manifests_dir / out_name
|
||||
dest.write_text(rendered)
|
||||
print(f" Rendered {tmpl_name} -> {dest}")
|
||||
|
||||
Reference in New Issue
Block a user