Skip to content

Container Assist: refactor multi-container workflow renderer to use YAML template files #2161

@Tatsinnit

Description

@Tatsinnit

Context

In #2145 the multi-container Container Assist workflow generator emits the GitHub Actions YAML by concatenating TypeScript template strings (renderBuildJob, renderDeployJob in src/commands/aksContainerAssist/workflowTemplate.ts). The single-container path uses placeholder substitution against resources/yaml/aks-deploy.template.yaml / aks-deploy-managed-ns.template.yaml.

Reviewer feedback (thread):

Can we use templates similar to single container workflow for the yaml code?

Why not in #2145

Multi-container emits a variable number of build-<svc> / deploy-<svc> job pairs (one per service), each with its own env: block and a conditional Annotate namespace step. That's awkward to express as a single static template with {{var}} substitution.

Proposal

Factor per-job fragments into reusable template files under resources/yaml/:

  • workflow-multi-header.template.yaml — top-level name, on, shared env, permissions.
  • workflow-multi-build-job.template.yaml — one build-<svc> job with per-service env.
  • workflow-multi-deploy-job.template.yaml — one deploy-<svc> job (with optional managed-namespace block, or two variants).
  • Renderer concatenates header + N build fragments + N deploy fragments after substitution.

Acceptance criteria

  • Multi-container output is byte-identical (after normalisation) to current renderer.
  • No TS template literals containing YAML inside workflowTemplate.ts.
  • Existing multi-container tests still pass (including js-yaml parse assertions added in Implements Azure/vscode-aks-tools project #994: #2145).
  • Add a snapshot/golden test for a 3-service config.

Notes

  • Single-container template substitution masks the YAML-indentation concern (block scalars are placed at a known column); the new templates need to declare the column where block scalars like DEPLOYMENT_MANIFEST_PATH live so the path-formatter helper stays correct.

Follow-up to #2145.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions