Skip to content

Add multi-file merge support to manifest-to-bicep generate command#11914

Merged
kachawla merged 2 commits into
mainfrom
kachawla/multi-file-generate
May 15, 2026
Merged

Add multi-file merge support to manifest-to-bicep generate command#11914
kachawla merged 2 commits into
mainfrom
kachawla/multi-file-generate

Conversation

@kachawla

@kachawla kachawla commented May 15, 2026

Copy link
Copy Markdown
Member

Overview

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.

Changes

  • bicep-tools/cmd/manifest-to-bicep/main.go: Updated generate to accept <manifest1> [manifest2...] <output> (last arg is always output dir). Added mergeManifestFiles() 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 for Radius.Compute (containers, routes) and Radius.Security (secrets).

Usage

Single file (backward compatible):

go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml /tmp/out

Multiple files (merge into one output):

go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml routes.yaml persistentVolumes.yaml /tmp/out

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

Copilot AI review requested due to automatic review settings May 15, 2026 21:08
@kachawla kachawla requested review from a team as code owners May 15, 2026 21:08
@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 generate command 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 merged ResourceProvider for GenerateFromString.
  • 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.

@kachawla kachawla force-pushed the kachawla/multi-file-generate branch from 1207c92 to 5e9c5c2 Compare May 15, 2026 21:13
Comment thread bicep-tools/cmd/manifest-to-bicep/main.go
Comment thread bicep-tools/cmd/manifest-to-bicep/main.go
nithyatsu
nithyatsu previously approved these changes May 15, 2026
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>
@codecov

codecov Bot commented May 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.80%. Comparing base (73acc9a) to head (76e9a54).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown

Unit Tests

    2 files  ±0    423 suites  ±0   7m 15s ⏱️ -11s
5 128 tests ±0  5 126 ✅ ±0  2 💤 ±0  0 ❌ ±0 
6 157 runs  ±0  6 155 ✅ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 76e9a54. ± Comparison against base commit 73acc9a.

♻️ This comment has been updated with latest results.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
@radius-functional-tests

radius-functional-tests Bot commented May 15, 2026

Copy link
Copy Markdown

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository radius-project/radius
Commit ref 76e9a54
Unique ID func1ea27918b6
Image tag pr-func1ea27918b6
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func1ea27918b6
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func1ea27918b6
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func1ea27918b6
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func1ea27918b6
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func1ea27918b6
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ corerp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@kachawla kachawla merged commit 7766024 into main May 15, 2026
59 checks passed
@kachawla kachawla deleted the kachawla/multi-file-generate branch May 15, 2026 22:41
kachawla added a commit that referenced this pull request May 18, 2026
## Overview

Today, resource types from `resource-types-contrib` (e.g.
`Radius.Compute/containers`, `Radius.Security/secrets`) are published as
separate Bicep extensions (`radiusCompute`, `radiusData`,
`radiusSecurity`), requiring users to configure multiple entries in
`bicepconfig.json` and use different `extension` directives depending on
the namespace. This PR is part of a series that consolidates them into
the existing `radius` Bicep extension so users have a single `extension
radius` for all Radius-authored types.

