From 159e4d8464dce8ec7041e6c8fadacf9be64d93f8 Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Wed, 3 Jun 2026 11:46:32 +0800 Subject: [PATCH 1/3] Add aspire testing instructions --- docs/test-ghcr-tag-aspire/AppHost.cs | 51 ++++++++++++++++++++ docs/test-ghcr-tag-aspire/aspire.config.json | 5 ++ docs/testing.md | 28 +++++++++++ 3 files changed, 84 insertions(+) create mode 100644 docs/test-ghcr-tag-aspire/AppHost.cs create mode 100644 docs/test-ghcr-tag-aspire/aspire.config.json diff --git a/docs/test-ghcr-tag-aspire/AppHost.cs b/docs/test-ghcr-tag-aspire/AppHost.cs new file mode 100644 index 0000000000..cd236714a2 --- /dev/null +++ b/docs/test-ghcr-tag-aspire/AppHost.cs @@ -0,0 +1,51 @@ +#:sdk Aspire.AppHost.Sdk@13.4.0 +#:package Particular.Aspire.Hosting.ServicePlatform@1.0.0-alpha.4 +#:package Aspire.Hosting.RabbitMQ@13.4.0 + +using Aspire.Hosting; +using Particular.Aspire.Hosting.ServicePlatform.Transport; + +var builder = DistributedApplication.CreateBuilder(args); + +var transportUserName = builder.AddParameter("transportUserName", "guest", secret: true); +var transportPassword = builder.AddParameter("transportPassword", "guest", secret: true); + +var transport = builder.AddRabbitMQ("transport", transportUserName, transportPassword) + .WithManagementPlugin(15672) + .WithUrlForEndpoint("management", url => url.DisplayText = "RabbitMQ Management"); + +builder + .AddParticularPlatform("particular") + .WithTransportRabbitMQ(RabbitMqRouting.QuorumConventionalRouting, transport) + .AddDefaultComponents(); + +//using positional param for now since there's only one +if (args.Length > 1) +{ + UsePrereleaseImage(builder, args[1]); +} else { + Console.WriteLine("No arguments provided, defaulting to published 'latest' images'"); +} + +var app = builder.Build(); + +await app.RunAsync(); + +static void UsePrereleaseImage(IDistributedApplicationBuilder builder, string tag) +{ + Console.WriteLine($"Using prerelease image tag: {tag}"); + foreach (var c in builder.Resources.OfType()) + { + if (!c.TryGetLastAnnotation(out var image)) + { + continue; + } + + if (image.Image.StartsWith("particular/servicecontrol")) + { + builder + .CreateResourceBuilder(c) + .WithImage($"ghcr.io/{image.Image}", tag); + } + } +} \ No newline at end of file diff --git a/docs/test-ghcr-tag-aspire/aspire.config.json b/docs/test-ghcr-tag-aspire/aspire.config.json new file mode 100644 index 0000000000..09075c45d9 --- /dev/null +++ b/docs/test-ghcr-tag-aspire/aspire.config.json @@ -0,0 +1,5 @@ +{ + "appHost": { + "path": "AppHost.cs" + } +} \ No newline at end of file diff --git a/docs/testing.md b/docs/testing.md index eccdd7bc79..e3b056fb1e 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -63,3 +63,31 @@ Containers built by a PR and stored on GitHub Container Registry can be tested l * [Monitoring API](http://localhost:33633) * [ServicePulse (latest from Docker Hub)](http://localhost:9090) 6. Tear down services using `docker compose down`. + + +## Container tests using Aspire + +The https://github.com/Particular/Particular.Aspire.Hosting.ServicePlatform package integrates servicecontrol with the Aspire hosting platform. This package configures environment variables to attach the platform. There is a single file apphost in [`testghcr-tag-aspire`](/docs/testghcr-tag-aspire) to start up serviceconrol from a prerelease container image. + +Containers built by a PR and stored on GitHub Container Registry can be tested locally: + +1. Make sure you have the [Aspire CLI installed](https://aspire.dev/get-started/install-cli/). +2. [Authenticate to the GitHub Container Registry using a personal access token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic). + - Create a [classic token](https://github.com/settings/tokens). Select the scope for `read:packages` + - Copy the newly created token text. + - Run the following command in a terminal: + ```shell + docker login ghcr.io + ``` + you will be prompted for a username (your particular.net email) and a password (the token) + - ensure that you get a successful login message. + - Use `docker logout ghcr.io` once the following steps are complete and consider removing the token from github if its no longer needed. +4. Run `aspire run docs/test-ghcr-tag-aspire/AppHost.cs -- [tag]` to start the application, where [tag] is the PR-based tag (in the form `pr-####`) to test. If no tag is provided, it will default to the `latest` tag. +5. Once running you can open the dashboard from the link in the terminal, this dashboard will provide the assigned ports for each service. + * RabbitMQ Management (Login: `guest`/`guest`) + * RavenDB + * ServiceControl API + * Audit API + * Monitoring API + * ServicePulse (latest from Docker Hub) +6. Aspire will automatically tear down the application when you exit the CLI process. \ No newline at end of file From 3c9065dd529bc71c25741c6a709fa74b0d479301 Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Wed, 3 Jun 2026 14:44:47 +0800 Subject: [PATCH 2/3] Review updates --- docs/test-ghcr-tag-aspire/AppHost.cs | 2 +- docs/testing.md | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/docs/test-ghcr-tag-aspire/AppHost.cs b/docs/test-ghcr-tag-aspire/AppHost.cs index cd236714a2..ec52e46461 100644 --- a/docs/test-ghcr-tag-aspire/AppHost.cs +++ b/docs/test-ghcr-tag-aspire/AppHost.cs @@ -1,5 +1,5 @@ #:sdk Aspire.AppHost.Sdk@13.4.0 -#:package Particular.Aspire.Hosting.ServicePlatform@1.0.0-alpha.4 +#:package Particular.Aspire.Hosting.ServicePlatform@1.* #:package Aspire.Hosting.RabbitMQ@13.4.0 using Aspire.Hosting; diff --git a/docs/testing.md b/docs/testing.md index e3b056fb1e..87786197a7 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -67,27 +67,18 @@ Containers built by a PR and stored on GitHub Container Registry can be tested l ## Container tests using Aspire -The https://github.com/Particular/Particular.Aspire.Hosting.ServicePlatform package integrates servicecontrol with the Aspire hosting platform. This package configures environment variables to attach the platform. There is a single file apphost in [`testghcr-tag-aspire`](/docs/testghcr-tag-aspire) to start up serviceconrol from a prerelease container image. +The https://github.com/Particular/Particular.Aspire.Hosting.ServicePlatform package integrates servicecontrol with the Aspire hosting platform. This package configures environment variables to attach the platform. There is a single file apphost in [`test-ghcr-tag-aspire`](/docs/test-ghcr-tag-aspire) to start up serviceconrol from a prerelease container image. Containers built by a PR and stored on GitHub Container Registry can be tested locally: -1. Make sure you have the [Aspire CLI installed](https://aspire.dev/get-started/install-cli/). -2. [Authenticate to the GitHub Container Registry using a personal access token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic). - - Create a [classic token](https://github.com/settings/tokens). Select the scope for `read:packages` - - Copy the newly created token text. - - Run the following command in a terminal: - ```shell - docker login ghcr.io - ``` - you will be prompted for a username (your particular.net email) and a password (the token) - - ensure that you get a successful login message. - - Use `docker logout ghcr.io` once the following steps are complete and consider removing the token from github if its no longer needed. -4. Run `aspire run docs/test-ghcr-tag-aspire/AppHost.cs -- [tag]` to start the application, where [tag] is the PR-based tag (in the form `pr-####`) to test. If no tag is provided, it will default to the `latest` tag. -5. Once running you can open the dashboard from the link in the terminal, this dashboard will provide the assigned ports for each service. +1. Set up your github container registry credentials as described in the [Container tests](#container-tests) section above. +2. Make sure you have the [Aspire CLI installed](https://aspire.dev/get-started/install-cli/). +3. Run `aspire run docs/test-ghcr-tag-aspire/AppHost.cs -- tag` to start the application, where `tag` is the PR-based tag (in the form `pr-####`) to test. If no tag is provided, it will default to the `latest` tag. +4. Once running you can open the dashboard from the link in the terminal, this dashboard will provide the assigned ports for each service. * RabbitMQ Management (Login: `guest`/`guest`) * RavenDB * ServiceControl API * Audit API * Monitoring API * ServicePulse (latest from Docker Hub) -6. Aspire will automatically tear down the application when you exit the CLI process. \ No newline at end of file +5. Aspire will automatically tear down the application when you exit the CLI process. \ No newline at end of file From 17c9201b8f6e4effa7a152ec00790930595ea473 Mon Sep 17 00:00:00 2001 From: Rhys Bevilaqua Date: Wed, 3 Jun 2026 14:46:58 +0800 Subject: [PATCH 3/3] move review changes --- docs/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/testing.md b/docs/testing.md index 87786197a7..62bb10ec96 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -67,7 +67,7 @@ Containers built by a PR and stored on GitHub Container Registry can be tested l ## Container tests using Aspire -The https://github.com/Particular/Particular.Aspire.Hosting.ServicePlatform package integrates servicecontrol with the Aspire hosting platform. This package configures environment variables to attach the platform. There is a single file apphost in [`test-ghcr-tag-aspire`](/docs/test-ghcr-tag-aspire) to start up serviceconrol from a prerelease container image. +The [Particular.Aspire.Hosting.ServicePlatform](https://github.com/Particular/Particular.Aspire.Hosting.ServicePlatform) package integrates the Particular Platform with the Aspire hosting platform. This package configures environment variables to attach the platform. There is a single file apphost in [`test-ghcr-tag-aspire`](/docs/test-ghcr-tag-aspire) to start up serviceconrol from a prerelease container image. Containers built by a PR and stored on GitHub Container Registry can be tested locally: