style: auto-format from pre-push hooks

This commit is contained in:
2026-07-04 19:30:21 +03:00
parent db971954d6
commit 9a3ddb8b96
+16 -5
View File
@@ -19,6 +19,7 @@ Usage:
Every rendered file gets a "GENERATED by oleks/ci-scripts — do not hand-edit"
header. Re-running is idempotent: same manifest in, byte-identical files out.
"""
import argparse
import pathlib
import sys
@@ -58,7 +59,9 @@ def render_matrix(manifest: dict) -> dict:
lines = "\n".join(f" {k}: {v}" for k, v in node_selector.items())
node_selector_block = f" nodeSelector:\n{lines}\n"
node_selector_top_block = (
" backend_options:\n kubernetes:\n nodeSelector:\n" + lines + "\n"
" backend_options:\n kubernetes:\n nodeSelector:\n"
+ lines
+ "\n"
)
else:
node_selector_block = ""
@@ -180,7 +183,9 @@ def render_single(manifest: dict) -> dict:
branches = "[" + ", ".join(manifest["branches"]) + "]"
buildkit_addr = f"tcp://buildkit-{arch}.infra.svc.cluster.local:1234"
header = manifest["header"].rstrip("\n") + "\n"
label_lines = _comment_block(manifest.get("label_comment", ""), " ") + f" arch: {arch}"
label_lines = (
_comment_block(manifest.get("label_comment", ""), " ") + f" arch: {arch}"
)
step_tmpl = load_template("single", "COMPONENT_STEP.tmpl")
steps = []
@@ -194,7 +199,9 @@ def render_single(manifest: dict) -> dict:
step_comment=step_comment,
step_name=c["name"],
image=manifest["image"],
buildkit_comment=_comment_block(c.get("buildkit_comment", ""), " "),
buildkit_comment=_comment_block(
c.get("buildkit_comment", ""), " "
),
buildkit_addr=buildkit_addr,
version_comment=_comment_block(c.get("version_comment", ""), " "),
command=command,
@@ -218,8 +225,12 @@ RENDERERS = {"matrix": render_matrix, "split": render_split, "single": render_si
def main():
ap = argparse.ArgumentParser()
ap.add_argument("manifest", type=pathlib.Path)
ap.add_argument("--out", type=pathlib.Path, required=True, help="target .woodpecker/ dir")
ap.add_argument("--check", action="store_true", help="don't write, just diff against --out")
ap.add_argument(
"--out", type=pathlib.Path, required=True, help="target .woodpecker/ dir"
)
ap.add_argument(
"--check", action="store_true", help="don't write, just diff against --out"
)
args = ap.parse_args()
manifest = yaml.safe_load(args.manifest.read_text())