kine/NVRAppDevOps

Get-ContainerImageCurrentness NullArray errors

TrippyZ opened this issue · 5 comments

I am a new user. Cloned today and get the following errors;
PS C:\Users\admincwatson\NVRAppDevOps\MSDyn365BC_AppTemplate> Read-ALConfiguration -path . | Init-ALEnvironment
Running .\Scripts\Settings.ps1 ...
Build is
Cannot index into a null array.
At C:\Users\admincwatson\Documents\WindowsPowerShell\Modules\NVRAppDevOps\0.9.93\Get-ContainerImageCurrentness.ps1:23 char:9

  •     $result = $matches.Matches.Groups[2].Value.Split(':');
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\admincwatson\Documents\WindowsPowerShell\Modules\NVRAppDevOps\0.9.93\Get-ContainerImageCurrentness.ps1:24 char:9

  •     $Registry = $matches.Matches.Groups[1].Value.Split('/')[0];
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\admincwatson\Documents\WindowsPowerShell\Modules\NVRAppDevOps\0.9.93\Get-ContainerImageCurrentness.ps1:25 char:9

  •     $ImageName = $result[0];
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At C:\Users\admincwatson\Documents\WindowsPowerShell\Modules\NVRAppDevOps\0.9.93\Get-ContainerImageCurrentness.ps1:26 char:9

  •     $ImageTag = $result[1];
    
  •     ~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArray

Cannot read data about the image from server, rather pulling

When run in the pipeline I get a more compact error at the prepare environment step;
========================= Starting Command Output ===========================
"C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'c:\agent_temp\4511780b-b2a2-4285-95c5-4a4647d723e5.ps1'"
WARNING: The names of some imported commands from the module 'navcontainerhelper' include unapproved verbs that might
make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the
Verbose parameter. For a list of approved verbs, type Get-Verb.
Running .\Scripts\Settings.ps1 ...
TF_BUILD set, running under agent, enforcing Build flag
Build is true
Using passed password and Windows authentication
##[error]Get-ContainerImageCurrentness : Cannot index into a null array.
At C:\Users\agent\Documents\WindowsPowerShell\Modules\NVRAppDevOps\0.9.93\Init-ALEnvironment.ps1:176 char:19

  •     if (-not (Get-ContainerImageCurrentness -Image $ImageName)) { 
    
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  • CategoryInfo : InvalidOperation: (:) [Get-ContainerImageCurrentness], RuntimeException
  • FullyQualifiedErrorId : NullArray,Get-ContainerImageCurrentness
    ##[error]PowerShell exited with code '1'.
    Finishing: Prepare environment

Image name need updating in settings file and image source naming has been changed

kine commented

Yup, this template is pretty old...

kine commented

May be look rather to https://dev.azure.com/KineNavTechDays/NavTechDays2019/_git/TemplateApp I have used during NAVTechDays 2019 and have even updated Azure DevOps YAML pipelines.

Thanks for the link to the devops repo, I had been looking for that.

Incidentally I had closed this issue because I figured out the problem. The null array was because of;

$ImageName = 'microsoft/bcsandbox'

in settings.ps1. That image no longer exists. Perhaps, if you have a moment, you could update it to 'mcr.microsoft.com/businesscentral/sandbox' which does work. It is a rather confusing error for a new user but this change solves it.

I am now up and running but a couple of little problems to solve 'environmentally'.