Azure/Azure-Spring-Apps

Container deployment fails with Invalid memory quantity '1'

Opened this issue · 4 comments

Describe the bug
Container deployment with Bicep fails with Invalid memory quantity '1'

I have the Bicep below

// https://learn.microsoft.com/en-us/azure/templates/microsoft.appplatform/2022-09-01-preview/spring/apps/deployments?pivots=deployment-language-bicep
resource shellcfgtestappdeployment 'Microsoft.AppPlatform/Spring/apps/deployments@2022-09-01-preview' = {
  name: 'default'
  parent: shellcfgtestapp
  sku: {
    name: azureSpringAppsSkuName
  }
  properties: {
    active: true
    deploymentSettings: {
      containerProbeSettings: {
        disableProbe: true
      }
      resourceRequests: {
        cpu: any(1)
        memory: any(1)
      }
    }
    
    source: {
      version: '1.0.0'
      type: 'Container' // Jar, Container or Source https://learn.microsoft.com/en-us/azure/templates/microsoft.appplatform/2022-09-01-preview/spring/apps/deployments?pivots=deployment-language-bicep#usersourceinfo
      customContainer: {
        /*
        args: [
          'string'
        ]*/
        command: [
          'curl https://asa-petcliasa.svc.azuremicroservices.io/config/'
          'curl https://github.com/ezYakaEagle442/spring-petclinic-microservices-config/blob/main/application.yml'
          'curl https://github.com/ezYakaEagle442/spring-petclinic-microservices-config/Config'
        ]
        containerImage: 'bash' // This should be in the form of {repository}:{tag} without the server name of the registry
        /*imageRegistryCredential: {
          password: 'string'
          username: 'string'
        }*/
        languageFramework: 'string'
        server: 'https://index.docker.io/v1' // The name of the registry that contains the container image
      }
    }
  }
}

It fails with :

ERROR: ***"status":"Failed","error":***"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[***"code":"BadRequest","message":"***\r\n  \"error\": ***\r\n    \"code\": \"BadRequest\",\r\n    \"message\": \"Invalid memory quantity '1'\",\r\n    \"target\": \"value\",\r\n    \"details\": null\r\n  ***\r\n***"***]***
Error: Process completed with exit code 1.

To Reproduce
Steps to reproduce the behavior:

  1. Run https://github.com/ezYakaEagle442/azure-spring-apps-petclinic-mic-srv/blob/azure/.github/workflows/apply-cfg-test-deployments.yml

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
N/A

Additional context

btw what value should set in languageFramework: 'string' ?
is server: 'https://index.docker.io/v1' correct ?
would containerImage: 'bash' be interpreted as bash:latest ?

I have corrected the CPU/memory with string values and that fixed the issue :

resourceRequests: {
  cpu: '1'
  memory: '1Gi'
}   

It now fails with :
ERROR: "status":"Failed","error":"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":["code":"BadRequest","message":"\r\n "error": ***\r\n "code": "BadArgument",\r\n "message": "Invalid arguments: Properties.Source.Version, Properties.Source.RelativePath, Properties.Source.ArtifactSelector, Properties.Source.NetCoreMainEntryPath are incompatible with custom container feature",\r\n "target": null,\r\n "details": [\r\n ***\r\n "code": "BadArgument",\r\n "message": "Properties.Source.Version, Properties.Source.RelativePath, Properties.Source.ArtifactSelector, Properties.Source.NetCoreMainEntryPath are incompatible with custom container feature",\r\n "target": "property.source",\r\n "details": null\r\n ***,\r\n \r\n "code": "BadArgument",\r\n "message": "Property.Source.CustomContainer.LanguageFramework: java is not supported",\r\n "target": "property.source.customContainer.languageFramework",\r\n "details": null\r\n \r\n ]\r\n \r\n"]

Hi @ezYakaEagle442 ,

You can go to https://learn.microsoft.com/en-us/rest/api/azurespringcloud/ for the API documentation to understand what each field is about and what values they accept. For example, the resource requests values are provided at: https://learn.microsoft.com/en-us/rest/api/azurespringapps/deployments/create-or-update?tabs=HTTP#resourcerequests

We recommend to use Azure CLI as it is fully functional and most of the documentation was written with Azure CLI examples. To understand what a CLI command is doing under the scene, you can pass additional arguments --debug --verbose to the CLI command, and it will dump all the HTTP request and response to the console, where you can see what payload (ARM template, or customized action body) is passed to the backend resource provider.

The languageFramework is not well documented: https://learn.microsoft.com/en-us/rest/api/azurespringapps/deployments/create-or-update?tabs=HTTP#customcontainer . I will create a work item to update this.

The backend accept three values: "springboot", "", null (just leave it unspecified).