Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az containerapp update does not fail when the yaml file points to a non-existent image #30053

Closed
sonofhammer opened this issue Oct 8, 2024 · 9 comments
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. Container Instances az container ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.

Comments

@sonofhammer
Copy link

sonofhammer commented Oct 8, 2024

Describe the bug

az container app update does not fail when yaml file points to a nonexistent container image.

To reproduce

  1. create a container app with a hello world image

az containerapp create -n 'example' -g 'my-rg' --yaml .\app.yaml

Example file:

environmentId: <INSERT ENVIRONMENT ID HERE>
properties:
  configuration:
    activeRevisionsMode: Single
    maxInactiveRevisions: 100
  template:
    containers:
    - image: mcr.microsoft.com/azuredocs/containerapps-helloworld:latest
      name: examplecontainerapp
      probes: []
      resources:
        cpu: 0.25
        ephemeralStorage: 1Gi
        memory: 0.5Gi
    revisionSuffix: ''
    scale:
      maxReplicas: 10
      minReplicas: 1
      rules:
      - http:
          metadata:
            concurrentRequests: '10'
        name: http-scaler
  1. modify the file and replace the image with a nonexistent image, for example:
...
template:
    containers:
    - image: mcr.microsoft.com/azuredocs/containerapps-helloworld:nonexistent
...
  1. run az containerapp update

az containerapp update -n 'example' -g 'my-rg' --yaml .\app.yaml

  1. observe that the az cli exits with zero but the output shows a provisioning state of "failed." Also, note that the container image property has not been updated.
    "provisioningState": "Failed",
    "runningStatus": "Running",
    "template": {
      "containers": [
        {
          "image": "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest",
          "name": "examplecontainerapp",
          "probes": [],
          "resources": {
            "cpu": 0.25,
            "ephemeralStorage": "1Gi",
            "memory": "0.5Gi"
          }
        }
      ],
  1. using the same container app file with an image that doesn't exist run az containerapp create

az containerapp create -n 'example2' -g 'my-rg' --yaml .\app.yaml

  1. observe that the run fails with
Failed to provision revision for container app 'example2'. Error details: The following field(s) are either invalid or missing. Field 'template.containers.examplecontainerapp.image' is invalid with details: 'Invalid value: "mcr.microsoft.com/azuredocs/containerapps-helloworld:nonexistent": GET https:: MANIFEST_UNKNOWN: manifest tagged by "nonexistent" is not found; map[Tag:nonexistent]';

Related command

az containerapp update

Errors

n/a it doesn't error when it should

Issue script & Debug output

n/a. this is easily reproducible with a few command line calls.

Expected behavior

Desired resolution

az containerapp update should fail just like az containerapp create when the yaml file points to a container image that doesn't exist.

Environment Summary

azure-cli 2.61.0 *

core 2.61.0 *
telemetry 1.1.0

Extensions:
azure-devops 1.0.0
containerapp 0.3.50

Dependencies:
msal 1.28.0
azure-mgmt-resource 23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\DaniilM.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

@sonofhammer sonofhammer added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 8, 2024
Copy link

Hi @sonofhammer,

2.61.0 is not the latest Azure CLI(2.65.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Oct 8, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 8, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Container Instances az container Service Attention This issue is responsible by Azure service team. ContainerApp labels Oct 8, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dkkapur.

Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.

@sonofhammer
Copy link
Author

Behavior is the same on the latest version of az and extensions

azure-cli                         2.65.0

core                              2.65.0
telemetry                          1.1.0

Extensions:
azure-devops                       1.0.1
containerapp                     1.0.0b3

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\DaniilM\.azure\cliextensions'

Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

@sonofhammer
Copy link
Author

I recognize that this may be more of a container app environment api issue than an az cli issue in and of itself.

@sonofhammer sonofhammer changed the title az container app update does not fail when the yaml file points to a non-existent image az containerapp update does not fail when the yaml file points to a non-existent image Oct 8, 2024
@sonofhammer
Copy link
Author

sonofhammer commented Oct 8, 2024

usecase where this is relevant

  1. I create a hello world app using terraform. This allows me to hook the app's managed identity up to anything it may need.
  2. i then manage the container image, its version and all container app settings using a yaml file in the pipeline. This allows me to deploy new versions of the image without having to mess with my terraform infra.

Sometimes I fatfinger the container image name, and i spend time debugging why the app hasn't updated even though the cli returned successfully.

@tesar-tech
Copy link

I also have/had this issue.
I suspect that it is somehow related to the Azure container apps. Specifically to the registry from where it takes the image. I was experimenting with deleting the image version from registry and when the app tried to run (starting from 0 replicas) the image version wasn't there, which caused the error.

I was unable to change anything, either from cli or portal. Only deleting and creating the app again helped.

@Greedygre
Copy link
Contributor

Hi @sonofhammer @tesar-tech

This issue has been fixed and will be included in Official Azure CLI version: 2.66.0 Release: 11/05/2024, refer https://github.com/Azure/azure-cli/milestone/147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. Container Instances az container ContainerApp customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants