Skip to content

Latest metadata.json update introduced asset that does not exists/cannot be downloaded #24780

@fangfei

Description

@fangfei
          @jshigetomi, since the PR was merged the "https://aka.ms/install-powershell.ps1" script fails when run on a Windows ARM64 machine with the following arguments:
$installScript = "$env:TEMP\install-powershell.ps1"
Invoke-WebRequest -Uri "https://aka.ms/install-powershell.ps1" -OutFile $installScript
& $installScript -AddToPath

An exception is thrown saying the following URL is 404-ing:

https://powershellinfraartifacts-gkhedzdeaghdezhr.z01.azurefd.net/install/v7.6.0-preview2/PowerShell-7.6.0-preview.2-win-arm64.zip

Comes from line 374 in the script:

        $metadata = Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json
        if ($Preview) {
            $release = $metadata.PreviewReleaseTag -replace '^v'
        } else {
            $release = $metadata.ReleaseTag -replace '^v'
        }

        if ($IsWinEnv) {
            if ($UseMSI) {
                $packageName = "PowerShell-${release}-win-${architecture}.msi"
            } else {
                $packageName = "PowerShell-${release}-win-${architecture}.zip"
            }
        } elseif ($IsLinuxEnv) {
            $packageName = "powershell-${release}-linux-${architecture}.tar.gz"
        } elseif ($IsMacOSEnv) {
            $packageName = "powershell-${release}-osx-${architecture}.tar.gz"
        }

        $downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}"
        Write-Verbose "About to download package from '$downloadURL'" -Verbose

        $packagePath = Join-Path -Path $tempDir -ChildPath $packageName
        if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") {
            # On Windows PowerShell, progress can make the download significantly slower
            $oldProgressPreference = $ProgressPreference
            $ProgressPreference = "SilentlyContinue"
        }

        try {
****        Invoke-WebRequest -Uri $downloadURL -OutFile $packagePath ****
        } finally {
            if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") {
                $ProgressPreference = $oldProgressPreference
            }
        }

Originally posted by @mjcheetham in #24764 (comment)

Metadata

Metadata

Assignees

Labels

Resolution-No ActivityIssue has had no activity for 6 months or more

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions