Include test toolkit in cached image when toolkit flags are set#4144
Open
jeffreybulanadi wants to merge 1 commit into
Open
Include test toolkit in cached image when toolkit flags are set#4144jeffreybulanadi wants to merge 1 commit into
jeffreybulanadi wants to merge 1 commit into
Conversation
When imageName is specified in Run-AlPipeline and any of installTestRunner, installTestFramework, installTestLibraries, or installPerformanceToolkit are set, pass the corresponding includeTest* flags to New-BcContainer so that New-BcImage bakes the test toolkit into the cached image. Previously these flags were absent from the container creation parameters, so New-BcImage always created images with includeTestToolkit=False. The toolkit then had to be imported from scratch into every new container, adding roughly one minute per pipeline run on self-hosted runners that use cacheImageName. With this change, the first build creates the image with the toolkit included; subsequent builds that reuse the cached image find the toolkit already present and the Import-TestToolkitToBcContainer step completes quickly as a no-op. The include logic mirrors the existing mapping used in the Import-TestToolkitToBcContainer call further down in the pipeline: includeTestLibrariesOnly = installTestLibraries includeTestFrameworkOnly = !installTestLibraries AND (installTestFramework OR installPerformanceToolkit) includePerformanceToolkit = installPerformanceToolkit Fixes microsoft/AL-Go#2076 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
imageNameis specified inRun-AlPipelineand any ofinstallTestRunner,installTestFramework,installTestLibraries, orinstallPerformanceToolkitare set, pass the correspondingincludeTest*flags toNew-BcContainerso thatNew-BcImagebakes the test toolkit into the cached image.Fixes microsoft/AL-Go#2076
Root Cause
In
AppHandling/Run-AlPipeline.ps1, theGetBuildContainerfunction builds$Parametersfor the$NewBcContainerscriptblock. TheimageNamewas included in these parameters, butincludeTestToolkit,includeTestLibrariesOnly,includeTestFrameworkOnly, andincludePerformanceToolkitwere not. As a result,New-BcContaineralways calledNew-BcImagewithincludeTestToolkit=False, regardless of what was requested.The test toolkit then had to be imported from scratch on every container creation via
Import-TestToolkitToBcContainer, adding roughly one minute per pipeline run on self-hosted runners that usecacheImageName.Fix
Expand the
if ($imageName)block to also add toolkit inclusion flags when any toolkit install switch is set. The mapping mirrors the existing logic used inImport-TestToolkitToBcContainerlater in the pipeline:includeTestLibrariesOnly=installTestLibrariesincludeTestFrameworkOnly=!installTestLibraries AND (installTestFramework OR installPerformanceToolkit)includePerformanceToolkit=installPerformanceToolkitBehavior
Import-TestToolkitToBcContainerfinds the toolkit already installed and completes quickly, saving approximately one minute per run.imageName(GitHub-hosted runners): no change.imageNamebut no toolkit flags: no change.Workaround Comparison
The reporter workaround was to override
NewBcContainerwith a custom script that adds these parameters manually. This fix makes that workaround unnecessary by handling it in the pipeline itself.