mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 11:37:00 +00:00
[Windows] Add checksum verification for Kotlin (#8318)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
################################################################################
|
||||
## File: Install-Kotlin.ps1
|
||||
## Desc: Install Kotlin
|
||||
## Supply chain security: Kotlin - checksum validation
|
||||
################################################################################
|
||||
|
||||
# Install Kotlin
|
||||
@@ -10,6 +11,12 @@ $kotlinBinaryName = (Get-ToolsetContent).kotlin.binary_name
|
||||
$kotlinDownloadUrl = Get-GitHubPackageDownloadUrl -RepoOwner "JetBrains" -RepoName "kotlin" -BinaryName $kotlinBinaryName -Version $kotlinVersion -UrlFilter "*{BinaryName}-{Version}.zip"
|
||||
$kotlinInstallerPath = Start-DownloadWithRetry -Url $kotlinDownloadUrl -Name "$kotlinBinaryName.zip"
|
||||
|
||||
#region Supply chain security
|
||||
$fileHash = (Get-FileHash -Path $kotlinInstallerPath -Algorithm SHA256).Hash
|
||||
$externalHash = Get-HashFromGitHubReleaseBody -RepoOwner "JetBrains" -RepoName "kotlin" -FileName "$kotlinBinaryName" -Version $kotlinVersion -WordNumber 2
|
||||
Use-ChecksumComparison $fileHash $externalHash
|
||||
#endregion
|
||||
|
||||
Write-Host "Expand Kotlin archive"
|
||||
$kotlinPath = "C:\tools"
|
||||
Extract-7Zip -Path $kotlinInstallerPath -DestinationPath $kotlinPath
|
||||
@@ -17,4 +24,4 @@ Extract-7Zip -Path $kotlinInstallerPath -DestinationPath $kotlinPath
|
||||
# Add to PATH
|
||||
Add-MachinePathItem "$kotlinPath\kotlinc\bin"
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin"
|
||||
|
||||
Reference in New Issue
Block a user