From 9b8fe11d2cb0dd83fe3405c445d36bcbb3bd1390 Mon Sep 17 00:00:00 2001 From: MaksimZhukov Date: Mon, 17 Feb 2020 17:25:55 +0300 Subject: [PATCH] Remove ValidateSet --- images.CI/build-image.ps1 | 9 ++++++++- images.CI/cleanup.ps1 | 1 - 2 files changed, 8 insertions(+), 2 deletions(-) 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,