docker-images icon indicating copy to clipboard operation
docker-images copied to clipboard

Build.ps1 fails when there is only one image to build

Open jflheureux opened this issue 4 years ago • 1 comments

ISSUE

After filtering the available images to build, if there is only one image left, the script fails to convert it as an ArrayList.

The line that fails is: https://github.com/Sitecore/docker-images/blob/master/Build.ps1#L278

See "Steps to reproduce the behavior" for a sample command that makes the script fail.

  • [x] I have tried with the latest version of Docker for Windows (Stable or Edge) or Docker Enterprise.
  • [x] Windows version is at least 1809 / ltsc2019.
  • [x] Windows has the latest updates installed.

Expected behavior

The script do not fail and build the one image.

Actual behavior

The script fails with an exception:

C:\projects\Sitecore.Docker-Images\Build.ps1 : Cannot convert value "@{WindowsAssetImage=;Path=C:\projects\Sitecore.Docker-Images\build\windows\dependencies\sitecore-certificates; BuildOptions=System.Object[];Topology=; Sources=System.Object[]; Base=System.Object[]; Experimental=False; Deprecated=False;Tag=sitecore-certificates:latest-nanoserver-1809;DockerFilePath=C:\projects\Sitecore.Docker-Images\build\windows\dependencies\sitecore-certificates\Dockerfile; Priority=;Include=False}" to type "System.Collections.ArrayList". Error: "Cannot convert the "@{WindowsAssetImage=;Path=C:\projects\Sitecore.Docker-Images\build\windows\dependencies\sitecore-certificates; BuildOptions=System.Object[];Topology=; Sources=System.Object[]; Base=System.Object[]; Experimental=False; Deprecated=False;Tag=sitecore-certificates:latest-nanoserver-1809;DockerFilePath=C:\projects\Sitecore.Docker-Images\build\windows\dependencies\sitecore-certificates\Dockerfile; Priority=;Include=False}" value of type "System.Management.Automation.PSCustomObject" to type "System.Collections.ArrayList"."
At line:1 char:7
+ .\Build.ps1 -SitecoreVersion "10.1.0" -IncludeExperimental
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Build.ps1], ArgumentTransformationMetadataException
    + FullyQualifiedErrorId : RuntimeException,Build.ps1

Steps to reproduce the behavior

  1. Run .\Build.ps1 -SitecoreVersion "10.1.0" -IncludeExperimental

jflheureux avatar May 03 '21 18:05 jflheureux

It works with

.\Build.ps1 -SitecoreVersion ["10.1.0"]

But, yes, it will be nice to fix it.

Antonytm avatar Aug 20 '21 11:08 Antonytm