Skip to content

Azure ACI doesn't restart when log-analytics-workspace-* key/values are set #77

@mydoum

Description

@mydoum

Hello!

Here is my reproduction step:

  • Build docker image with GH Actions (docker/build-push-action@v3)
  • Push docker image to Azure Container Registry with GH Actions. (docker/build-push-action@v3)
  • Deploy the pushed image to Container Instances with GH Actions with log-analytics-workspace and log-analytics-workspace-key (azure/aci-deploy@v1)

Of course, it must be a first creation, and not an update, otherwise it is not does not work.
At this point, everything seems to work as expected, the container group logs are aggregated into the "Azure Log Analytics workspace".

Nevertheless, if we launch again the same GH actions pipeline after any commit, the azure/aci-deploy@v1 doesn't deploy the new image, Azure ACI don't receive any event. The worst, is that there is no error triggered, nothing.

If you remove afterward the log-analytics-workspace-* keys, azure/aci-deploy@v1 work again as expected, and without a need to destroy a rebuild the container group. (the connexion with "Azure Log Analytics workspace" is of course broken at this point).

Here is an example of pipeline :

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Cache Docker layers
        uses: actions/cache@v3
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-buildx-
      - name: 'Login to Azure Container Registry'
        uses: docker/login-action@v2
        with:
          registry: ${{ secrets.REGISTRY_LOGIN_SERVER }}
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_PASSWORD }}
      -
        name: 'Build and push'
        uses: docker/build-push-action@v3
        with:
          context: .
          file: packages/backend/Dockerfile
          platforms: linux/amd64,linux/arm64
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
          push: true
          tags: |
            ${{ secrets.BACKEND_IMAGE_NAME }}
      - name: 'Login via Azure CLI'
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}
      - name: 'Deploy to Azure Container Instances'
        uses: 'azure/aci-deploy@v1'
        with:
          resource-group: ${{ secrets.ACI_RESOURCE_GROUP }}
          dns-name-label: ${{ secrets.ACI_DNS_RESSOURCE_GROUP }}
          image: ${{ secrets.BACKEND_IMAGE_NAME }}
          registry-login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
          registry-username: ${{ secrets.REGISTRY_USERNAME }}
          registry-password: ${{ secrets.REGISTRY_PASSWORD }}
          log-analytics-workspace: ${{ secrets.AZ_LOG_AGGREGATOR_WORKSPACE_ID }}
          log-analytics-workspace-key: ${{ secrets.AZ_LOG_AGGREGATOR_WORKSPACE_KEY }}
          cpu: 4
          memory: 4
          ports: ${{ secrets.BACKEND_PORTS }}
          name: ${{ secrets.ACI_CONTAINER_GROUP_NAME }}
          location: ${{ secrets.ACI_LOCATION }}
      - name: Move Docker Cache
        run: |
          rm -rf /tmp/.buildx-cache
          mv /tmp/.buildx-cache-new /tmp/.buildx-cache

Why it is a problem?

We cannot configure "Azure Log Analytics workspace" with this github action.

How would be better?

  1. Raise error is something is not written as expected with log-analytics-workspace and log-analytics-workspace-key
  2. Update the Azure ACI if everything is fine

Regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions