mirror of
https://github.com/actions/runner-images.git
synced 2026-01-06 10:09:20 +08:00
Fail fast in image generation if not enough disk space for customers (#767)
* added checking free disk space Co-authored-by: Nikita Bykov <v-nibyko@microsoft.com>
This commit is contained in:
committed by
Mikhail Timofeev
parent
e7d77a0c6a
commit
33e02acfd0
@@ -883,6 +883,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Kind.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "C:\\InstalledSoftware.md",
|
||||
|
||||
@@ -886,6 +886,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-AliyunCli.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-DiskSpace.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "C:\\InstalledSoftware.md",
|
||||
|
||||
14
images/win/scripts/Installers/Validate-DiskSpace.ps1
Normal file
14
images/win/scripts/Installers/Validate-DiskSpace.ps1
Normal file
@@ -0,0 +1,14 @@
|
||||
################################################################################
|
||||
## File: Validate-DiskSpace.ps1
|
||||
## Desc: Validate free disk space
|
||||
################################################################################
|
||||
|
||||
$availableSpaceMB = [math]::Round((Get-PSDrive -Name C).Free / 1MB)
|
||||
$minimumFreeSpaceMB = 15 * 1024
|
||||
|
||||
Write-Host "Available disk space: $availableSpaceMB MB"
|
||||
if ($availableSpaceMB -le $minimumFreeSpaceMB)
|
||||
{
|
||||
Write-Host "Not enough disk space on the image (minimum available space: $minimumFreeSpaceMB MB)"
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user