microsoft / azure-container-apps

Roadmap and issues for Azure Container Apps
MIT License
372 stars 29 forks source link

Feature Request: Remove KEDA jobs for Azure DevOps agents when a build in Azure DevOps is cancelled.. #823

Open lakovmartin opened 1 year ago

lakovmartin commented 1 year ago

Is your feature request related to a problem? Please describe.
I have been following this article for setting up Azure DevOps agents running as jobs using KEDA for scaling on Azure Container Apps.

There is an issue where if you have a build running in Azure DevOps and you cancel the build or pipeline before the job/s completes then the jobs will carry on running on the container app (see below screenshot)

image

This happened when I tried this out months ago and it seems like it's still an issue and maybe a limitation of KEDA. I would call this out and update the MS doc so at least people are aware of the limitation.

Describe the solution you'd like.
There should be a mechanism where if you cancel a job or pipeline in Azure DevOps before it finishes then the job should complete regardless in Azure Container Apps without leaving a trail of running jobs that are not executing anything.

Describe alternatives you've considered.
The only alternative is to run the agents on AKS or VM scale sets.

ahmelsayed commented 1 year ago

I'd think that mechanism should be part of the runner itself, right? KEDA runs a job instance for each queued pipeline run, but it has no control over which job instance will grab which pipeline run. That is up to the runner/DevOps. Does the same runner/pipeline canceling work with using AKS or VMs?

anthonychu commented 1 year ago

@lakovmartin Can you please create an issue at https://github.com/microsoft/azure-pipelines-agent/issues to see if it's something that can be addressed within the agent? I think the expectation is the agent process in run once mode (which is how it's configured in the tutorial) should exit when the pipeline job has ended, including when the pipeline run is cancelled; this should end the ACA job.