kine / NVRAppDevOps

Navertica DevOps scripts for managing Microsoft Dynamics 365 Business Central Apps
31 stars 29 forks source link

Insider image is giving warning that the image was not found locally #25

Closed kine closed 4 years ago

kine commented 4 years ago

After PR #23 you can get warning like

Get-ContainerImageCurrentness -Image bcinsider.azurecr.io/bconprem:cz

WARNING: The image mcr.microsoft.com/bconprem:cz could not be found locally
The local version of the image mcr.microsoft.com/bconprem:cz is NOT the latest version

because the function Get-ContainerImageCurrentness is taking the Image but is not parsing the registry correctly from the Image.

kine commented 4 years ago

@Sven-Niehus I have opened this issue to track the fix for the registry name parsing in the function Get-ContainerImageCurrentness. Please, give me info if you will fix that or I should fix that myself. Thanks!

kine commented 4 years ago

Ok, have fixed that in v0.9.89, commit 40abe8cacb01e50c05c353b0dcfdaa3f2b787691

Sven-Niehus commented 4 years ago

I've added a PR with the fix. You can now specify the FullName. Example: Get-ContainerImageCurrentness -FullName "mcr.microsoft.com/businesscentral/sandbox:ltsc2019"

kine commented 4 years ago

Ok, than, what is difference between FullName and Image parameter?

Sven-Niehus commented 4 years ago

The difference is that the FullName is Registry + Image.

In my example the image (including the tag) would be businesscentral/sandbox:ltsc2019 and the registry would be mcr.microsoft.com

kine commented 4 years ago

Interesting, because the regex you are using to parse the value is working for mcr.microsoft.com/businesscentral/sandbox:ltsc2019 but not for businesscentral/sandbox:ltsc2019

kine commented 4 years ago

(looking on https://regexr.com/4l9vu)

kine commented 4 years ago

I have just added condition to not parse the Registry name from the Image param when the Registry param is entered from outside (removed the default value and put it only in case that it is needed and not entered from outside).

It means it should now work as original version and if Registry name is included in the Image parameter, it will use it. If it is in Registry parameter, than this value will be used instead.

kine commented 4 years ago

@Sven-Niehus will this variant works for your usage?

Sven-Niehus commented 4 years ago

You're right, my fault.

The only difference in the code is that Image uses the pre configured registry and FullName parses the registry from the URL. I fixed it in my newest commit in PR #26

You can now always specify the full Image name including everything. In my opinion that makes more sense because you nearly always have all the information needed. I only included the other options for checking images on the fly, but that feature is not necessary anymore in my opinion.

kine commented 4 years ago

Should be solved by PR #26