Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions Actions/RunPipeline/RunPipeline.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,6 @@ try {

$additionalCountries = $settings.additionalCountries

$imageName = ""
if (-not $gitHubHostedRunner) {
$imageName = $settings.cacheImageName
if ($imageName) {
Write-Host "::group::Flush ContainerHelper Cache"
Flush-ContainerHelperCache -cache 'all,exitedcontainers' -keepdays $settings.cacheKeepDays
Write-Host "::endgroup::"
}
}
$authContext = $null
$environmentName = ""
$CreateRuntimePackages = $false
Expand Down Expand Up @@ -322,6 +313,21 @@ try {
}
}

$isNewBcContainerOverridden = $false
if ($runAlPipelineParams.Keys -notcontains 'NewBcContainer') {
$runAlPipelineParams += @{
"NewBcContainer" = {
Param([Hashtable]$parameters)
$parameters.additionalParameters += @("--label creator=AL-Go");
New-BcContainer @parameters;
Invoke-ScriptInBcContainer $parameters.ContainerName -scriptblock { $progressPreference = 'SilentlyContinue' }
}
}
}
else {
$isNewBcContainerOverridden = $true
}

if ($runAlPipelineParams.Keys -notcontains 'RemoveBcContainer') {
$runAlPipelineParams += @{
"RemoveBcContainer" = {
Expand Down Expand Up @@ -369,6 +375,22 @@ try {
}
}

$imageName = ""
if (-not $gitHubHostedRunner) {
$imageName = $settings.cacheImageName
if ($imageName) {
Write-Host "::group::Flush ContainerHelper Cache"
# If a custom NewBcContainer is used, we can't guarantee that containers are marked as created by AL-Go. In that case purge all.
$flushCacheParam = 'all,exitedcontainers'
if (!$isNewBcContainerOverridden) {
$flushCacheParam += ',ALGoContainersOnly'
}
OutputDebug -message "Running Flush-ContainerHelperCache with parameters: -cache $flushCacheParam -keepdays $($settings.cacheKeepDays)"
Flush-ContainerHelperCache -cache $flushCacheParam -keepdays $settings.cacheKeepDays
Write-Host "::endgroup::"
}
}

if ((($bcContainerHelperConfig.ContainsKey('TrustedNuGetFeeds') -and ($bcContainerHelperConfig.TrustedNuGetFeeds.Count -gt 0)) -or ($gitHubPackagesContext)) -and ($runAlPipelineParams.Keys -notcontains 'InstallMissingDependencies')) {
if ($githubPackagesContext) {
$gitHubPackagesCredential = $gitHubPackagesContext | ConvertFrom-Json
Expand Down
Loading