Skip to content

Commit

Permalink
update bicep references
Browse files Browse the repository at this point in the history
Signed-off-by: sk593 <[email protected]>
  • Loading branch information
sk593 committed Aug 1, 2024
1 parent 023ec31 commit 67b2eef
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .github/scripts/validate-bicep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/validate-bicep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rad recipe register azure \
### Bicep

```bicep
import radius as rad
extension radius
resource myenv 'Applications.Core/environments' = {
name: 'myenv'
Expand Down
2 changes: 1 addition & 1 deletion aws/rediscaches.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion aws/sqldatabases.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions azure/statestores.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
11 changes: 11 additions & 0 deletions bicepconfig.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
2 changes: 1 addition & 1 deletion docs/contributing/contributing-recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions local-dev/extender-postgresql.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions local-dev/mongodatabases.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions local-dev/pubsubbrokers.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions local-dev/rabbitmqqueues.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions local-dev/rediscaches.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions local-dev/secretstores.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions local-dev/sqldatabases.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions local-dev/statestores.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/test-local-dev-recipes.bicep
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import radius as radius
extension radius

@description('Specifies the image for the container resource.')
param magpieimage string
Expand All @@ -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'
Expand Down

0 comments on commit 67b2eef

Please sign in to comment.