Skip to content

feat(container-assist): refactor multi-container workflows to YAML te…#2169

Open
Tatsinnit wants to merge 4 commits into
Azure:mainfrom
Tatsinnit:fix/leftover-multi-container-work
Open

feat(container-assist): refactor multi-container workflows to YAML te…#2169
Tatsinnit wants to merge 4 commits into
Azure:mainfrom
Tatsinnit:fix/leftover-multi-container-work

Conversation

@Tatsinnit
Copy link
Copy Markdown
Member

@Tatsinnit Tatsinnit commented May 22, 2026

Multi-Container Workflow: YAML Templates, Matrix Build & Shared Manifest

Resolves #2161, #2162, #2163

Gentle fyi @bosesuneha for testing this please.

Summary

Refactors multi-container GitHub Actions workflow generation to use external YAML template files, consolidates per-service build jobs into a single matrix strategy job, and adds a "shared manifest" UX shortcut.

Changes

#2161 — YAML Template Files

  • Added 4 template files under resources/yaml/:
    • workflow-multi-header.template.yaml — top-level workflow structure (name, triggers, shared env, jobs: key)
    • workflow-multi-build-job.template.yaml — single build job with matrix strategy placeholder
    • workflow-multi-deploy-job.template.yaml — per-service deploy job (standard namespace)
    • workflow-multi-deploy-job-managed-ns.template.yaml — per-service deploy job (managed namespace)
  • Refactored workflowTemplate.ts to load and substitute these files via getWorkflowYaml() instead of generating YAML from TypeScript template literals

#2162 — Matrix Build Strategy

  • Replaced N separate build-<service>: jobs with a single build: job using strategy.matrix.include
  • Each container contributes one matrix entry with service, docker_file, build_context, and image
  • Deploy jobs use needs: [build] to depend on the unified build job

#2163 — Shared Manifest UX

  • After the first service's manifest path is resolved, a QuickPick offers:
    • "Apply to all remaining services" — reuses the same manifest for all subsequent services without auto-detected manifests
    • "Choose individually" — preserves existing per-service prompting behavior
  • Only shown when there are remaining services that lack auto-detected manifests

Testing

  • Updated existing multi-container tests to validate matrix structure instead of per-service build jobs
  • Added 3-service snapshot test suite covering: valid YAML parsing, matrix entries, deploy job dependencies, multi-manifest block scalars, and shared manifest across all services

…mplates with matrix build (Azure#2161, Azure#2162, Azure#2163)

- Extract multi-container workflow generation into 4 YAML template files
  under resources/yaml/ (header, build-job, deploy-job, deploy-job-managed-ns)
- Replace N per-service build jobs with a single matrix strategy build job
- Add "Apply to all remaining services" QuickPick for shared manifest paths
- Update and expand test suite with 3-service snapshot tests

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
@Tatsinnit Tatsinnit self-assigned this May 22, 2026
@Tatsinnit Tatsinnit added the enhancement 🚀 New feature or request or improvements on existing code. label May 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Container Assist’s multi-container GitHub Actions workflow generation to use external YAML templates (instead of TypeScript template literals), consolidates builds into a single matrix build job, and adds a shared manifest selection shortcut during multi-container configuration collection.

Changes:

  • Moved multi-container workflow rendering to resources/yaml/workflow-multi-*.template.yaml fragments and added substitution logic in workflowTemplate.ts.
  • Replaced per-service build jobs with a single build job using strategy.matrix.include, while keeping per-service deploy jobs.
  • Added a “Apply to all remaining services” QuickPick to reuse a manifest path across services during multi-container config collection, plus expanded unit tests (including a 3-service structural test suite).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/commands/aksContainerAssist/workflowTemplate.ts Loads new multi-container YAML template fragments, renders matrix include entries, and generates per-service deploy jobs via placeholder replacement.
src/commands/aksContainerAssist/workflowGenerator.ts Adds shared-manifest QuickPick flow when manifests aren’t auto-detected for remaining services.
src/tests/suite/containerAssist/workflowTemplate.test.ts Updates tests for matrix build + per-service deploy, and adds a 3-service structural test suite including shared-manifest assertions.
resources/yaml/workflow-multi-header.template.yaml New multi-container workflow header fragment.
resources/yaml/workflow-multi-build-job.template.yaml New matrix build-job fragment with MATRIX_INCLUDE placeholder.
resources/yaml/workflow-multi-deploy-job.template.yaml New per-service deploy-job fragment (standard namespace).
resources/yaml/workflow-multi-deploy-job-managed-ns.template.yaml New per-service deploy-job fragment (managed namespace).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/commands/aksContainerAssist/workflowGenerator.ts Outdated
Comment thread src/commands/aksContainerAssist/workflowGenerator.ts Outdated
Comment thread src/commands/aksContainerAssist/workflowGenerator.ts Outdated
Tatsinnit and others added 2 commits May 22, 2026 23:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tatsat (Tats) Mishra 🐉 <tatsatmishra@gmail.com>
…fest logic

- Trigger "Apply to all" QuickPick on first non-undefined manifest instead of
  hardcoding to idx === 0
- Preserve auto-detected manifests for services that have them; only apply
  shared path to services lacking auto-detected manifests
- Update variable comment to reflect actual behavior

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
…template

The workflow-multi-deploy-job-managed-ns.template.yaml was referenced
in code and tested but never committed, causing test failures in CI.

Signed-off-by: Tatsat Mishra <tamishra@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement 🚀 New feature or request or improvements on existing code.

Projects

None yet

2 participants