Use cacheImageName for local development environments - #2328
Conversation
Added note about local development environments using cacheImageName for artifact-specific image reuse.
There was a problem hiding this comment.
Pull request overview
Uses cacheImageName for faster local development container creation.
Changes:
- Passes the configured image name for local environments.
- Keeps cloud behavior unchanged.
- Documents the behavior in release notes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
Actions/AL-Go-Helper.ps1 |
Forwards cacheImageName to local pipelines. |
RELEASENOTES.md |
Documents cached local images and opt-out. |
| if ($kind -eq "local") { | ||
| $imageName = $settings.cacheImageName |
There was a problem hiding this comment.
I don't see any existing pester tests for CreateDevEnv. Since this is a small enough addition to that, feel free to omit this.
|
|
||
| $imageName = "" | ||
| if ($kind -eq "local") { | ||
| $imageName = $settings.cacheImageName |
There was a problem hiding this comment.
Agree with copilot here. Would be good to add a note about this in the settings.md
| $imageName = "" | ||
| if ($kind -eq "local") { | ||
| $imageName = $settings.cacheImageName | ||
| } |
aholstrup1
left a comment
There was a problem hiding this comment.
Overall looks good to me 👍 Just a few comments to resolve
| if ($kind -eq "local") { | ||
| $imageName = $settings.cacheImageName |
There was a problem hiding this comment.
I don't see any existing pester tests for CreateDevEnv. Since this is a small enough addition to that, feel free to omit this.
|
|
||
| $imageName = "" | ||
| if ($kind -eq "local") { | ||
| $imageName = $settings.cacheImageName |
There was a problem hiding this comment.
Agree with copilot here. Would be good to add a note about this in the settings.md
Summary
Use the existing
cacheImageNamesetting when creating a local development environment.CreateDevEnvcurrently passes an emptyimageNametoRun-AlPipeline, regardless of the configuredcacheImageName. As a result, local development environments cannot use the cached Business Central images already supported by AL-Go and BcContainerHelper.Problem
When
imageNameis empty, BcContainerHelper creates the container from the generic Business Central image and installs Business Central from the selected artifacts during every container creation.When a configured image name is passed, BcContainerHelper can create or reuse an artifact-specific image. Subsequent container creation can then use the prepared image instead of repeating the Business Central installation.
A local comparison demonstrated the difference:
With
imageNameset tomyBcContainerHelper found and reused the existing artifact-specific image:
The Business Central installation step was not executed again.
The complete container creation took 237 seconds in this run.
With an empty
imageNameBcContainerHelper used the generic image:
The Business Central installation alone took 209 seconds, and the complete container creation took 446 seconds in this run.
These timings are an observed example rather than a controlled benchmark, but the logs demonstrate the behavioral difference: using the cached image avoids repeating the Business Central installation when a matching image already exists.
Change
For local development environments, pass the existing
cacheImageNamesetting toRun-AlPipelineinstead of always passing an empty value.$sharedFolder = "" if ($project) { $sharedFolder = $baseFolder } + $imageName = "" + if ($kind -eq "local") { + $imageName = $settings.cacheImageName + } + Run-AlPipeline @runAlPipelineParams ` -accept_insiderEula:$accept_insiderEula ` -vsixFile $settings.vsixFile ` -pipelinename $workflowName ` - -imageName "" ` + -imageName $imageName ` -memoryLimit $settings.memoryLimit `Configuration
The existing AL-Go default remains unchanged:
{ "cacheImageName": "my" }Users who want to retain the current local development behavior can disable cached image creation in
.AL-Go/localDevEnv.settings.json:{ "cacheImageName": "" }Expected behavior
cacheImageName.my, BcContainerHelper creates or reuses an artifact-specific image.cacheImageNameto an empty string preserves the current behavior.✅ Checklist