0

Getting below error

ERROR: The command failed with an unexpected error. Here is the traceback: ERROR: 'NoneType' object is not callable Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke

pool: 
  vmImage: ubuntu-latest

stages:
  - stage: ACR_cleanup
    jobs:
      - job: acr_cleanup
        steps:
          - task: AzureCLI@2
            displayName: Azure CLI
            inputs:
              azureSubscription: Cleanup_SC
              scriptType: bash
              scriptLocation: inlineScript
              inlineScript: |
                az --version
                az account show
                az acr run --cmd "acr purge --filter 'my-image:.*' --ago 30d --untagged" --registry <> /dev/null

Changed pipeline to variable but same error

variables:
- name: purge_cmd
  value: acr purge --filter 'image:.*' --ago 30d --untagged --dry-run

#Resource pool to use
pool: 
  vmImage: ubuntu-latest

stages:
  - stage: ACR_cleanup
    jobs:
      - job: acr_cleanup
        steps:
          - task: AzureCLI@2
            displayName: Azure CLI
            inputs:
              azureSubscription: Cleanup_SC
              scriptType: bash
              scriptLocation: inlineScript
              inlineScript: |
                az --version
                az account show
                az acr run --cmd "$(purge_cmd)" --registry <> /dev/null

Tried in local PowerShell cmd with azure cli getting a proper response for below command

 $PURGE_CMD="acr purge --filter 'image:.*' --ago 30d --untagged --dry-run"                                                                                                                                                  
 az acr run --cmd "$PURGE_CMD" --registry <registry> /dev/null  
James Z
  • 12,209
  • 10
  • 24
  • 44
Rajesh174u
  • 29
  • 1
  • 6

1 Answers1

0

az cli version 2.26.1 only supports the same. The current latest image cli version is 2.26.0

Rajesh174u
  • 29
  • 1
  • 6