dotnet / sdk-container-builds

Libraries and build tooling to create container images from .NET projects using MSBuild

Home Page:https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Publish to ACR causes ACR webhook push an extra time without tag

Kimmen opened this issue · comments

I have recently updated Microsoft.NET.Build.Containers from version 0.4.0 to 7.0.302 and updated the publish command to publish directly to our Azure Container Registry (ACR). This causes our webhook to fire twice: once with tags and once without tags.

So it it something with my publish configuration that is causing this?

In Azure Devops the publish command is specified as:

pool:
  vmImage: ubuntu-latest

steps:
  - task: NuGetAuthenticate@1
    displayName: Access to nuget feed
  - task: Docker@2
    displayName: Access to docker container registry
    inputs:
      containerRegistry: '<company service connection name>'
      command: 'login'
  - task: DotNetCoreCLI@2
    displayName: Publish as container
    inputs:
      command: 'publish'
      publishWebProjects: false
      projects: '**/Web.csproj'
      arguments: > 
        -c Release 
        --os linux 
        --arch x64 
        -p:PublishProfile=DefaultContainer 
        -p:ContainerImageName=$(imageName) 
        -p:ContainerImageTag=$(tag)
        -p:ContainerRegistry=$(registry)
      zipAfterPublish: false
      modifyOutputPath: false

The tag is just the build-number specified as $(Date:yyyyMMdd)$(Rev:.r)

In the Azure Devops logs it looks like it uploads the image once:

Uploaded manifest to ***
Uploading tag 20230602.2 to ***
Uploaded tag 20230602.2 to ***
Pushed container 'individualportalapi:20230602.2' to registry '***'

This is the webhook logs:
image

This is really interesting - do you have a binlog or Fiddler trace or something that we can look at to try and understand why this happened? When we push an image, we push the following items:

  • one blob for each image Layer
  • one blob for the image configuration
  • one blob for the image manifest
  • one blob for the tag

I think that's it. It's certainly possible that behavior pattern might surface this way in webhooks.

I don't have any trace logs on hane. I can get some, but I need some guidance how to get hold of the trace logs you need. Can I get the trace from the Azure Devops portal directly or do I need to publish the app locally (so I can trace with Fiddler)?