@@ -692,15 +692,27 @@ func resolveKubetestRepoListPath(version string, path string) (string, error) {
692692// that has an existing capi offer image available. For example, if the version is "stable-1.22", the function will set it to the latest 1.22 version that has a published reference image. 
693693func  resolveKubernetesVersions (config  * clusterctl.E2EConfig ) {
694694	linuxVersions  :=  getVersionsInCommunityGallery (context .TODO (), os .Getenv (AzureLocation ), capiCommunityGallery , "capi-ubun2-2404" )
695- 	windowsVersions  :=  getVersionsInCommunityGallery (context .TODO (), os .Getenv (AzureLocation ), capiCommunityGallery , "capi-win-2019-containerd" )
696695	flatcarK8sVersions  :=  getFlatcarK8sVersions (context .TODO (), os .Getenv (AzureLocation ), flatcarCAPICommunityGallery )
697696
698- 	// find the intersection of ubuntu and windows versions available, since we need an image for both. 
699697	var  versions  semver.Versions 
700- 	for  k , v  :=  range  linuxVersions  {
701- 		if  _ , ok  :=  windowsVersions [k ]; ok  {
698+ 
699+ 	// Check if Windows testing is explicitly disabled via TEST_WINDOWS environment variable 
700+ 	testWindows  :=  os .Getenv ("TEST_WINDOWS" )
701+ 	windowsRequired  :=  testWindows  !=  "false" 
702+ 
703+ 	if  windowsRequired  {
704+ 		windowsVersions  :=  getVersionsInCommunityGallery (context .TODO (), os .Getenv (AzureLocation ), capiCommunityGallery , "capi-win-2019-containerd" )
705+ 		for  k , v  :=  range  linuxVersions  {
706+ 			if  _ , ok  :=  windowsVersions [k ]; ok  {
707+ 				versions  =  append (versions , v )
708+ 			}
709+ 		}
710+ 		Logf ("Windows machines required, using intersection of Linux and Windows versions" )
711+ 	} else  {
712+ 		for  _ , v  :=  range  linuxVersions  {
702713			versions  =  append (versions , v )
703714		}
715+ 		Logf ("No Windows machines required, using Linux versions only" )
704716	}
705717
706718	if  config .HasVariable (capi_e2e .KubernetesVersion ) {
0 commit comments