mirror of
https://github.com/actions/runner-images.git
synced 2026-01-06 01:59:46 +08:00
Add TagName param with default value unixtimestamp (#4753)
This commit is contained in:
committed by
GitHub
parent
8d70ee3468
commit
192509400a
@@ -6,7 +6,7 @@ function Push-AnkaTemplateToRegistry {
|
|||||||
|
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[string] $TagVersion,
|
[string] $TagName,
|
||||||
|
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
@@ -17,12 +17,12 @@ function Push-AnkaTemplateToRegistry {
|
|||||||
$images = anka --machine-readable registry --registry-path $RegistryUrl list | ConvertFrom-Json | ForEach-Object body
|
$images = anka --machine-readable registry --registry-path $RegistryUrl list | ConvertFrom-Json | ForEach-Object body
|
||||||
$images | Where-Object name -eq $TemplateName | ForEach-Object {
|
$images | Where-Object name -eq $TemplateName | ForEach-Object {
|
||||||
$id = $_.id
|
$id = $_.id
|
||||||
Show-StringWithFormat "Deleting '$TemplateName[$id]' VM and '$TagVersion' tag"
|
Show-StringWithFormat "Deleting '$TemplateName[$id]' VM and '$TagName' tag"
|
||||||
$uri = '{0}/registry/vm?id={1}' -f $RegistryUrl, $id
|
$uri = '{0}/registry/vm?id={1}' -f $RegistryUrl, $id
|
||||||
Invoke-WebRequest -Uri $uri -Method Delete | Out-Null
|
Invoke-WebRequest -Uri $uri -Method Delete | Out-Null
|
||||||
}
|
}
|
||||||
|
|
||||||
$command = "anka registry --registry-path $RegistryUrl push --force --tag $TagVersion $TemplateName"
|
$command = "anka registry --registry-path $RegistryUrl push --force --tag $TagName $TemplateName"
|
||||||
Invoke-AnkaCommand -Command $command
|
Invoke-AnkaCommand -Command $command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ param(
|
|||||||
[int] $CPUCount = 6,
|
[int] $CPUCount = 6,
|
||||||
[int] $RamSizeGb = 7,
|
[int] $RamSizeGb = 7,
|
||||||
[int] $DiskSizeGb = 300,
|
[int] $DiskSizeGb = 300,
|
||||||
[string] $DisplayResolution = "1920x1080"
|
[string] $DisplayResolution = "1920x1080",
|
||||||
|
[string] $TagName = [DateTimeOffset]::Now.ToUnixTimeSeconds()
|
||||||
)
|
)
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
@@ -179,5 +180,5 @@ Write-Host "`t[*] Setting screen resolution to $DisplayResolution for $TemplateN
|
|||||||
Set-AnkaVMDisplayResolution -VMName $TemplateName -DisplayResolution $DisplayResolution
|
Set-AnkaVMDisplayResolution -VMName $TemplateName -DisplayResolution $DisplayResolution
|
||||||
|
|
||||||
# Push a VM template (and tag) to the Cloud
|
# Push a VM template (and tag) to the Cloud
|
||||||
Write-Host "`t[*] Pushing '$TemplateName' image with '$ShortMacOSVersion' tag to the '$RegistryUrl' registry..."
|
Write-Host "`t[*] Pushing '$TemplateName' image with '$TagName' tag to the '$RegistryUrl' registry..."
|
||||||
Push-AnkaTemplateToRegistry -RegistryUrl $registryUrl -TagVersion $shortMacOSVersion -TemplateName $TemplateName
|
Push-AnkaTemplateToRegistry -RegistryUrl $registryUrl -TagName $TagName -TemplateName $TemplateName
|
||||||
|
|||||||
Reference in New Issue
Block a user