Skip to content

[release/13.2] Allow filtering endpoints from the default reference set#15586

Open
danegsta wants to merge 3 commits intorelease/13.2from
danegsta/backportEndpoints
Open

[release/13.2] Allow filtering endpoints from the default reference set#15586
danegsta wants to merge 3 commits intorelease/13.2from
danegsta/backportEndpoints

Conversation

@danegsta
Copy link
Member

Backport of #15558 for release/13.2

  • Allow filtering endpoints from the default reference set
  • Update snapshots for codegen
  • Update the property to ExcludeReferenceEndpoint and make it false by default
  • Update test snapshot with outdated containerApps API version

Fixes an issue where unrelated endpoints (such as the Keycloak management dashboard) can be reported in the default service discovery endpoint set for a resource. This can lead to references failing due to non-API endpoints being surfaced via service discovery.

This change allows individual endpoints to be excluded from the default set for a resource. They can still be referenced via a specific endpoint if needed.

* Allow filtering endpoints from the default reference set

* Update snapshots for codegen

* Update the property to ExcludeReferenceEndpoint and make it false by default

* Update test snapshot with outdated containerApps API version
@danegsta danegsta requested a review from joperezr March 25, 2026 20:54
@danegsta danegsta requested a review from mitchdenny as a code owner March 25, 2026 20:54
Copilot AI review requested due to automatic review settings March 25, 2026 20:54
@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15586

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15586"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Backport to release/13.2 enabling resource authors to exclude specific endpoints (e.g., management/health) from the default endpoint set surfaced by WithReference(resource), while still allowing explicit endpoint references.

Changes:

  • Added EndpointAnnotation.ExcludeReferenceEndpoint and propagated it through EndpointReference and default reference environment-variable injection logic.
  • Updated built-in resources/emulators (Keycloak, CosmosDB preview emulator, EventHubs emulator, ServiceBus emulator) to exclude non-API endpoints from the default reference set.
  • Added/updated tests and refreshed polyglot codegen snapshots to include the new excludeReferenceEndpoint capability/property.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Aspire.Hosting/ResourceBuilderExtensions.cs Filters default endpoint injection to skip endpoints marked ExcludeReferenceEndpoint, while keeping explicitly named endpoints included.
src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs Introduces ExcludeReferenceEndpoint API with XML docs and default behavior (false).
src/Aspire.Hosting/ApplicationModel/EndpointReference.cs Exposes ExcludeReferenceEndpoint on endpoint references for consumers/codegen.
src/Aspire.Hosting.Keycloak/KeycloakResourceBuilderExtensions.cs Excludes Keycloak management endpoint from default reference set.
src/Aspire.Hosting.Azure.CosmosDB/AzureCosmosDBExtensions.cs Excludes Cosmos DB preview emulator health endpoint from default reference set.
src/Aspire.Hosting.Azure.EventHubs/AzureEventHubsExtensions.cs Excludes EventHubs emulator health endpoint from default reference set.
src/Aspire.Hosting.Azure.ServiceBus/AzureServiceBusExtensions.cs Excludes ServiceBus emulator health endpoint from default reference set.
tests/Aspire.Hosting.Tests/WithReferenceTests.cs Adds coverage for default exclusion, explicit referencing of excluded endpoints, and default property value behavior.
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts Updates TS snapshot for new excludeReferenceEndpoint getter.
tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs Updates Rust snapshot for new exclude_reference_endpoint accessor.
tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py Updates Python snapshot for new exclude_reference_endpoint accessor.
tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java Updates Java snapshot for new excludeReferenceEndpoint accessor.
tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go Updates Go snapshot for new ExcludeReferenceEndpoint accessor.

@joperezr joperezr added the Servicing-approved Approved for servicing release label Mar 25, 2026
@github-actions
Copy link
Contributor

🎬 CLI E2E Test Recordings — 51 recordings uploaded (commit 4b2312c)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23570542526

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants