Azure / container-apps-deploy-action

GitHub Action for building and deploying Azure Container Apps
MIT License
50 stars 30 forks source link

ERROR: (InvalidParameterValueInContainerTemplate) #85

Open danielPerez97 opened 8 months ago

danielPerez97 commented 8 months ago

Hello, we are getting this error:

ERROR: (InvalidParameterValueInContainerTemplate) The following field(s) are either invalid or missing. Field 'template.containers.<our-registry>.image' is invalid with details: 'Invalid value: "<our-registry>.azurecr.io/our-server:32931cfe[65](https://github.com/my-org/our-repol/actions/runs/7415102429/job/20177549358#step:12:70)8e2c0800f4a8[79](https://github.com/my-org/our-repo/actions/runs/7415102429/job/20177549358#step:12:84)0da35183ecac2906": GET https:?scope=repository%3Aour-server%3Apull&service=<our-registry>.azurecr.io: UNAUTHORIZED: authentication required, visit https://aka.ms/acr/authorization for more information.';.

This doesn't make sense to us because it sucessfully logs into the ACR beforehand:

Run docker/login-action@v2.2.0
  with:
    registry: <our-registry>.azurecr.io
    username: ***
    password: ***
    ecr: auto
    logout: true
  env:
    SERVICE: <our-registry>
    AZURE_HTTP_USER_AGENT: 
    AZUREPS_HOST_ENVIRONMENT: 
    CA_GH_ACTION_START_MILLISECONDS: 1704404270120
    CA_GH_ACTION_RESULT_ARG: --property 'result=failed'
    CA_GH_ACTION_YAML_PROVIDED: true
Logging into <our-registry>.azurecr.io...
Login Succeeded!

Here is the full log:

Run docker/login-action@v2.2.0
  with:
    registry: <our-registry>.azurecr.io
    username: ***
    password: ***
    ecr: auto
    logout: true
  env:
    SERVICE: <our-registry>
    AZURE_HTTP_USER_AGENT: 
    AZUREPS_HOST_ENVIRONMENT: 
    CA_GH_ACTION_START_MILLISECONDS: 1704404270120
    CA_GH_ACTION_RESULT_ARG: --property 'result=failed'
    CA_GH_ACTION_YAML_PROVIDED: true
Logging into <our-registry>.azurecr.io...
Login Succeeded!
Run CA_GH_ACTION_REGISTRY_LOGIN_ARG="--registry-server <our-registry>.azurecr.io --registry-username *** --registry-password ***"
  CA_GH_ACTION_REGISTRY_LOGIN_ARG="--registry-server <our-registry>.azurecr.io --registry-username *** --registry-password ***"
  CA_GH_ACTION_REGISTRY_URL=<our-registry>.azurecr.io
  CA_GH_ACTION_REGISTRY_USERNAME=***
  CA_GH_ACTION_REGISTRY_PASSWORD=***
  echo "CA_GH_ACTION_REGISTRY_LOGIN_ARG=$***CA_GH_ACTION_REGISTRY_LOGIN_ARG***" >> $GITHUB_ENV
  echo "CA_GH_ACTION_REGISTRY_URL=$***CA_GH_ACTION_REGISTRY_URL***" >> $GITHUB_ENV
  echo "CA_GH_ACTION_REGISTRY_USERNAME=$***CA_GH_ACTION_REGISTRY_USERNAME***" >> $GITHUB_ENV
  echo "CA_GH_ACTION_REGISTRY_PASSWORD=$***CA_GH_ACTION_REGISTRY_PASSWORD***" >> $GITHUB_ENV
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail ***0***
  env:
    SERVICE: <our-registry>
    AZURE_HTTP_USER_AGENT: 
    AZUREPS_HOST_ENVIRONMENT: 
    CA_GH_ACTION_START_MILLISECONDS: 1704404270120
    CA_GH_ACTION_RESULT_ARG: --property 'result=failed'
    CA_GH_ACTION_YAML_PROVIDED: true
Run CA_GH_ACTION_IMAGE_TO_BUILD="<our-registry>.azurecr.io/github-action/container-app:741[51](https://github.com/my-org/our-repo/actions/runs/7415102429/job/20177549358#step:12:55)02429.1"
Run CA_GH_ACTION_IMAGE_TO_DEPLOY="<our-registry>.azurecr.io/our-server:32931cfe6[58](https://github.com/my-org/our-repo/actions/runs/7415102429/job/20177549358#step:12:62)e2c0800f4a8790da35183ecac2906"
Run CA_GH_ACTION_RESOURCE_GROUP="***"
Run az containerapp show \
WARNING: The behavior of this command has been altered by the following extension: containerapp
ERROR: (ResourceNotFound) The Resource 'Microsoft.App/containerApps/<our-registry>' under resource group '***' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Run az containerapp create \
WARNING: The behavior of this command has been altered by the following extension: containerapp
WARNING: Additional flags were passed along with --yaml. These flags will be ignored, and the configuration defined in the yaml will be used instead
ERROR: (InvalidParameterValueInContainerTemplate) The following field(s) are either invalid or missing. Field 'template.containers.<our-registry>.image' is invalid with details: 'Invalid value: "<our-registry>.azurecr.io/our-server:32931cfe[65](https://github.com/my-org/our-repo/actions/runs/7415102429/job/20177549358#step:12:70)8e2c0800f4a8[79](https://github.com/my-org/our-repo/actions/runs/7415102429/job/20177549358#step:12:84)0da35183ecac2906": GET https:?scope=repository%3Aour-server%3Apull&service=<our-registry>.azurecr.io: UNAUTHORIZED: authentication required, visit https://aka.ms/acr/authorization for more information.';.

We're unsure where to go from here to get this working and find this error confusing when you see the login succeeded beforehand. Thank you.

eXigentCoder commented 8 months ago

Getting the same error though my login action is slightly different: image

danielPerez97 commented 8 months ago

Hey @eXigentCoder, I believe I was able to get this working by changing the Location to match where the ACR or ContainerApps Environment was located. I had copy-pasted my YAML file but didn't update the location field. Let me know if this helps and we can probably just close this issue.

eXigentCoder commented 7 months ago

When you say change the location, do you mean like "West US 2" etc?

danielPerez97 commented 7 months ago

@harryli0108 Yeah, "centralus" more specifically. Changed it in the YAML file to match where I believe our Container Apps Environment was located.