Skip to content

Commit

Permalink
fix: Temporarily disabled OpenAI test (Azure#1826)
Browse files Browse the repository at this point in the history
## 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

<!-- Insert your Pipeline Status Badge below -->

| 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

<!-- Use the check-boxes [x] on the options that are relevant. -->

- [ ] 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
  • Loading branch information
AlexanderSehr authored and hundredacres committed Jun 19, 2024
1 parent e6221ae commit 4e927eb
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
8 changes: 7 additions & 1 deletion avm/res/cognitive-services/account/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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



<details>
Expand Down
2 changes: 1 addition & 1 deletion avm/res/cognitive-services/account/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions avm/res/cognitive-services/account/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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')]",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 //
Expand Down Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.<br>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"

}
}
}

0 comments on commit 4e927eb

Please sign in to comment.