microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
370 stars 29 forks source link

Internal Server Error when trying to deploy Container Apps Job using DevOps Pipelines with task AzureCLI@2 #894

Closed tjoudeh closed 11 months ago

tjoudeh commented 1 year ago

Please provide us with the following information:

This issue is a: (mark with an x)

Issue description

When trying to configure Azure DevOps Pieplines to deploy an ACA Job, the task AzureCLI@2 which calls this inline script az containerapp job update -n "ca-job-1" -g "rg-xxxx" --image "xxxxx.azurecr.io/ca-job-1:latest" throws an ERROR: (InternalServerError) Internal server error occurred. correlation ID: f0361b8e-0d07-468c-807d-8fcfc4cdde3d

Please note the value of the correlation id f0361b8e-0d07-468c-807d-8fcfc4cdde3d is it might have insider logs which will help troubleshoot the issue.

Below is the complete yaml file of the piepline

# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker

trigger:
 branches:
   include:
     - master
 paths:
   include:
     - 'xxxxxPoc/**'
     - 'ca-job-1.yml'

resources:
- repo: self

variables:
  # Container registry service connection established during pipeline creation
  resourceGroup: xxxx
  containerAppJob: xx-xxx-1
  containerAppEnv: xxxxx-env-poc
  dockerRegistryServiceConnection: 'xxxxxxxx-xxxxx-42c0-bf54-b8c9110724e5'
  imageRepository: '$(containerAppJob)'
  containerRegistry: 'xxxx.azurecr.io'
  dockerfilePath: 'xxxxx/Dockerfile'
  tag: '$(Build.BuildId)'

  # Agent VM image name
  vmImageName: 'ubuntu-latest'

stages:
- stage: Build
  displayName: Build and push image to registry
  jobs:
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: Docker@2
      displayName: Build and push an image to container registry
      inputs:
        command: buildAndPush
        repository: $(imageRepository)
        dockerfile: $(dockerfilePath)
        containerRegistry: $(dockerRegistryServiceConnection)
        buildContext: ./.
        tags: |
          $(tag)
          latest

- stage: Deploy
  displayName: Deploy to Container Apps Job
  jobs:
  - job: Deploy
    displayName: Deploy
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: AzureCLI@2
      inputs:
        azureSubscription: 'azure-connection-rg-xxxxx'
        scriptType: 'bash'
        scriptLocation: 'inlineScript'
        inlineScript: 'az containerapp job update -n "ca-job-1" -g "xxxxx" --image "xxxx.azurecr.io/ca-job-1:latest"'
        failOnStandardError: false

Expected behavior

Deployment should be complete

Actual behavior

Failure happens on task AzureCLI@2, below are the error logs:

==============================================================================
Task         : Azure CLI
Description  : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version      : 2.225.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
/usr/bin/az --version
azure-cli                         2.51.0

core                              2.51.0
telemetry                          1.1.0

Extensions:
azure-devops                      0.26.0

Dependencies:
msal                            1.24.0b1
azure-mgmt-resource             23.1.0b2

Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'

Python (Linux) 3.10.10 (main, Jul 27 2023, 07:10:25) [GCC 11.3.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.
Setting AZURE_CONFIG_DIR env variable to: /home/vsts/work/_temp/.azclitask
Setting active cloud to: AzureCloud
/usr/bin/az cloud set -n AzureCloud
/usr/bin/az login --service-principal -u *** --password=*** --tenant xxxxxxxxxx-b12e-67ceb9132d81 --allow-no-subscriptions
[
  {
    "cloudName": "AzureCloud",
    "homeTenantId": "xxxxxxxx-b12e-67ceb9132d81",
    "id": "xxxxxxxb468-8949967633b3",
    "isDefault": true,
    "managedByTenants": [],
    "name": "xxxxxx",
    "state": "Enabled",
    "tenantId": "xxxxxxxx12e-67ceb9132d81",
    "user": {
      "name": "***",
      "type": "servicePrincipal"
    }
  }
]
/usr/bin/az account set --subscription d3c5ad1a-5f4f-45b2-b468-8949967633b3
/usr/bin/bash /home/vsts/work/_temp/azureclitaskscript1693881429636.sh
WARNING: The command requires the extension containerapp. It will be installed first.
WARNING: The installed extension 'containerapp' is in preview.
ERROR: (InternalServerError) Internal server error occurred. correlation ID: **f0361b8e-0d07-468c-807d-8fcfc4cdde3d**
##[error]Script failed with exit code: 1
/usr/bin/az account clear
Finishing: AzureCLI

Screenshots
image

vinisoto commented 1 year ago

Hi, we have identified bug and are preparing a fix. Will update with the ETA

vinisoto commented 1 year ago

The rollout with the fix has started. ETA for completion is 10/4

vinisoto commented 1 year ago

Hi, the fix for this has been deployed.