mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
[Windows] Apply code style rules to Windows scripts (#8957)
* Apply code style rules to Windows scripts * Fix typo * Fix configure-toolset script * Fix parameters in Msys2 installation script * Improve log readability * Remove broken exit code validation
This commit is contained in:
committed by
GitHub
parent
76d6f0f574
commit
7fe65a2204
@@ -4,33 +4,33 @@
|
||||
################################################################################
|
||||
|
||||
# Retrieve the CLI version of the latest CodeQL bundle.
|
||||
$Defaults = (Invoke-RestMethod "https://raw.githubusercontent.com/github/codeql-action/v2/src/defaults.json")
|
||||
$CliVersion = $Defaults.cliVersion
|
||||
$TagName = "codeql-bundle-v" + $CliVersion
|
||||
$defaults = (Invoke-RestMethod "https://raw.githubusercontent.com/github/codeql-action/v2/src/defaults.json")
|
||||
$cliVersion = $defaults.cliVersion
|
||||
$tagName = "codeql-bundle-v" + $cliVersion
|
||||
|
||||
Write-Host "Downloading CodeQL bundle $($CliVersion)..."
|
||||
Write-Host "Downloading CodeQL bundle $($cliVersion)..."
|
||||
# Note that this is the all-platforms CodeQL bundle, to support scenarios where customers run
|
||||
# different operating systems within containers.
|
||||
$CodeQLBundlePath = Invoke-DownloadWithRetry "https://github.com/github/codeql-action/releases/download/$($TagName)/codeql-bundle.tar.gz"
|
||||
$DownloadDirectoryPath = (Get-Item $CodeQLBundlePath).Directory.FullName
|
||||
$codeQLBundlePath = Invoke-DownloadWithRetry "https://github.com/github/codeql-action/releases/download/$($tagName)/codeql-bundle.tar.gz"
|
||||
$downloadDirectoryPath = (Get-Item $codeQLBundlePath).Directory.FullName
|
||||
|
||||
$CodeQLToolcachePath = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath $CliVersion | Join-Path -ChildPath "x64"
|
||||
New-Item -Path $CodeQLToolcachePath -ItemType Directory -Force | Out-Null
|
||||
$codeQLToolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath $cliVersion | Join-Path -ChildPath "x64"
|
||||
New-Item -Path $codeQLToolcachePath -ItemType Directory -Force | Out-Null
|
||||
|
||||
Write-Host "Unpacking the downloaded CodeQL bundle archive..."
|
||||
Expand-7ZipArchive -Path $CodeQLBundlePath -DestinationPath $DownloadDirectoryPath
|
||||
$UnGzipedCodeQLBundlePath = Join-Path $DownloadDirectoryPath "codeql-bundle.tar"
|
||||
Expand-7ZipArchive -Path $UnGzipedCodeQLBundlePath -DestinationPath $CodeQLToolcachePath
|
||||
Expand-7ZipArchive -Path $codeQLBundlePath -DestinationPath $downloadDirectoryPath
|
||||
$unGzipedCodeQLBundlePath = Join-Path $downloadDirectoryPath "codeql-bundle.tar"
|
||||
Expand-7ZipArchive -Path $unGzipedCodeQLBundlePath -DestinationPath $codeQLToolcachePath
|
||||
|
||||
Write-Host "CodeQL bundle at $($CodeQLToolcachePath) contains the following directories:"
|
||||
Get-ChildItem -Path $CodeQLToolcachePath -Depth 2
|
||||
Write-Host "CodeQL bundle at $($codeQLToolcachePath) contains the following directories:"
|
||||
Get-ChildItem -Path $codeQLToolcachePath -Depth 2
|
||||
|
||||
# Touch a file to indicate to the CodeQL Action that this bundle shipped with the toolcache. This is
|
||||
# to support overriding the CodeQL version specified in defaults.json on GitHub Enterprise.
|
||||
New-Item -ItemType file (Join-Path $CodeQLToolcachePath -ChildPath "pinned-version")
|
||||
New-Item -ItemType file (Join-Path $codeQLToolcachePath -ChildPath "pinned-version")
|
||||
|
||||
# Touch a file to indicate to the toolcache that setting up CodeQL is complete.
|
||||
New-Item -ItemType file "$CodeQLToolcachePath.complete"
|
||||
New-Item -ItemType file "$codeQLToolcachePath.complete"
|
||||
|
||||
# Test that the tools have been extracted successfully.
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "CodeQL Bundle"
|
||||
|
||||
Reference in New Issue
Block a user