Navcontainerhelper: If two processes build the same image at the same time, the second one always rebuilds

Created on 15 Oct 2020  路  3Comments  路  Source: microsoft/navcontainerhelper

Describe the issue
If one process is creating an image with New-BCImage and another one is doing the same targeting the same resulting image, then the second one will always throw away the result of the first one.

Scripts used to create container and cause the issue

new-bcimage -artifactUrl (get-bcartifacturl -type OnPrem -version 16 -country se) -skipIfImageAlreadyExists -imageName bcartifacts/cosmo-bc

On another PowerShell do the same

new-bcimage -artifactUrl (get-bcartifacturl -type OnPrem -version 16 -country se) -skipIfImageAlreadyExists -imageName bcartifacts/cosmo-bc

Full output of scripts
The first one will build, the second one will wait for the first build to finish. But when the second starts again (https://github.com/microsoft/navcontainerhelper/blob/master/ContainerHandling/New-NavImage.ps1#L224), the decision to build the image is already made.

So the first one finishes like this

...
Successfully built 98e303016510
Successfully tagged bcartifacts/cosmo-bc:onprem-16.6.17046.0-se

But the second still starts like this

Other process completed building
Building image bcartifacts/cosmo-bc:onprem-16.6.17046.0-se based on mcr.microsoft.com/dynamicsnav:10.0.17763.1457-generic with https://bcartifacts.azureedge.net/onprem/16.6.17046.0/se
Pulling latest image mcr.microsoft.com/dynamicsnav:10.0.17763.1457-generic
...

I would be happy to try to work on a solution, but I struggle to find a good idea to approach this. Would you have any suggestions?

bug Fix Ready Ships in a future version

All 3 comments

After the fix: image

Perfect, thanks! That will be in the prerelease after the build, right?

Shipped in 1.0.9

Was this page helpful?
0 / 5 - 0 ratings