@@ -1302,15 +1302,14 @@ def install_helm_client(cmd: CLICommand) -> str:
13021302 )
13031303
13041304 download_location = os .path .expanduser (os .path .join ("~" , download_location_string ))
1305- download_dir = os .path .dirname (download_location )
13061305 install_location = os .path .expanduser (os .path .join ("~" , install_location_string ))
13071306
13081307 # Download compressed Helm binary if not already present
13091308 if not os .path .isfile (install_location ):
13101309 # Creating the helm folder if it doesnt exist
1311- if not os .path .exists (download_dir ):
1310+ if not os .path .exists (download_location ):
13121311 try :
1313- os .makedirs (download_dir )
1312+ os .makedirs (download_location )
13141313 except Exception as e :
13151314 telemetry .set_exception (
13161315 exception = e ,
@@ -1324,32 +1323,56 @@ def install_helm_client(cmd: CLICommand) -> str:
13241323 "Downloading helm client for first time. This can take few minutes..."
13251324 )
13261325
1327- mcr_url = utils .get_mcr_path (cmd .cli_ctx .cloud .endpoints .active_directory )
1328-
1329- client = oras .client .OrasClient (hostname = mcr_url )
13301326 retry_count = 3
13311327 retry_delay = 5
1332- for i in range (retry_count ):
1333- try :
1334- client .pull (
1335- target = f"{ mcr_url } /{ consts .HELM_MCR_URL } :{ artifactTag } " ,
1336- outdir = download_location ,
1337- )
1338- break
1339- except Exception as e :
1340- if i == retry_count - 1 :
1341- if "Connection reset by peer" in str (e ):
1342- telemetry .set_user_fault ()
1343- telemetry .set_exception (
1344- exception = e ,
1345- fault_type = consts .Download_Helm_Fault_Type ,
1346- summary = "Unable to download helm client." ,
1347- )
1348- raise CLIInternalError (
1349- f"Failed to download helm client: { e } " ,
1350- recommendation = "Please check your internet connection." ,
1328+ if arch == "arm64" :
1329+ official_helm_url = f"https://get.helm.sh/{ download_file_name } "
1330+ download_location_file = os .path .expanduser (
1331+ os .path .join (download_location , download_file_name )
1332+ )
1333+ for i in range (retry_count ):
1334+ try :
1335+ from urllib .request import urlretrieve
1336+
1337+ urlretrieve (official_helm_url , download_location_file )
1338+ break
1339+ except Exception as e :
1340+ if i == retry_count - 1 :
1341+ telemetry .set_exception (
1342+ exception = e ,
1343+ fault_type = consts .Download_Helm_Fault_Type ,
1344+ summary = "Unable to download helm client." ,
1345+ )
1346+ raise CLIInternalError (
1347+ f"Failed to download helm client: { e } " ,
1348+ recommendation = "Please check your internet connection." ,
1349+ )
1350+ time .sleep (retry_delay )
1351+ else :
1352+ mcr_url = utils .get_mcr_path (cmd .cli_ctx .cloud .endpoints .active_directory )
1353+
1354+ client = oras .client .OrasClient (hostname = mcr_url )
1355+ for i in range (retry_count ):
1356+ try :
1357+ client .pull (
1358+ target = f"{ mcr_url } /{ consts .HELM_MCR_URL } :{ artifactTag } " ,
1359+ outdir = download_location ,
13511360 )
1352- time .sleep (retry_delay )
1361+ break
1362+ except Exception as e :
1363+ if i == retry_count - 1 :
1364+ if "Connection reset by peer" in str (e ):
1365+ telemetry .set_user_fault ()
1366+ telemetry .set_exception (
1367+ exception = e ,
1368+ fault_type = consts .Download_Helm_Fault_Type ,
1369+ summary = "Unable to download helm client." ,
1370+ )
1371+ raise CLIInternalError (
1372+ f"Failed to download helm client: { e } " ,
1373+ recommendation = "Please check your internet connection." ,
1374+ )
1375+ time .sleep (retry_delay )
13531376
13541377 # Extract the archive.
13551378 try :
0 commit comments