Skip to content

Commit d04c216

Browse files
DanielGoehlerDaniel Goehler
andauthored
feat: Get-BCArtifactUrl - Add Support for -before and -after Parameters in NextMinor and NextMajor (#4075)
## Description This pull request introduces enhanced handling of the `-before` and `-after` parameters when using the `-select NextMinor` or `-select NextMajor` options in the `Get-BCArtifactUrl` cmdlet. Previously, these parameters were not considered when filtering artifact URLs for NextMinor or NextMajor versions. ## Motivation In our Azure DevOps pipelines—using ALOps—we often need to create containers based on `NextMinor` or `NextMajor` builds. Sometimes, multiple new builds are released on the same day, which can result in pipelines retrieving the latest build of today rather than the last stable build from the day before. This is not inherently problematic, but it can increase pipeline runtimes and introduce instability if today's docker container builds are frequently refreshed. By supporting the `-before` and `-after` parameters in conjunction with `-select NextMinor` and `-select NextMajor`, we can exclude today's latest build if necessary, and reliably fetch the last build from yesterday or a specified date range. This change should significantly improve pipeline performance and reliability. ## Example Usage ```powershell Get-BCArtifactUrl -accept_insiderEula -before 2025-12-18 -country de -select NextMinor -type Sandbox ``` This command will fetch the last `NextMinor` build before 2025-12-18 for Germany (`de`), allowing pipelines to intentionally skip today’s builds and use the previous stable release. ## Summary of Changes - Updated logic to consider `-before` and `-after` with `-select NextMinor`/`NextMajor` - Improved filtering of builds to support date-based exclusions/inclusions ## Benefits - More control over artifact selection in automated pipelines - Reduces unnecessary container creation and pipeline runtime - Increases reliability by allowing exclusion of freshly published builds when needed - Over the years, this reduces energy consumption (less build agents needed) and helps reduce the environment impact. --------- Co-authored-by: Daniel Goehler <[email protected]>
1 parent 66ef535 commit d04c216

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Artifacts/Get-BCArtifactUrl.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,20 @@ try {
116116
}
117117

118118
if (-not $country) { $country = 'w1' }
119-
$insiders = Get-BcArtifactUrl -country $country -storageAccount bcinsider -select All -doNotCheckPlatform:$doNotCheckPlatform -accept_insiderEula:$accept_insiderEula
119+
$insiderParams = @{
120+
country = $country
121+
storageAccount = 'bcinsider'
122+
select = 'All'
123+
doNotCheckPlatform = $doNotCheckPlatform
124+
accept_insiderEula = $accept_insiderEula
125+
}
126+
if ($before) {
127+
$insiderParams['before'] = $before
128+
}
129+
if ($after) {
130+
$insiderParams['after'] = $after
131+
}
132+
$insiders = Get-BcArtifactUrl @insiderParams
120133
$nextmajor = $insiders | Where-Object { $_.Split('/')[4].StartsWith($nextmajorversion) } | Select-Object -Last 1
121134
$nextminor = $insiders | Where-Object { $_.Split('/')[4].StartsWith($nextminorversion) } | Select-Object -Last 1
122135

ReleaseNotes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Temporarily avoid using dotnet 10 for assemblyProbingPaths
33
Issue 3986 Endless loop when errors occur during the execution of AL tests with external environments
44
Issue 3986 Execution of AL tests fails for test codeunits without test functions
5-
5+
Get-BCArtifactUrl: Add Support for -before and -after Parameters in NextMinor and NextMajor
66

77
6.1.10
88
Better performance when downloading NuGet packages by adding another cache folder, which defaults to c:\bcnuget.cache

0 commit comments

Comments
 (0)