mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-28 04:20:23 +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)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string] $TagVersion,
|
||||
[string] $TagName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
@@ -17,12 +17,12 @@ function Push-AnkaTemplateToRegistry {
|
||||
$images = anka --machine-readable registry --registry-path $RegistryUrl list | ConvertFrom-Json | ForEach-Object body
|
||||
$images | Where-Object name -eq $TemplateName | ForEach-Object {
|
||||
$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
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ param(
|
||||
[int] $CPUCount = 6,
|
||||
[int] $RamSizeGb = 7,
|
||||
[int] $DiskSizeGb = 300,
|
||||
[string] $DisplayResolution = "1920x1080"
|
||||
[string] $DisplayResolution = "1920x1080",
|
||||
[string] $TagName = [DateTimeOffset]::Now.ToUnixTimeSeconds()
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -179,5 +180,5 @@ Write-Host "`t[*] Setting screen resolution to $DisplayResolution for $TemplateN
|
||||
Set-AnkaVMDisplayResolution -VMName $TemplateName -DisplayResolution $DisplayResolution
|
||||
|
||||
# Push a VM template (and tag) to the Cloud
|
||||
Write-Host "`t[*] Pushing '$TemplateName' image with '$ShortMacOSVersion' tag to the '$RegistryUrl' registry..."
|
||||
Push-AnkaTemplateToRegistry -RegistryUrl $registryUrl -TagVersion $shortMacOSVersion -TemplateName $TemplateName
|
||||
Write-Host "`t[*] Pushing '$TemplateName' image with '$TagName' tag to the '$RegistryUrl' registry..."
|
||||
Push-AnkaTemplateToRegistry -RegistryUrl $registryUrl -TagName $TagName -TemplateName $TemplateName
|
||||
|
||||
Reference in New Issue
Block a user