How do you structure Harness pipelines as code across many services — what do templates, input sets, and the Git Experience actually buy you?
Quick Answer
Templates (pipeline/stage/step level) centralize the golden path with versioned, org-scoped definitions services reference rather than copy; input sets capture per-service/per-environment parameter bundles; Git Experience stores all of it in your repos so changes flow through PR review. Together: 50 services share one reviewed deployment pattern instead of 50 divergent pipelines.
Detailed Answer
The sprawl problem Harness templates solve is the same one reusable workflows solve in GitHub Actions: without them, every service clones a pipeline and they drift apart — one gets the new verification step, others don't; an incident fix lands in 12 of 50 copies. Structure: org/project-level pipeline and stage templates with version labels (v1, v2...), where services attach a thin pipeline referencing the template plus their variables; template changes are versioned so consumers upgrade deliberately (pin stable, canary the new version on low-risk services first). Input sets bundle runtime inputs (image tag, environment, feature flags) — CI triggers reference an input set rather than passing loose parameters, and overlays compose them (base + env-specific). Git Experience keeps pipeline/template/input-set YAML in Git with branch/PR semantics, giving CI-grade review and audit for delivery changes — plus environment promotion via the same PR flow as code. The governance layer on top: OPA policies (Policy as Code) can require, e.g., that prod deployments use an approved template version and include an approval stage — turning the paved road from convention into constraint.
Code Example
pipeline:
name: checkout-svc-deploy
template:
templateRef: org.golden_k8s_deploy
versionLabel: v3
variables:
serviceRef: checkout
# input set: {image_tag: <runtime>, env: prod, approval: cab}
# OPA: deny if template.versionLabel < v3 and env == prodInterview Tip
Map it to the pattern interviewers know from other CI/CD: templates = reusable workflows, input sets = parameter bundles, plus OPA to enforce template adoption — the paved-road-to-guardrail progression.