Skip to content

Integrate contrib types into unified Bicep extension#11915

Open
kachawla wants to merge 12 commits into
mainfrom
kachawla/bicep-types-contrib
Open

Integrate contrib types into unified Bicep extension#11915
kachawla wants to merge 12 commits into
mainfrom
kachawla/bicep-types-contrib

Conversation

@kachawla
Copy link
Copy Markdown
Member

@kachawla kachawla commented May 15, 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) 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 doesn't crash (contrib resource type docs tracked in #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.

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

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.

Wire up the build pipeline so that contrib resource type manifests
(maintained via 'make update-resource-types') are included in the unified
'radius' Bicep extension alongside the existing TypeSpec/Swagger-generated
types. This eliminates the separate radiusCompute, radiusData, and
radiusSecurity extensions.

- Add generate-bicep-types-contrib Makefile target that 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.

- Add generate-yq-installed prerequisite target for yq detection.

- Add publish-bicep-extension Makefile target wrapping
  'bicep publish-extension' for local testability.

- Extract buildTypeIndex() from generate.ts into a shared
  index-builder.ts module. Add rebuild-index.ts as a thin CLI wrapper.

- Extend generate-bicep-types target to call generate-bicep-types-contrib
  then rebuild-index after the existing autorest step.

- Remove radiusCompute, radiusData, radiusSecurity from bicepconfig.json,
  install-bicep.sh, and pkg/cli/setup since these namespaces are now
  part of the single 'radius' extension.

Part of: unified Bicep extension publishing (PR 2/4)

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Copilot AI review requested due to automatic review settings May 15, 2026 21:45
@kachawla kachawla requested review from a team as code owners May 15, 2026 21:45
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Dependency Review

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

Scanned Files

None

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 integrates contrib resource types into the unified Radius Bicep extension pipeline so users can rely on a single extension radius configuration.

Changes:

  • Adds Make targets to generate contrib Bicep types, rebuild the unified index, and publish the extension.
  • Refactors Bicep type index generation into a shared TypeScript module with a new rebuild-index CLI.
  • Removes separate contrib extension references from generated and repo-level Bicep configs.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
build/generate.mk Adds contrib generation, index rebuild, and publish targets.
hack/bicep-types-radius/src/generator/src/index-builder.ts Extracts shared index-building logic.
hack/bicep-types-radius/src/generator/src/cmd/rebuild-index.ts Adds CLI entry point for rebuilding indexes.
hack/bicep-types-radius/src/generator/src/cmd/generate.ts Reuses shared index builder.
hack/bicep-types-radius/src/generator/package.json Adds rebuild-index script.
bicepconfig.json Removes separate contrib extensions.
build/install-bicep.sh Updates generated Bicep config extension list.
pkg/cli/setup/application.go / application_test.go Updates scaffolded Bicep config and test expectation.

Comment thread build/generate.mk Outdated
@kachawla kachawla changed the base branch from main to kachawla/multi-file-generate May 15, 2026 21:53
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.71%. Comparing base (7766024) to head (037ee66).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11915      +/-   ##
==========================================
- Coverage   51.72%   51.71%   -0.02%     
==========================================
  Files         726      726              
  Lines       45608    45608              
==========================================
- Hits        23593    23588       -5     
- Misses      19792    19794       +2     
- Partials     2223     2226       +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
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Unit Tests

    2 files  ±0    423 suites  ±0   7m 18s ⏱️ +17s
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 037ee66. ± Comparison against base commit 7766024.

♻️ This comment has been updated with latest results.

kachawla added 2 commits May 15, 2026 15:08
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
nithyatsu
nithyatsu previously approved these changes May 15, 2026
Base automatically changed from kachawla/multi-file-generate to main May 15, 2026 22:41
@kachawla kachawla dismissed nithyatsu’s stale review May 15, 2026 22:41

The base branch was changed.

The doc generation script in the docs repo walks the generated/ tree and
expects a docs/ subdirectory under each namespace/apiVersion. The autorest
pipeline creates this for core namespaces, but manifest-to-bicep generate
does not. Without it, the script crashes with FileNotFoundError.

Creating an empty docs/ directory is safe because the script handles
empty directories gracefully (prints a message and continues). Contrib
resource type docs will be addressed separately.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
The generate-bicep-types-contrib Makefile target requires yq to parse
deploy/manifest/defaults.yaml. Add an explicit yq install step (using
go install) before the generate-bicep-types step in the noncloud and
cloud functional test workflows.

