Azure / container-apps-deploy-action

GitHub Action for building and deploying Azure Container Apps
MIT License
52 stars 29 forks source link

using imageToDeploy with a latest tag does not update revision #57

Open rodyvansambeek opened 1 year ago

rodyvansambeek commented 1 year ago

I want to use this action to deploy "an already pushed application image".

In the CI/CD pipeline I create and push the image to the repository with the latest tag. However, when I specify the imageToDeploy parameter as: registry/image:latest everything works fine, however it will not create a new revision. The old revision stays online, until a new container is spinned up by a ACA scaling rule.

Is this a design choice? For now I am using specific version numbers as tags, which works. But I would like to be able to use a latest tag, which represents the currently running version.

Panetes commented 1 year ago

+1 Having this exact problem. Did you find a solution for this?

dworak-dev commented 10 months ago

+1

FAbrahamDev commented 9 months ago

We use:

        - name: Build and push
          uses: docker/build-push-action@v4
          with:
            context: ""
            push: true
            tags: ${{ secrets.PROD_REGISTRY_LOGIN_SERVER }}/${{ secrets.PROD_CONTAINER_APP_BACKEND }}:latest,${{ secrets.PROD_REGISTRY_LOGIN_SERVER }}/${{ secrets.PROD_CONTAINER_APP_BACKEND }}:${{ steps.vars.outputs.sha_short }}
            cache-from: type=gha
            cache-to: type=gha,mode=max

which creates two registry entries.

fareshan commented 7 months ago

+1 This works with azure app services. I don't understand why it does not work with container apps. Any solution ?

fareshan commented 7 months ago

This is an important feature in order to be able to manage container apps with Terraform. My workaround for now is to add:

  lifecycle {
    # we can not set the image tag to latest in github workflows, so we need to ignore the image in the lifecycle
    # https://github.com/Azure/container-apps-deploy-action/issues/57
    ignore_changes = [template[0].container[0].image]
  }

in the terraform ressource

waseemw commented 5 months ago

As a workaround you can use revision copy at the end in an extra step:

- name: Azure CLI script
  uses: azure/cli@v2
  env:
    containerAppName: CopyFromPreviousStep
    resourceGroup: CopyFromPreviousStep
  with:
    azcliversion: latest
    inlineScript: |
      az containerapp revision copy -n ${{ env.containerAppName }} \
      -g ${{ env.resourceGroup }} --revision-suffix ${{ github.run_id }}-${{ github.run_attempt }}

I added --revision-suffix because the revision has to be different than the previous one in order to redeploy, so I used workflow run id and attempt #

tux2nicolae commented 4 months ago

We have the same issue, lost a few hours investigating this

rodyvansambeek commented 4 months ago

In the end I actually ended up tagging the container with their own version number by using Gitversion and the 'latest' tag, and just using the latest version in the ACA deploy step.