-
Notifications
You must be signed in to change notification settings - Fork 686
Support for container app job #11302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11302 Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11302" |
This pull request introduces support for Azure Container App Jobs in addition to existing Azure Container Apps functionality. It achieves this by adding new extension methods, annotation types, and context classes, and by refactoring the container app context management to handle both app and job types more flexibly. Support for Azure Container App Jobs: Added new extension methods PublishAsAzureContainerAppJob<T> for both ContainerResource and ProjectResource to allow resources to be published as Azure Container App Jobs, using a new configuration annotation. [1] [2] Introduced the AzureContainerJobCustomizationAnnotation class, which enables custom configuration actions for Azure Container App Jobs. Refactoring and Infrastructure: Added a new abstract base class BaseContainerAppContext to encapsulate shared logic for both container apps and jobs, including environment variable, argument, and volume processing. Updated ContainerAppEnvironmentContext to store and manage BaseContainerAppContext instances rather than just ContainerAppContext, and to instantiate the correct context type (app or job) based on resource annotations. Fix dotnet#4366
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for Azure Container App Jobs to the existing Aspire Azure Container Apps functionality. This enables scenarios where containers need to run as scheduled or manual jobs rather than continuously running services.
Key changes:
- Added new
PublishAsAzureContainerAppJob
extension methods for both container and project resources - Introduced a new base class architecture to handle shared logic between container apps and jobs
- Added validation to prevent conflicting container app and job configurations on the same resource
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
AzureContainerAppsTests.cs | Added comprehensive test coverage for container app job functionality |
ContainerAppJobContext.cs | New context class for handling Azure Container App Job creation and configuration |
ContainerAppEnvironmentContext.cs | Updated to support both app and job contexts with proper validation |
ContainerAppContext.cs | Refactored to inherit from BaseContainerAppContext, removing duplicated code |
BaseContainerAppContext.cs | New abstract base class containing shared logic for both apps and jobs |
AzureContainerJobCustomizationAnnotation.cs | New annotation type for job customization |
AzureContainerAppProjectExtensions.cs | Added PublishAsAzureContainerAppJob extension method for project resources |
AzureContainerAppContainerExtensions.cs | Added PublishAsAzureContainerAppJob extension method for container resources |
Comments suppressed due to low confidence (1)
src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppProjectExtensions.cs:1
- Missing closing angle bracket. Should be
builder.AddProject<Projects.Api>().PublishAsAzureContainerAppJob
// Licensed to the .NET Foundation under one or more agreements.
/// </example> | ||
/// </remarks> | ||
[Experimental("ASPIREAZURE002", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")] | ||
public static IResourceBuilder<T> PublishAsAzureContainerAppJob<T>(this IResourceBuilder<T> container, Action<AzureResourceInfrastructure, ContainerAppJob> configure) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfowl - do I also need to do an extension method for Executables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use IComputeResource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See
aspire/src/Aspire.Hosting.Azure.AppService/AzureAppServiceComputeResourceExtensions.cs
Line 34 in b7914a7
where T : IComputeResource |
Description
This pull request introduces support for Azure Container App Jobs in addition to existing Azure Container Apps functionality. It achieves this by adding new extension methods, annotation types, and context classes, and by refactoring the container app context management to handle both app and job types more flexibly.
Support for Azure Container App Jobs:
PublishAsAzureContainerAppJob<T>
for bothContainerResource
andProjectResource
to allow resources to be published as Azure Container App Jobs, using a new configuration annotation. [1] [2]AzureContainerJobCustomizationAnnotation
class, which enables custom configuration actions for Azure Container App Jobs.Refactoring and Infrastructure:
BaseContainerAppContext
to encapsulate shared logic for both container apps and jobs, including environment variable, argument, and volume processing.ContainerAppEnvironmentContext
to store and manageBaseContainerAppContext
instances rather than justContainerAppContext
, and to instantiate the correct context type (app or job) based on resource annotations.Fix #4366
Checklist
<remarks />
and<code />
elements on your triple slash comments?