From 7a6cfc57afe22d0646c959927265546af8ace89b Mon Sep 17 00:00:00 2001 From: Abel Hu Date: Wed, 12 Jun 2024 03:34:31 +0000 Subject: [PATCH] feat: use one ignore list for windows vhd test --- .../packer/generate-windows-vhd-configuration.ps1 | 11 +++++++++++ vhdbuilder/packer/test/windows-files-check.ps1 | 12 +----------- vhdbuilder/packer/test/windows-vhd-content-test.ps1 | 13 +------------ 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 b/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 index c42498f238a..db0fe3375ac 100644 --- a/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 +++ b/vhdbuilder/packer/generate-windows-vhd-configuration.ps1 @@ -17,6 +17,17 @@ $global:aksToolsDir = "c:\aks-tools" # We need to guarantee that the node provisioning will not fail because the vhd is full before resize-osdisk is called in AKS Windows CSE script. $global:lowestFreeSpace = 2*1024*1024*1024 # 2GB +$global:excludeHashComparisionListInAzureChinaCloud = @( + "calico-windows", + "azure-vnet-cni-singletenancy-windows-amd64", + "azure-vnet-cni-singletenancy-swift-windows-amd64", + "azure-vnet-cni-singletenancy-overlay-windows-amd64", + # We need upstream's help to republish this package. Before that, it does not impact functionality and 1.26 is only in public preview + # so we can ignore the different hash values. + "v1.26.0-1int.zip", + "azure-acr-credential-provider-windows-amd64-v1.29.2.tar.gz" +) + # defaultContainerdPackageUrl refers to the stable containerd package used to pull and cache container images # Add cache for another containerd version which is not installed by default $global:defaultContainerdPackageUrl = "https://acs-mirror.azureedge.net/containerd/windows/v1.6.21-azure.1/binaries/containerd-v1.6.21-azure.1-windows-amd64.tar.gz" diff --git a/vhdbuilder/packer/test/windows-files-check.ps1 b/vhdbuilder/packer/test/windows-files-check.ps1 index 48c45e2ab87..87a202299c0 100644 --- a/vhdbuilder/packer/test/windows-files-check.ps1 +++ b/vhdbuilder/packer/test/windows-files-check.ps1 @@ -178,16 +178,6 @@ function Test-CompareSingleDir { New-Item -ItemType Directory $dir -Force | Out-Null } - $excludeHashComparisionListInAzureChinaCloud = @( - "calico-windows", - "azure-vnet-cni-singletenancy-windows-amd64", - "azure-vnet-cni-singletenancy-swift-windows-amd64", - "azure-vnet-cni-singletenancy-overlay-windows-amd64", - # We need upstream's help to republish this package. Before that, it does not impact functionality and 1.26 is only in public preview - # so we can ignore the different hash values. - "v1.26.0-1int.zip" - ) - foreach ($URL in $map[$dir]) { $fileName = [IO.Path]::GetFileName($URL) $dest = [IO.Path]::Combine($dir, $fileName) @@ -196,7 +186,7 @@ function Test-CompareSingleDir { $globalFileSize = (Get-Item $dest).length $isIgnore=$False - foreach($excludePackage in $excludeHashComparisionListInAzureChinaCloud) { + foreach($excludePackage in $global:excludeHashComparisionListInAzureChinaCloud) { if ($URL.Contains($excludePackage)) { $isIgnore=$true break diff --git a/vhdbuilder/packer/test/windows-vhd-content-test.ps1 b/vhdbuilder/packer/test/windows-vhd-content-test.ps1 index 066fc3a7571..38e23806fa1 100644 --- a/vhdbuilder/packer/test/windows-vhd-content-test.ps1 +++ b/vhdbuilder/packer/test/windows-vhd-content-test.ps1 @@ -140,19 +140,8 @@ function Test-FilesToCacheOnVHD $localFileSize = (Get-Item $dest).length $remoteFileSize = (Invoke-WebRequest $mcURL -UseBasicParsing -Method Head).Headers.'Content-Length' if ($localFileSize -ne $remoteFileSize) { - $excludeHashComparisionListInAzureChinaCloud = @( - "calico-windows", - "azure-vnet-cni-singletenancy-windows-amd64", - "azure-vnet-cni-singletenancy-swift-windows-amd64", - "azure-vnet-cni-singletenancy-overlay-windows-amd64", - # We need upstream's help to republish this package. Before that, it does not impact functionality and 1.26 is only in public preview - # so we can ignore the different hash values. - "v1.26.0-1int.zip", - "azure-acr-credential-provider-windows-amd64-v1.29.2.tar.gz" - ) - $isIgnore=$False - foreach($excludePackage in $excludeHashComparisionListInAzureChinaCloud) { + foreach($excludePackage in $global:excludeHashComparisionListInAzureChinaCloud) { if ($mcURL.Contains($excludePackage)) { $isIgnore=$true break