Skip to content

Commit

Permalink
fix: avm/ptn/ai-platform/baseline Fix compute name and VM username …
Browse files Browse the repository at this point in the history
…for tests (#3047)

## Description

<!--
>Thank you for your contribution !
> Please include a summary of the change and which issue is fixed.
> Please also include the context.
> List any dependencies that are required for this change.

Fixes #123
Fixes #456
Closes #123
Closes #456
-->

* Fixes compute name by appending `serviceShort` (aipbmax) to the
compute name
* Currently, it fails if `substring(uniqueString(baseTime), 0, 3)`
produces three numbers
  * The constraint is:
```
A name for an Azure ML Compute Instance must be between 3 and 24 characters in length and must use only numbers, letters and minus symbol (-),must start with letters. Numbers cannot be the ending of the name if the previous character is a minus symbol (-). Please specify a different Azure ML Instance name
```
* Hardcodes VM username so retries have a greater chance of succeeding,
as username cannot be changed once the VM has been created
* Uses same username as `avm/res/compute/virtual-machine` module uses in
its tests

## Pipeline Reference

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

| Pipeline |
| -------- |
|
[![avm.ptn.ai-platform.baseline](https://github.com/cecheta/bicep-registry-modules/actions/workflows/avm.ptn.ai-platform.baseline.yml/badge.svg?branch=compute-name)](https://github.com/cecheta/bicep-registry-modules/actions/workflows/avm.ptn.ai-platform.baseline.yml)
|

## Type of Change

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

- [ ] Update to CI Environment or utilities (Non-module affecting
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.
- [x] 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

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [ ] My corresponding pipelines / checks run clean and green without
any errors or warnings

<!-- Please keep up to date with the contribution guide at
https://aka.ms/avm/contribute/bicep -->
  • Loading branch information
cecheta authored Aug 15, 2024
1 parent d18aa72 commit a445890
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
12 changes: 6 additions & 6 deletions avm/ptn/ai-platform/baseline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
// Non-required parameters
virtualMachineConfiguration: {
adminPassword: '<adminPassword>'
adminUsername: '<adminUsername>'
adminUsername: 'localAdminUser'
}
}
}
Expand All @@ -133,7 +133,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
"virtualMachineConfiguration": {
"value": {
"adminPassword": "<adminPassword>",
"adminUsername": "<adminUsername>"
"adminUsername": "localAdminUser"
}
}
}
Expand Down Expand Up @@ -197,7 +197,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
}
virtualMachineConfiguration: {
adminPassword: '<adminPassword>'
adminUsername: '<adminUsername>'
adminUsername: 'localAdminUser'
enableAadLoginExtension: true
enableAzureMonitorAgent: true
enabled: true
Expand Down Expand Up @@ -338,7 +338,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
"virtualMachineConfiguration": {
"value": {
"adminPassword": "<adminPassword>",
"adminUsername": "<adminUsername>",
"adminUsername": "localAdminUser",
"enableAadLoginExtension": true,
"enableAzureMonitorAgent": true,
"enabled": true,
Expand Down Expand Up @@ -551,7 +551,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
}
virtualMachineConfiguration: {
adminPassword: '<adminPassword>'
adminUsername: '<adminUsername>'
adminUsername: 'localAdminUser'
enableAadLoginExtension: true
enableAzureMonitorAgent: true
maintenanceConfigurationResourceId: '<maintenanceConfigurationResourceId>'
Expand Down Expand Up @@ -601,7 +601,7 @@ module baseline 'br/public:avm/ptn/ai-platform/baseline:<version>' = {
"virtualMachineConfiguration": {
"value": {
"adminPassword": "<adminPassword>",
"adminUsername": "<adminUsername>",
"adminUsername": "localAdminUser",
"enableAadLoginExtension": true,
"enableAzureMonitorAgent": true,
"maintenanceConfigurationResourceId": "<maintenanceConfigurationResourceId>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ param baseTime string = utcNow('u')
@description('Optional. A token to inject into the name of each resource.')
param namePrefix string = '#_namePrefix_#'

@description('Generated. The username to leverage for the login.')
@secure()
param username string = uniqueString(newGuid())

@description('Generated. The password to leverage for the login.')
@secure()
param password string = newGuid()
Expand Down Expand Up @@ -54,7 +50,7 @@ module testDeployment '../../../main.bicep' = [
params: {
name: '${namePrefix}${serviceShort}${substring(uniqueString(baseTime), 0, 3)}'
virtualMachineConfiguration: {
adminUsername: username
adminUsername: 'localAdminUser'
adminPassword: password
}
}
Expand Down
8 changes: 2 additions & 6 deletions avm/ptn/ai-platform/baseline/tests/e2e/max/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ param baseTime string = utcNow('u')
@description('Optional. A token to inject into the name of each resource.')
param namePrefix string = '#_namePrefix_#'

@description('Generated. The username to leverage for the login.')
@secure()
param username string = uniqueString(newGuid())

@description('Generated. The password to leverage for the login.')
@secure()
param password string = newGuid()
Expand Down Expand Up @@ -116,7 +112,7 @@ module testDeployment '../../../main.bicep' = [
name: take('${namePrefix}-vm-${serviceShort}', 15)
zone: 0
size: 'Standard_DS1_v2'
adminUsername: username
adminUsername: 'localAdminUser'
adminPassword: password
nicConfigurationConfiguration: {
name: '${namePrefix}-nic-${serviceShort}'
Expand Down Expand Up @@ -152,7 +148,7 @@ module testDeployment '../../../main.bicep' = [
computes: [
{
computeType: 'ComputeInstance'
name: 'compute-${substring(uniqueString(baseTime), 0, 3)}'
name: 'c-${substring(uniqueString(baseTime), 0, 3)}-${serviceShort}'
description: 'Default'
location: resourceLocation
properties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ param baseTime string = utcNow('u')
@description('Optional. A token to inject into the name of each resource.')
param namePrefix string = '#_namePrefix_#'

@description('Generated. The username to leverage for the login.')
@secure()
param username string = uniqueString(newGuid())

@description('Generated. The password to leverage for the login.')
@secure()
param password string = newGuid()
Expand Down Expand Up @@ -65,7 +61,7 @@ module testDeployment '../../../main.bicep' = [
params: {
name: '${namePrefix}${serviceShort}${substring(uniqueString(baseTime), 0, 3)}'
virtualMachineConfiguration: {
adminUsername: username
adminUsername: 'localAdminUser'
adminPassword: password
enableAadLoginExtension: true
enableAzureMonitorAgent: true
Expand Down

0 comments on commit a445890

Please sign in to comment.