Uses the same pattern as verify-resource-types.yaml from the automated
resource type registration PR.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
kachawla added 2 commits May 15, 2026 17:02
Adds generated types for Radius.Compute, Radius.Data, and
Radius.Security and rebuilds the unified index.json to include
all 8 namespaces.

Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
nithyatsu
nithyatsu previously approved these changes May 16, 2026
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
kachawla added 3 commits May 15, 2026 23:42
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
Signed-off-by: Karishma Chawla <kachawla@microsoft.com>
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 16, 2026

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 037ee66
Unique ID funccd4bf845e6
Image tag pr-funccd4bf845e6
  • 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-funccd4bf845e6
  • 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-funccd4bf845e6
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-funccd4bf845e6
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-funccd4bf845e6
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-funccd4bf845e6
  • 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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

# Required by make generate-bicep-types-contrib to parse defaults.yaml.
run: |
mkdir -p "${RUNNER_TEMP}/bin"
GOBIN="${RUNNER_TEMP}/bin" go install github.com/mikefarah/yq/v4@v4.44.3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can the yq version be an env var similar to the other tool vars at top of the workflow?

# Required by make generate-bicep-types-contrib to parse defaults.yaml.
run: |
mkdir -p "${RUNNER_TEMP}/bin"
GOBIN="${RUNNER_TEMP}/bin" go install github.com/mikefarah/yq/v4@v4.44.3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as previous comment: can the yq version be an env var similar to the other tool vars at top of the workflow?

Comment thread build/generate.mk
.PHONY: generate-yq-installed
generate-yq-installed:
@echo "$(ARROW) Detecting yq..."
@which yq > /dev/null || { echo "run 'go install github.com/mikefarah/yq/v4@latest' to install yq, then ensure ~/go/bin is on your PATH"; exit 1; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be the same version of yq used in the GitHub workflows.

Comment thread build/generate.mk
echo "Run generator from hack/bicep-types-radius/src/generator dir"; \
CI=true pnpm -C hack/bicep-types-radius/src/generator install && pnpm -C hack/bicep-types-radius/src/generator run generate --specs-dir ../../../../swagger --release-version ${VERSION} --verbose
@echo "$(ARROW) Generating Bicep types for default contrib resource type namespaces..."
@$(MAKE) generate-bicep-types-contrib
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be a prerequisite this target instead of sub call to make? In other words, on line 144 add generate-bicep-types-contrib as a prerequisite like the other two targets on that line.

Comment thread build/generate.mk
Comment on lines +179 to +198
generate-bicep-types-contrib: generate-yq-installed ## Generates Bicep types.json files for default contrib namespaces from defaults.yaml.
# Discover unique namespaces from defaults.yaml.
@NAMESPACES=$$(yq '.defaultRegistration[]' $(DEFAULTS_YAML) | sed 's|/.*||' | sort -u) && \
for ns in $$NAMESPACES; do \
ns_lower=$$(echo "$$ns" | tr '[:upper:]' '[:lower:]') && \
out_dir="$(BICEP_TYPES_OUTPUT_BASE)/$$ns_lower/$(BICEP_TYPES_CONTRIB_API_VERSION)" && \
manifest_args="" && \
for entry in $$(yq '.defaultRegistration[]' $(DEFAULTS_YAML) | grep "^$$ns/"); do \
type_name=$$(echo "$$entry" | cut -d'/' -f2) && \
manifest="$(BICEP_TYPES_CONTRIB_MANIFEST_DIR)/$$type_name.yaml" && \
if [ ! -f "$$manifest" ]; then \
echo "ERROR: Manifest not found: $$manifest (from entry '$$entry')"; \
exit 1; \
fi && \
manifest_args="$$manifest_args $$manifest"; \
done && \
echo " -> $$ns ($$manifest_args) -> $$out_dir" && \
go run ./bicep-tools/cmd/manifest-to-bicep generate $$manifest_args "$$out_dir" && \
mkdir -p "$$out_dir/docs" || exit 1; \
done
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a non-trivial nested shell loop embedded in a Makefile. It is hard to read, hard to test, and easy to break (line continuations, && chains, || exit 1). Strongly consider extracting to build/scripts/generate-bicep-contrib.sh and invoking it from the recipe. That also lets you set -euo pipefail and add shellcheck coverage. Aligns with the project's .github/instructions/shell.instructions.md guidance.

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.

4 participants