diff --git a/images.CI/build-image.ps1 b/images.CI/build-image.ps1 index 989167e44..9a35373de 100644 --- a/images.CI/build-image.ps1 +++ b/images.CI/build-image.ps1 @@ -1,5 +1,4 @@ param( - [ValidateSet('Windows2019-Azure','Windows2016-Azure','ubuntu1604','ubuntu1804')] [String] [Parameter (Mandatory=$true)] $Image, [String] [Parameter (Mandatory=$true)] $ClientId, [String] [Parameter (Mandatory=$true)] $ClientSecret, @@ -16,9 +15,17 @@ param( ) $TemplatePath = (Get-ChildItem -Path "images" -Include "$Image.json" -Recurse -Depth 2).FullName +if ($TemplatePath -eq $null) +{ + Write-Error "'-Image' parameter is not valid. You have to specify correct image type." + exit 1 +} + $TempResourceGroupName = "${ResourcesNamePrefix}_${Image}" $InstallPassword = [System.GUID]::NewGuid().ToString().ToUpper() +packer validate -syntax-only $TemplatePath + Write-Host "Build $Image VM" packer build -var "capture_name_prefix=$ResourcesNamePrefix" ` -var "client_id=$ClientId" ` diff --git a/images.CI/cleanup.ps1 b/images.CI/cleanup.ps1 index 4b0b527be..00050d551 100644 --- a/images.CI/cleanup.ps1 +++ b/images.CI/cleanup.ps1 @@ -1,5 +1,4 @@ param( - [ValidateSet('Windows2019-Azure','Windows2016-Azure','ubuntu1604','ubuntu1804')] [String] [Parameter (Mandatory=$true)] $Image, [String] [Parameter (Mandatory=$true)] $ResourcesNamePrefix, [String] [Parameter (Mandatory=$true)] $ClientId,