Change PublisherOptions - Allow skipping image building?#8563
Change PublisherOptions - Allow skipping image building?#8563davidfowl merged 1 commit intomicrosoft:mainfrom
Conversation
Update property access to use `PublisherOptions` directly for consistency. Introduce a new option to control image building during the publishing process. Ensure that image building only occurs when enabled. Adjust tests to accommodate these changes.
There was a problem hiding this comment.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Docker/DockerComposePublishingContext.cs:120
- Consider adding a unit test to verify that the .env file is created and populated with the expected environment variables.
var envFile = Path.Combine(PublisherOptions.OutputPath!, ".env");
| /// <summary> | ||
| /// Indicates whether to build container images during the publishing process. | ||
| /// </summary> | ||
| public bool BuildImages { get; set; } = true; |
There was a problem hiding this comment.
Should negate this bool here?
There was a problem hiding this comment.
Have it default false and explicit opt in to builds?
There was a problem hiding this comment.
I'm not sure we have a way to flow command line arguments from the publisher, so this needs to be configured in code (I believe).
There was a problem hiding this comment.
A clean win without polluting cli could be to handle extra publisher options from IConfiguration and the AppHosts AppSettings?
Then just utilise the configuration binder Get extension to populate an instance of "Optional" config, and "Merge" that onto the incoming (from cli) Publisher Options?
Maybe a small source generator to generate a MergeExtension, for each PublisherSettings derived instance?
There was a problem hiding this comment.
To be fair, could just be manually assigned, without the MergeExtension - we're only talking about a handful of options for each publisher - The helm one has more that Compose, and will potentially require even more for extension
I guess another option would be a new ManifestExpression, and have config directly in the AppHost declaratively
There was a problem hiding this comment.
We didn't get to mapping switches to config in 9.2 but as you've alluded the plan is to make use of IConfiguration. When registering publishers I'll probably have an optional mapping mechanism from switches to config sections.
Update property access to use
PublisherOptionsdirectly for consistency. Introduce a new option to control image building during the publishing process. Ensure that image building only occurs when enabled. Adjust tests to accommodate these changes.Just thinking a user probably wouldn't want to rebuild and re-version all project container images if they were simply changing and publishing a new compose for container resource changes (new env vars, new tags etc).
Fixes #8782
Checklist
<remarks />and<code />elements on your triple slash comments?breaking-changetemplate):doc-ideatemplate):