azuregithub-actionsazure-cliazure-container-registryazure-container-apps

Github Action to deploy to Azure fails (no changes made) - "Containerapp does not exist"


Our deployments have recently started failing with the following error, despite no changes made to Azure, GitHub, or the workflow file:

ERROR: The containerapp 'sample-name' does not exist

To troubleshoot, I added a step before this to confirm the container exists, which proves that it does (and the name has not changed):

Run az containerapp show --name sample-name --resource-group primary-resourcegroup

***
  "id": ...,
  "location": ...,
  "name": "sample-name",
  "properties": 
    ...
    "provisioningState": "Succeeded",
    "runningStatus": "Running"
    ...
  ...
  "type": "Microsoft.App/containerApps"
***

Here is the relevant section of my workflow file:

deploy:
    runs-on: ubuntu-latest
    needs: build

    steps:
      - name: Azure Login
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

      - name: Check if container app exists
        run: |
            az containerapp show --name sample-name --resource-group primary-resourcegroup

      - name: Deploy to containerapp
        uses: azure/CLI@v1
        with:
          azcliversion: 2.50.0
          inlineScript: |
            az config set extension.use_dynamic_install=yes_without_prompt
            az extension add --name containerapp --upgrade
            az containerapp registry set -n sample-name -g primary-resourcegroup --server xxx.azurecr.io --username  ${{ secrets.REGISTRY_USERNAME }} --password ${{ secrets.REGISTRY_PASSWORD }}
            az containerapp update -n sample-name --cpu 0.75 --memory 1.5Gi -g primary-resourcegroup --image xxx.azurecr.io/xxx:${{ github.sha }}

I have tried stopping/starting the container app. I'm at a point where my last resort will be to delete it and recreate it, but this is a headache I'm trying to avoid given all of the settings and whatnot I'd have to transfer/recreate.

Thank you.


Solution

  • I'm not quite sure what changed, but using the latest azcliversion fixed the issue.