Specifically, this PR wires up the build pipeline so that contrib
resource type manifests (maintained via [`make
update-resource-types`](#11911))
are included in the unified `radius` extension alongside the existing
TypeSpec/Swagger-generated types.

## What this PR does

1. **`generate-bicep-types-contrib` Makefile target** -- reads
`deploy/manifest/defaults.yaml` to discover which contrib namespaces to
include and passes all per-type manifests for each namespace to
`manifest-to-bicep generate` for merging into `types.json` +
`index.json` + `index.md`. Creates empty `docs/` directories so the [doc
generation
script](https://github.com/radius-project/docs/blob/main/.github/scripts/generate_resource_references.py)
doesn't crash (contrib resource type docs tracked in
[#11918](#11918)).
2. **`publish-bicep-extension` Makefile target** -- wraps `bicep
publish-extension` for local testability.
3. **Shared `index-builder.ts` module** -- extracts `buildTypeIndex()`
from `generate.ts` into a shared module so both the autorest pipeline
and the new `rebuild-index` CLI can use it without code duplication.
4. **`rebuild-index.ts` CLI wrapper** -- standalone entry point that
rebuilds the unified `index.json`/`index.md` after contrib `types.json`
files are added to the generated tree.
5. **Extended `generate-bicep-types` target** -- now calls
`generate-bicep-types-contrib` then `rebuild-index` after the existing
autorest step, so the full pipeline produces one unified extension.
6. **Removed contrib extension references** -- `radiusCompute`,
`radiusData`, `radiusSecurity` removed from `bicepconfig.json`,
`install-bicep.sh`, and `pkg/cli/setup` since these namespaces are now
part of the single `radius` extension.
7. **Updated functional test workflows** -- added `yq` install step to
`functional-test-noncloud.yaml` and `functional-test-cloud.yaml` before
the `make generate-bicep-types` step, since the new
`generate-bicep-types-contrib` target requires `yq` to parse
`defaults.yaml`.

## How the build pipeline works after this PR

```
make generate-bicep-types
  |
  +--> Step 1: autorest pipeline (existing, unchanged)
  |      Generates types from Swagger/TypeSpec for Applications.Core, Applications.Dapr, etc.
  |      Output: generated/radius/applications.core/.../types.json, etc.
  |
  +--> Step 2: generate-bicep-types-contrib (new)
  |      Reads defaults.yaml, runs manifest-to-bicep generate per namespace
  |      Output: generated/radius/radius.compute/.../types.json, etc.
  |
  +--> Step 3: rebuild-index (new)
         Walks the full generated/ tree, builds unified index.json + index.md
         Output: generated/index.json (covers all namespaces from both steps)
```

## CI impact

The `generate-bicep-types-contrib` step requires `yq` to parse
`defaults.yaml`. Workflows that call `make generate-bicep-types` need
`yq` installed beforehand. This PR adds the install step to the two
affected workflows (`functional-test-noncloud.yaml` and
`functional-test-cloud.yaml`), using the same pattern as
`verify-resource-types.yaml` from
[#11911](#11911).

## Test plan

- `go test ./pkg/cli/setup/...` -- verifies updated bicepconfig template
- TypeScript build: `pnpm -C hack/bicep-types-radius/src/generator run
build` -- verifies the refactored generate.ts and new index-builder.ts
compile cleanly

## Dependencies

- [Add multi-file merge support to manifest-to-bicep generate
command](#11914) (merged)
- [Automated default resource type
registration](#11911)
(merged -- provides `defaults.yaml` and per-type manifest files)

## Changes

- `build/generate.mk`: New `generate-yq-installed`,
`generate-bicep-types-contrib`, and `publish-bicep-extension` targets
- `hack/bicep-types-radius/src/generator/src/index-builder.ts`: New
shared module exporting `buildTypeIndex()`
- `hack/bicep-types-radius/src/generator/src/cmd/generate.ts`:
Refactored to import `buildTypeIndex` from the shared module instead of
defining it inline
- `hack/bicep-types-radius/src/generator/src/cmd/rebuild-index.ts`: New
thin CLI wrapper that parses args and calls the shared
`buildTypeIndex()`
- `hack/bicep-types-radius/src/generator/package.json`: Added
`rebuild-index` script entry
- `bicepconfig.json`, `build/install-bicep.sh`,
`pkg/cli/setup/application.go`, `pkg/cli/setup/application_test.go`:
Removed contrib extension references
- `.github/workflows/functional-test-noncloud.yaml`: Added `yq` install
step before `make generate-bicep-types`
- `.github/workflows/functional-test-cloud.yaml`: Added `yq` install
step before `make generate-bicep-types`
- `hack/bicep-types-radius/generated/`: Regenerated `index.json` and
added contrib type definitions for `Radius.Compute`, `Radius.Data`, and
`Radius.Security` (3 new namespace directories with `types.json`,
`index.json`, `index.md`, and empty `docs/` placeholder)

## Part of

Unified Bicep extension publishing (PR 2/4). See [design
note](#11892).

---------

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Reshrahim pushed a commit to Reshrahim/radius that referenced this pull request Jun 15, 2026
…adius-project#11914)

## Overview

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](radius-project#11911), 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`: Updated `generate` to
accept `<manifest1> [manifest2...] <output>` (last arg is always output
dir). Added `mergeManifestFiles()` 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 for `Radius.Compute` (containers, routes) and `Radius.Security`
(secrets).

## Usage

Single file (backward compatible):
```bash
go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml /tmp/out
```

Multiple files (merge into one output):
```bash
go run ./bicep-tools/cmd/manifest-to-bicep generate containers.yaml routes.yaml persistentVolumes.yaml /tmp/out
```

## 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](radius-project#11892).

## Dependencies

- [Automated default resource type
registration](radius-project#11911)
(provides `defaults.yaml` and per-type manifest files that this command
consumes)

---------

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Reshrahim pushed a commit to Reshrahim/radius that referenced this pull request Jun 15, 2026
…11915)

## Overview

Today, resource types from `resource-types-contrib` (e.g.
`Radius.Compute/containers`, `Radius.Security/secrets`) are published as
separate Bicep extensions (`radiusCompute`, `radiusData`,
`radiusSecurity`), requiring users to configure multiple entries in
`bicepconfig.json` and use different `extension` directives depending on
the namespace. This PR is part of a series that consolidates them into
the existing `radius` Bicep extension so users have a single `extension
radius` for all Radius-authored types.

Specifically, this PR wires up the build pipeline so that contrib
resource type manifests (maintained via [`make
update-resource-types`](radius-project#11911))
are included in the unified `radius` extension alongside the existing
TypeSpec/Swagger-generated types.

## What this PR does

1. **`generate-bicep-types-contrib` Makefile target** -- reads
`deploy/manifest/defaults.yaml` to discover which contrib namespaces to
include and passes all per-type manifests for each namespace to
`manifest-to-bicep generate` for merging into `types.json` +
`index.json` + `index.md`. Creates empty `docs/` directories so the [doc
generation
script](https://github.com/radius-project/docs/blob/main/.github/scripts/generate_resource_references.py)
doesn't crash (contrib resource type docs tracked in
[radius-project#11918](radius-project#11918)).
2. **`publish-bicep-extension` Makefile target** -- wraps `bicep
publish-extension` for local testability.
3. **Shared `index-builder.ts` module** -- extracts `buildTypeIndex()`
from `generate.ts` into a shared module so both the autorest pipeline
and the new `rebuild-index` CLI can use it without code duplication.
4. **`rebuild-index.ts` CLI wrapper** -- standalone entry point that
rebuilds the unified `index.json`/`index.md` after contrib `types.json`
files are added to the generated tree.
5. **Extended `generate-bicep-types` target** -- now calls
`generate-bicep-types-contrib` then `rebuild-index` after the existing
autorest step, so the full pipeline produces one unified extension.
6. **Removed contrib extension references** -- `radiusCompute`,
`radiusData`, `radiusSecurity` removed from `bicepconfig.json`,
`install-bicep.sh`, and `pkg/cli/setup` since these namespaces are now
part of the single `radius` extension.
7. **Updated functional test workflows** -- added `yq` install step to
`functional-test-noncloud.yaml` and `functional-test-cloud.yaml` before
the `make generate-bicep-types` step, since the new
`generate-bicep-types-contrib` target requires `yq` to parse
`defaults.yaml`.

## How the build pipeline works after this PR

```
make generate-bicep-types
  |
  +--> Step 1: autorest pipeline (existing, unchanged)
  |      Generates types from Swagger/TypeSpec for Applications.Core, Applications.Dapr, etc.
  |      Output: generated/radius/applications.core/.../types.json, etc.
  |
  +--> Step 2: generate-bicep-types-contrib (new)
  |      Reads defaults.yaml, runs manifest-to-bicep generate per namespace
  |      Output: generated/radius/radius.compute/.../types.json, etc.
  |
  +--> Step 3: rebuild-index (new)
         Walks the full generated/ tree, builds unified index.json + index.md
         Output: generated/index.json (covers all namespaces from both steps)
```

## CI impact

The `generate-bicep-types-contrib` step requires `yq` to parse
`defaults.yaml`. Workflows that call `make generate-bicep-types` need
`yq` installed beforehand. This PR adds the install step to the two
affected workflows (`functional-test-noncloud.yaml` and
`functional-test-cloud.yaml`), using the same pattern as
`verify-resource-types.yaml` from
[radius-project#11911](radius-project#11911).

## Test plan

- `go test ./pkg/cli/setup/...` -- verifies updated bicepconfig template
- TypeScript build: `pnpm -C hack/bicep-types-radius/src/generator run
build` -- verifies the refactored generate.ts and new index-builder.ts
compile cleanly

## Dependencies

- [Add multi-file merge support to manifest-to-bicep generate
command](radius-project#11914) (merged)
- [Automated default resource type
registration](radius-project#11911)
(merged -- provides `defaults.yaml` and per-type manifest files)

## Changes

- `build/generate.mk`: New `generate-yq-installed`,
`generate-bicep-types-contrib`, and `publish-bicep-extension` targets
- `hack/bicep-types-radius/src/generator/src/index-builder.ts`: New
shared module exporting `buildTypeIndex()`
- `hack/bicep-types-radius/src/generator/src/cmd/generate.ts`:
Refactored to import `buildTypeIndex` from the shared module instead of
defining it inline
- `hack/bicep-types-radius/src/generator/src/cmd/rebuild-index.ts`: New
thin CLI wrapper that parses args and calls the shared
`buildTypeIndex()`
- `hack/bicep-types-radius/src/generator/package.json`: Added
`rebuild-index` script entry
- `bicepconfig.json`, `build/install-bicep.sh`,
`pkg/cli/setup/application.go`, `pkg/cli/setup/application_test.go`:
Removed contrib extension references
- `.github/workflows/functional-test-noncloud.yaml`: Added `yq` install
step before `make generate-bicep-types`
- `.github/workflows/functional-test-cloud.yaml`: Added `yq` install
step before `make generate-bicep-types`
- `hack/bicep-types-radius/generated/`: Regenerated `index.json` and
added contrib type definitions for `Radius.Compute`, `Radius.Data`, and
`Radius.Security` (3 new namespace directories with `types.json`,
`index.json`, `index.md`, and empty `docs/` placeholder)

## Part of

Unified Bicep extension publishing (PR 2/4). See [design
note](radius-project#11892).

---------

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Reshma Abdul Rahim <reshmarahim.abdul@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants