Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/functional-test-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ jobs:
with:
node-version-file: .node-version

- name: Install yq
# 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?

echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}"
- name: Generate Bicep extensibility types from OpenAPI specs
run: |
make generate-bicep-types VERSION=${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }}
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/functional-test-noncloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ jobs:
with:
node-version-file: .node-version

- name: Install yq
# 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?

echo "${RUNNER_TEMP}/bin" >> "${GITHUB_PATH}"
- name: Generate Bicep extensibility types from OpenAPI specs
run: |
make generate-bicep-types VERSION=${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }}
Expand Down
3 changes: 0 additions & 3 deletions bicepconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
},
"extensions": {
"radius": "br:biceptypes.azurecr.io/radius:latest",
"radiusCompute": "br:biceptypes.azurecr.io/radiuscompute:latest",
"radiusData": "br:biceptypes.azurecr.io/radiusdata:latest",
"radiusSecurity": "br:biceptypes.azurecr.io/radiussecurity:latest",
"aws": "br:biceptypes.azurecr.io/aws:latest"
}
}
74 changes: 74 additions & 0 deletions build/generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,80 @@ generate-bicep-types: generate-node-installed generate-pnpm-installed ## Generat
CI=true pnpm -C hack/bicep-types-radius/src/autorest.bicep install && pnpm -C hack/bicep-types-radius/src/autorest.bicep run build; \
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.

@echo "$(ARROW) Rebuilding unified Bicep types index..."
CI=true pnpm -C hack/bicep-types-radius/src/generator run rebuild-index --release-version ${VERSION}

# Generates Bicep types.json files for the default contrib resource type
# namespaces listed in deploy/manifest/defaults.yaml.
#
# Each entry in defaults.yaml uses <namespace>/<typeName> format
# (e.g. Radius.Compute/containers). This target:
# 1. Reads defaults.yaml to discover which types to include.
# 2. Groups entries by namespace.
# 3. For each namespace, passes ALL per-type manifest files to
# `generate` so they are merged into a single output.
#
# Per-type manifest files live under deploy/manifest/built-in-providers/self-hosted/
# as individual YAML files (e.g. containers.yaml, routes.yaml).
DEFAULTS_YAML := deploy/manifest/defaults.yaml
BICEP_TYPES_CONTRIB_API_VERSION ?= 2025-08-01-preview
BICEP_TYPES_OUTPUT_BASE := hack/bicep-types-radius/generated/radius
BICEP_TYPES_CONTRIB_MANIFEST_DIR := deploy/manifest/built-in-providers/self-hosted

.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.

@echo "$(ARROW) OK"

.PHONY: generate-bicep-types-contrib
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
Comment on lines +179 to +198
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.


# Publishing the unified `radius` Bicep extension. Runnable locally against any
# OCI registry (e.g. a local Zot/CRane-backed registry, or biceptypes.azurecr.io
# after `az acr login`). Both BICEP_PUBLISH_TARGET and the local Bicep CLI must
# be available. CI workflows (added separately) call this target after
# generating types and authenticating to the registry.
#
# Example:
# make publish-bicep-extension BICEP_PUBLISH_TARGET=br:biceptypes.azurecr.io/radius:latest
BICEP_PUBLISH_INDEX := $(BICEP_TYPES_OUTPUT_BASE)/../index.json
BICEP_PUBLISH_TARGET ?=

.PHONY: publish-bicep-extension
publish-bicep-extension: ## Publish the unified `radius` Bicep extension to BICEP_PUBLISH_TARGET. Requires generate-bicep-types to have been run.
@if [ -z "$(BICEP_PUBLISH_TARGET)" ]; then \
echo "ERROR: BICEP_PUBLISH_TARGET must be set (e.g. br:biceptypes.azurecr.io/radius:latest)"; \
exit 1; \
fi
@if [ ! -f "$(BICEP_PUBLISH_INDEX)" ]; then \
echo "ERROR: $(BICEP_PUBLISH_INDEX) does not exist; run 'make generate-bicep-types' first"; \
exit 1; \
fi
@which bicep > /dev/null || { echo "ERROR: 'bicep' CLI not found in PATH"; exit 1; }
@echo "$(ARROW) Publishing Bicep extension index $(BICEP_PUBLISH_INDEX) -> $(BICEP_PUBLISH_TARGET)"
bicep publish-extension "$(BICEP_PUBLISH_INDEX)" --target "$(BICEP_PUBLISH_TARGET)" --force


.PHONY: generate-containerinstance-client
Expand Down
3 changes: 0 additions & 3 deletions build/install-bicep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ cat <<EOF > $OUTPUT_DIR/bicepconfig.json
{
"extensions": {
"radius": "br:biceptypes.azurecr.io/radius:${REL_CHANNEL}",
"radiusCompute": "br:biceptypes.azurecr.io/radiuscompute:${REL_CHANNEL}",
"radiusData": "br:biceptypes.azurecr.io/radiusdata:${REL_CHANNEL}",
"radiusSecurity": "br:biceptypes.azurecr.io/radiussecurity:${REL_CHANNEL}",
"aws": "br:biceptypes.azurecr.io/aws:${REL_CHANNEL}"
}
}
Expand Down
15 changes: 15 additions & 0 deletions hack/bicep-types-radius/generated/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
"Applications.Messaging/rabbitMQQueues@2023-10-01-preview": {
"$ref": "applications/applications.messaging/2023-10-01-preview/types.json#/55"
},
"Radius.Compute/containers@2025-08-01-preview": {
"$ref": "radius/radius.compute/2025-08-01-preview/types.json#/125"
},
"Radius.Compute/persistentVolumes@2025-08-01-preview": {
"$ref": "radius/radius.compute/2025-08-01-preview/types.json#/140"
},
"Radius.Compute/routes@2025-08-01-preview": {
"$ref": "radius/radius.compute/2025-08-01-preview/types.json#/193"
},
"Radius.Core/applications@2025-08-01-preview": {
"$ref": "radius/radius.core/2025-08-01-preview/types.json#/44"
},
Expand All @@ -59,6 +68,12 @@
},
"Radius.Core/terraformConfigs@2025-08-01-preview": {
"$ref": "radius/radius.core/2025-08-01-preview/types.json#/138"
},
"Radius.Data/mySqlDatabases@2025-08-01-preview": {
"$ref": "radius/radius.data/2025-08-01-preview/types.json#/17"
},
"Radius.Security/secrets@2025-08-01-preview": {
"$ref": "radius/radius.security/2025-08-01-preview/types.json#/22"
}
},
"resourceFunctions": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"resources": {
"Radius.Compute/containers@2025-08-01-preview": {
"$ref": "types.json#/125"
},
"Radius.Compute/persistentVolumes@2025-08-01-preview": {
"$ref": "types.json#/140"
},
"Radius.Compute/routes@2025-08-01-preview": {
"$ref": "types.json#/193"
}
},
"resourceFunctions": {},
"settings": {
"name": "radiusradiuscompute",
"version": "0.0.1"
}
}
Loading
Loading