From 2e753f7df26cd8269721b01250b926ac26376ce3 Mon Sep 17 00:00:00 2001 From: Alexander Sehr Date: Fri, 3 May 2024 01:06:36 +0200 Subject: [PATCH] fix: Temporarily disabled OpenAI test (#1826) ## Description - Removed identity warning - Disabled the deployed as described above with an impossible condition - Added a big disclaimer to the test's description - Added a post-deployment tests which's only purpose it is to also add a warning to the workflow output ![image](https://github.com/Azure/bicep-registry-modules/assets/5365358/e27f5fa9-54f6-4327-ace8-1905ab400bf3) ## Pipeline Reference | Pipeline | | -------- | | [![avm.res.cognitive-services.account](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.cognitive-services.account.yml/badge.svg?branch=users%2Falsehr%2FcognitiveServicesDisableTest)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.cognitive-services.account.yml) | ## Type of Change - [ ] Update to CI Environment or utlities (Non-module effecting changes) - [x] Azure Verified Module updates: - [ ] Bugfix containing backwards compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation --- avm/res/cognitive-services/account/README.md | 8 ++++++- avm/res/cognitive-services/account/main.bicep | 2 +- avm/res/cognitive-services/account/main.json | 6 ++--- .../e2e/ai-model-deployment/main.test.bicep | 11 +++++++-- .../e2e/ai-model-deployment/warning.tests.ps1 | 24 +++++++++++++++++++ 5 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/warning.tests.ps1 diff --git a/avm/res/cognitive-services/account/README.md b/avm/res/cognitive-services/account/README.md index 820802cdb8..e5804e0da1 100644 --- a/avm/res/cognitive-services/account/README.md +++ b/avm/res/cognitive-services/account/README.md @@ -41,7 +41,13 @@ The following section provides usage examples for the module, which were used to ### Example 1: _Using `deployments` in parameter set_ -This instance deploys the module with the AI model deployment feature. +This instance deploys the module with the AI model deployment feature.' + +Note, this test is temporarily disabled as it needs to be enabled on the subscription. +As we don't want other contributions from being blocked by this, we disabled the test for now / rely on a manual execution outside the CI environemnt +You can find more information here: https://learn.microsoft.com/en-us/legal/cognitive-services/openai/limited-access +And register here: https://aka.ms/oai/access +
diff --git a/avm/res/cognitive-services/account/main.bicep b/avm/res/cognitive-services/account/main.bicep index 293821f9b8..07ffb63489 100644 --- a/avm/res/cognitive-services/account/main.bicep +++ b/avm/res/cognitive-services/account/main.bicep @@ -137,7 +137,7 @@ var formattedUserAssignedIdentities = reduce( var identity = !empty(managedIdentities) ? { type: (managedIdentities.?systemAssigned ?? false) - ? (!empty(managedIdentities.?userAssignedResourceIds ?? {}) ? 'SystemAssigned,UserAssigned' : 'SystemAssigned') + ? (!empty(managedIdentities.?userAssignedResourceIds ?? {}) ? 'SystemAssigned, UserAssigned' : 'SystemAssigned') : (!empty(managedIdentities.?userAssignedResourceIds ?? {}) ? 'UserAssigned' : null) userAssignedIdentities: !empty(formattedUserAssignedIdentities) ? formattedUserAssignedIdentities : null } diff --git a/avm/res/cognitive-services/account/main.json b/avm/res/cognitive-services/account/main.json index 7c8c756cb7..7c1ff98ca5 100644 --- a/avm/res/cognitive-services/account/main.json +++ b/avm/res/cognitive-services/account/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.26.54.24096", - "templateHash": "2360701930449304487" + "version": "0.26.170.59819", + "templateHash": "5668118199015896027" }, "name": "Cognitive Services", "description": "This module deploys a Cognitive Service.", @@ -766,7 +766,7 @@ }, "variables": { "formattedUserAssignedIdentities": "[reduce(map(coalesce(tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'), createArray()), lambda('id', createObject(format('{0}', lambdaVariables('id')), createObject()))), createObject(), lambda('cur', 'next', union(lambdaVariables('cur'), lambdaVariables('next'))))]", - "identity": "[if(not(empty(parameters('managedIdentities'))), createObject('type', if(coalesce(tryGet(parameters('managedIdentities'), 'systemAssigned'), false()), if(not(empty(coalesce(tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'), createObject()))), 'SystemAssigned,UserAssigned', 'SystemAssigned'), if(not(empty(coalesce(tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'), createObject()))), 'UserAssigned', null())), 'userAssignedIdentities', if(not(empty(variables('formattedUserAssignedIdentities'))), variables('formattedUserAssignedIdentities'), null())), null())]", + "identity": "[if(not(empty(parameters('managedIdentities'))), createObject('type', if(coalesce(tryGet(parameters('managedIdentities'), 'systemAssigned'), false()), if(not(empty(coalesce(tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'), createObject()))), 'SystemAssigned, UserAssigned', 'SystemAssigned'), if(not(empty(coalesce(tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'), createObject()))), 'UserAssigned', null())), 'userAssignedIdentities', if(not(empty(variables('formattedUserAssignedIdentities'))), variables('formattedUserAssignedIdentities'), null())), null())]", "builtInRoleNames": { "Cognitive Services Contributor": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '25fbc0a9-bd7c-42a3-aa1a-3b75d497ee68')]", "Cognitive Services Custom Vision Contributor": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'c1ff6cc2-c111-46fe-8896-e0ef812ad9f3')]", diff --git a/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/main.test.bicep b/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/main.test.bicep index 7ee3f5be51..60d04523d3 100644 --- a/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/main.test.bicep +++ b/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/main.test.bicep @@ -1,7 +1,14 @@ targetScope = 'subscription' metadata name = 'Using `deployments` in parameter set' -metadata description = 'This instance deploys the module with the AI model deployment feature.' +metadata description = ''' +This instance deploys the module with the AI model deployment feature.' + +Note, this test is temporarily disabled as it needs to be enabled on the subscription. +As we don't want other contributions from being blocked by this, we disabled the test for now / rely on a manual execution outside the CI environemnt +You can find more information here: https://learn.microsoft.com/en-us/legal/cognitive-services/openai/limited-access +And register here: https://aka.ms/oai/access +''' // ========== // // Parameters // @@ -36,7 +43,7 @@ resource resourceGroup 'Microsoft.Resources/resourceGroups@2022-09-01' = { // ============== // module testDeployment '../../../main.bicep' = [ - for iteration in ['init', 'idem']: { + for iteration in ['init', 'idem']: if (true == false) { scope: resourceGroup name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}-ai' params: { diff --git a/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/warning.tests.ps1 b/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/warning.tests.ps1 new file mode 100644 index 0000000000..21deb1f6a3 --- /dev/null +++ b/avm/res/cognitive-services/account/tests/e2e/ai-model-deployment/warning.tests.ps1 @@ -0,0 +1,24 @@ +###################################### +## Additional post-deployment tests ## +###################################### +## +## You can add any custom post-deployment validation tests you want here, or add them spread accross multiple test files in the test case folder. +## +########################### + +param ( + [Parameter(Mandatory = $false)] + [hashtable] $TestInputData = @{} +) + +Describe 'Warning' { + + It 'Disabled test' { + + Write-Output @{ + Warning = "Note, the OpenAI-Deployments test is temporarily disabled as it needs to be enabled on the subscription.
As we don't want other contributions from being blocked by this, we disabled the test for now / rely on a manual execution outside the CI environemnt. For more information please review the [offical docs](https://learn.microsoft.com/en-us/legal/cognitive-services/openai/limited-access) and or register [here](https://aka.ms/oai/access" + + } + } +} +