diff --git a/.github/scripts/validate-bicep.sh b/.github/scripts/validate-bicep.sh index e465794..a5f508e 100755 --- a/.github/scripts/validate-bicep.sh +++ b/.github/scripts/validate-bicep.sh @@ -4,12 +4,13 @@ then BICEP_EXECUTABLE="$BICEP_PATH/rad-bicep" fi +WARNING_MSG="WARNING: The following experimental Bicep features" FILES=$(find . -type f -name "*.bicep") FAILURES=() for F in $FILES do echo "validating $F" - # We need to run the rad-bicep and fail in one of two cases: + # We need to run rad-bicep and fail in one of two cases: # - non-zero exit code # - non-empty stderr # @@ -24,7 +25,7 @@ do EXITCODE=$? exec 3>&- - if [[ ! $EXITCODE -eq 0 || ! -z $STDERR ]] + if [[ ! $EXITCODE -eq 0 || (! -z $STDERR && ! $STDERR == $WARNING_MSG* && ! $STDERR == *"Error"* ) ]] then echo $STDERR FAILURES+=$F diff --git a/.github/workflows/validate-bicep.yaml b/.github/workflows/validate-bicep.yaml index 9d7a2f5..8095488 100644 --- a/.github/workflows/validate-bicep.yaml +++ b/.github/workflows/validate-bicep.yaml @@ -35,15 +35,13 @@ jobs: name: Validate Bicep Code runs-on: ubuntu-latest steps: - - name: Check out repo - uses: actions/checkout@v3 - - name: Parse release version and set environment variables - run: python ./.github/scripts/get_release_version.py - - name: Download rad-bicep - run: | - ./.github/scripts/curl-with-retries.sh https://get.radapp.dev/tools/bicep-extensibility/${{ env.REL_CHANNEL }}/linux-x64/rad-bicep --output rad-bicep - chmod +x rad-bicep - ./rad-bicep --version + - name: Setup and verify bicep CLI + run: | + curl -Lo rad-bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 + chmod +x ./rad-bicep + ./rad-bicep --version + - name: Check out repo + uses: actions/checkout@v4 - name: Verify Bicep files run: ./.github/scripts/validate-bicep.sh env: diff --git a/README.md b/README.md index 0d519db..2994f63 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ rad recipe register azure \ ### Bicep ```bicep -import radius as rad +extension radius resource myenv 'Applications.Core/environments' = { name: 'myenv' diff --git a/aws/rediscaches.bicep b/aws/rediscaches.bicep index ce1cf6f..251a1c8 100644 --- a/aws/rediscaches.bicep +++ b/aws/rediscaches.bicep @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import aws as aws +extension aws @description('Radius-provided object containing information about the resource calling the Recipe') param context object diff --git a/aws/sqldatabases.bicep b/aws/sqldatabases.bicep index e3bcdd2..2b2fd8c 100644 --- a/aws/sqldatabases.bicep +++ b/aws/sqldatabases.bicep @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import aws as aws +extension aws @description('Radius-provided object containing information about the resource calling the Recipe') param context object diff --git a/azure/statestores.bicep b/azure/statestores.bicep index 5fba53e..5f348aa 100644 --- a/azure/statestores.bicep +++ b/azure/statestores.bicep @@ -54,10 +54,10 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = { } } -import kubernetes as k8s { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as k8s var daprType = 'state.azure.blobstorage' var daprVersion = 'v1' diff --git a/bicepconfig.json b/bicepconfig.json new file mode 100644 index 0000000..65aa584 --- /dev/null +++ b/bicepconfig.json @@ -0,0 +1,11 @@ +{ + "experimentalFeaturesEnabled": { + "extensibility": true, + "extensionRegistry": true, + "dynamicTypeLoading": true + }, + "extensions": { + "radius": "br:biceptypes.azurecr.io/radius:latest", + "aws": "br:biceptypes.azurecr.io/aws:latest" + } +} \ No newline at end of file diff --git a/docs/contributing/contributing-recipes.md b/docs/contributing/contributing-recipes.md index 744b613..f7d9d51 100644 --- a/docs/contributing/contributing-recipes.md +++ b/docs/contributing/contributing-recipes.md @@ -53,7 +53,7 @@ To test the recipe locally, follow the steps below: **Via Radius environment bicep** ```bicep - import radius as radius + extension radius resource env 'Applications.Core/environments@2023-10-01-preview' = { name: 'prod' properties: { diff --git a/local-dev/extender-postgresql.bicep b/local-dev/extender-postgresql.bicep index 349c9a9..5aa383d 100644 --- a/local-dev/extender-postgresql.bicep +++ b/local-dev/extender-postgresql.bicep @@ -37,10 +37,10 @@ param memoryRequest string = '512Mi' @description('Memory limit for the postgres deployment') param memoryLimit string = '1024Mi' -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var uniqueName = 'postgres-${uniqueString(context.resource.id)}' var port = 5432 diff --git a/local-dev/mongodatabases.bicep b/local-dev/mongodatabases.bicep index eba3c2d..7f64a1f 100644 --- a/local-dev/mongodatabases.bicep +++ b/local-dev/mongodatabases.bicep @@ -28,10 +28,10 @@ param username string = 'admin' #disable-next-line secure-parameter-default param password string = 'Password1234==' -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var uniqueName = 'mongo-${uniqueString(context.resource.id)}' var port = 27017 diff --git a/local-dev/pubsubbrokers.bicep b/local-dev/pubsubbrokers.bicep index 609af5a..40a6b95 100644 --- a/local-dev/pubsubbrokers.bicep +++ b/local-dev/pubsubbrokers.bicep @@ -26,10 +26,10 @@ param memoryRequest string = '128Mi' @description('Memory limit for the redis deployment') param memoryLimit string = '1024Mi' -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var uniqueName = 'daprpubsub-${uniqueString(context.resource.id)}' var port = 6379 diff --git a/local-dev/rabbitmqqueues.bicep b/local-dev/rabbitmqqueues.bicep index fbf2820..57c9cce 100644 --- a/local-dev/rabbitmqqueues.bicep +++ b/local-dev/rabbitmqqueues.bicep @@ -29,10 +29,10 @@ param memoryRequest string = '256Mi' @description('Memory limit for the rabbitmq deployment') param memoryLimit string = '1024Mi' -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var uniqueName = 'rabbitmq-${uniqueString(context.resource.id)}' var port = 5672 diff --git a/local-dev/rediscaches.bicep b/local-dev/rediscaches.bicep index d153170..177e9c8 100644 --- a/local-dev/rediscaches.bicep +++ b/local-dev/rediscaches.bicep @@ -17,10 +17,10 @@ limitations under the License. @description('Information about what resource is calling this Recipe. Generated by Radius. For more information visit https://docs.radapp.dev/operations/custom-recipes/') param context object -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes resource redis 'apps/Deployment@v1' = { metadata: { diff --git a/local-dev/secretstores.bicep b/local-dev/secretstores.bicep index a1acf9e..90132c4 100644 --- a/local-dev/secretstores.bicep +++ b/local-dev/secretstores.bicep @@ -17,10 +17,10 @@ limitations under the License. @description('Information about what resource is calling this Recipe. Generated by Radius. For more information visit https://docs.radapp.dev/operations/custom-recipes/') param context object -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var daprType = 'secretstores.kubernetes' var daprVersion = 'v1' diff --git a/local-dev/sqldatabases.bicep b/local-dev/sqldatabases.bicep index 377991a..b243d06 100644 --- a/local-dev/sqldatabases.bicep +++ b/local-dev/sqldatabases.bicep @@ -40,10 +40,10 @@ param memoryLimit string = '1024Mi' @description('Initial catalog to connect to. Defaults to empty string (no initial catalog).') param initialCatalog string = '' -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var uniqueName = 'sql-${uniqueString(context.resource.id)}' var port = 1433 diff --git a/local-dev/statestores.bicep b/local-dev/statestores.bicep index 2582e35..55175ff 100644 --- a/local-dev/statestores.bicep +++ b/local-dev/statestores.bicep @@ -29,10 +29,10 @@ param memoryRequest string = '128Mi' @description('Memory limit for the redis deployment') param memoryLimit string = '1024Mi' -import kubernetes as kubernetes { +extension kubernetes with { kubeConfig: '' namespace: context.runtime.kubernetes.namespace -} +} as kubernetes var uniqueName = 'daprstate-${uniqueString(context.resource.id)}' var port = 6379 diff --git a/tests/test-local-dev-recipes.bicep b/tests/test-local-dev-recipes.bicep index 0523452..01649b4 100644 --- a/tests/test-local-dev-recipes.bicep +++ b/tests/test-local-dev-recipes.bicep @@ -1,4 +1,4 @@ -import radius as radius +extension radius @description('Specifies the image for the container resource.') param magpieimage string @@ -9,10 +9,10 @@ param registry string @description('The OCI tag for test Bicep recipes.') param version string -import kubernetes as kubernetes { +extension kubernetes with { namespace: 'daprrp-rs-secretstore-recipe' kubeConfig: '' -} +} as kubernetes resource env 'Applications.Core/environments@2023-10-01-preview' = { name: 'local-dev-recipe-env'