From 79c4eb4910982ee20c0ce46a4172cd36db91a406 Mon Sep 17 00:00:00 2001 From: Chris Gavin Date: Tue, 8 Sep 2020 15:16:23 +0100 Subject: [PATCH] Tidy up CodeQL bundle Windows installer script in response to review comments. --- images/win/scripts/Installers/Install-CodeQLBundle.ps1 | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/images/win/scripts/Installers/Install-CodeQLBundle.ps1 b/images/win/scripts/Installers/Install-CodeQLBundle.ps1 index 6f25fa468..7878d6c65 100644 --- a/images/win/scripts/Installers/Install-CodeQLBundle.ps1 +++ b/images/win/scripts/Installers/Install-CodeQLBundle.ps1 @@ -3,24 +3,20 @@ ## Desc: Install the CodeQL CLI Bundle to the toolcache. ################################################################################ -Import-Module -Name ImageHelpers - # Retrieve the name of the CodeQL bundle preferred by the Action (in the format codeql-bundle-YYYYMMDD). -$CodeQLBundleName = (Invoke-WebRequest "https://raw.githubusercontent.com/github/codeql-action/main/src/defaults.json" | ConvertFrom-Json).bundleVersion +$CodeQLBundleName = (Invoke-RestMethod "https://raw.githubusercontent.com/github/codeql-action/main/src/defaults.json").bundleVersion # Convert the bundle name to a version number (0.0.0-YYYYMMDD). $CodeQLBundleVersion = "0.0.0-" + $CodeQLBundleName.split("-")[-1] -$ExtractionDirectory = "$Env:AGENT_TOOLSDIRECTORY/CodeQL/$CodeQLBundleVersion/x64" +$ExtractionDirectory = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath $CodeQLBundleVersion | Join-Path -ChildPath "x64" New-Item -Path $ExtractionDirectory -ItemType Directory -Force | Out-Null Write-Host "Downloading CodeQL bundle $CodeQLBundleVersion..." $CodeQLBundlePath = Start-DownloadWithRetry -Url "https://github.com/github/codeql-action/releases/download/$CodeQLBundleName/codeql-bundle.tar.gz" -Name "codeql-bundle.tar.gz" $DownloadDirectoryPath = (Get-Item $CodeQLBundlePath).Directory.FullName Extract-7Zip -Path $CodeQLBundlePath -DestinationPath $DownloadDirectoryPath -Remove-Item -Path $CodeQLBundlePath -$UnGzipedCodeQLBundlePath = (Join-Path $DownloadDirectoryPath "codeql-bundle.tar") +$UnGzipedCodeQLBundlePath = Join-Path $DownloadDirectoryPath "codeql-bundle.tar" Extract-7Zip -Path $UnGzipedCodeQLBundlePath -DestinationPath $ExtractionDirectory -Remove-Item -Path $UnGzipedCodeQLBundlePath # Test that the tool has been extracted successfully. & (Join-Path $ExtractionDirectory "codeql" "codeql.exe") version