Add multi-file merge support to manifest-to-bicep generate command#11914
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Extends the manifest-to-bicep generate subcommand to accept multiple manifest files that share a namespace, merging their Types into a single Bicep extension output. This supports the per-type manifest file layout introduced by the automated resource-type registration work, while remaining backward compatible for single-file usage.
Changes:
- Update
generatecommand to accept<manifest1> [manifest2 ...] <output>and treat the last positional arg as the output directory. - Add
mergeManifestFiles()that validates namespace consistency, rejects duplicate type names, and re-serializes a mergedResourceProviderforGenerateFromString. - Add unit tests and YAML test fixtures (
containers.yaml,routes.yaml,secrets.yaml).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| bicep-tools/cmd/manifest-to-bicep/main.go | Accept multi-file args, refactor RunGenerate signature, add mergeManifestFiles helper. |
| bicep-tools/cmd/manifest-to-bicep/main_test.go | New tests for single-file, multi-file merge, namespace mismatch, missing file, empty list, duplicate type. |
| bicep-tools/cmd/manifest-to-bicep/testdata/containers.yaml | Test fixture for Radius.Compute/containers. |
| bicep-tools/cmd/manifest-to-bicep/testdata/routes.yaml | Test fixture for Radius.Compute/routes. |
| bicep-tools/cmd/manifest-to-bicep/testdata/secrets.yaml | Test fixture for Radius.Security/secrets used in namespace-mismatch test. |
1207c92 to
5e9c5c2
Compare
d1f4e55 to
9bf82db
Compare
Update the existing 'generate' subcommand of manifest-to-bicep to accept multiple manifest files. When given multiple YAML manifests with the same namespace, their Types maps are merged into a single output (types.json, index.json, index.md). This supports per-type manifest files (e.g. containers.yaml, routes.yaml) as introduced by the automated resource type registration design, where each file defines a single resource type within a namespace. Backward compatible: single-file usage works exactly as before. Part of: unified Bicep extension publishing (PR 1/4) Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
386dac7 to
4d7f930
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11914 +/- ##
==========================================
+ Coverage 51.71% 51.80% +0.08%
==========================================
Files 726 726
Lines 45608 57559 +11951
==========================================
+ Hits 23587 29817 +6230
- Misses 19795 25519 +5724
+ Partials 2226 2223 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Overview
Update the existing
generatesubcommand ofmanifest-to-bicepto accept multiple manifest files. When given multiple YAML manifests with the same namespace, theirTypesmaps are merged into a single output (types.json,index.json,index.md).This supports per-type manifest files (e.g.
containers.yaml,routes.yaml) as introduced by the automated resource type registration design, where each file defines a single resource type within a namespace.Backward compatible: single-file usage works exactly as before.
Changes
bicep-tools/cmd/manifest-to-bicep/main.go: Updatedgenerateto accept<manifest1> [manifest2...] <output>(last arg is always output dir). AddedmergeManifestFiles()that validates same namespace and rejects duplicate types.bicep-tools/cmd/manifest-to-bicep/main_test.go: Added tests for single-file, multi-file merge, namespace mismatch, nonexistent file, empty manifest list, and duplicate type detection.bicep-tools/cmd/manifest-to-bicep/testdata/: Added test manifest files forRadius.Compute(containers, routes) andRadius.Security(secrets).Usage
Single file (backward compatible):
Multiple files (merge into one output):
Test plan
go test ./bicep-tools/cmd/manifest-to-bicep/- 6 tests covering single-file generation, multi-file merge, namespace mismatch rejection, nonexistent file handling, empty input, and duplicate type detection.Part of
Unified Bicep extension publishing (PR 1/4). See design doc.
Dependencies
defaults.yamland per-type manifest files that this command consumes)