Skip to content
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

Azure Pipelines: Space in pool name causes HTTP 400 errors #5107

Closed
Tracked by #5207
chunderbolt opened this issue Oct 20, 2023 · 1 comment · Fixed by #5120
Closed
Tracked by #5207

Azure Pipelines: Space in pool name causes HTTP 400 errors #5107

chunderbolt opened this issue Oct 20, 2023 · 1 comment · Fixed by #5120
Labels
bug Something isn't working

Comments

@chunderbolt
Copy link
Contributor

chunderbolt commented Oct 20, 2023

Report

When the pool name contains a space (e.g. "Pool Name"), warnings of type KEDAScalerFailed appear in the logs:

error parsing azure Pipelines metadata: the Azure DevOps REST API returned error. url: https://dev.azure.com/org-url/_apis/distributedtask/pools?poolName=Pool Name status: 400 response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>

This doesn't happen when there's no space in the name.

Expected Behavior

I expected the scaler to do whatever's necessary to properly query the given pool name - assuming it's valid. This would result in the scaler calling https://dev.azure.com/org-url/_apis/distributedtask/pools?poolName=Pool%20Name (which returns correctly).

Actual Behavior

The scaler calls https://dev.azure.com/org-url/_apis/distributedtask/pools?poolName=Pool Name and the DevOps API complains that the request is malformed.

Steps to Reproduce the Problem

  1. Create a pool with a space in the name.
  2. Create a self-hosted docker agent.
  3. Run a pipeline that would utilise the self-hosted agent.
  4. Observe the errors in the logs.

Logs from KEDA operator

No response

KEDA Version

2.10.0 (according to kedaConfiguration in the JSON view of the Container App Environment resource)

Kubernetes Version

Unknown, as it's running in Container Apps.

Platform

Microsoft Azure

Scaler Details

Azure Pipelines

Anything else?

This happened when running a self-hosted docker agent using the KEDA azure-pipelines scaler in Azure Container Apps. I don't know whose responsibility it is to add URL encoding to the pool name: KEDA, Azure Container Apps, or the user. The docs don't mention it either way.

@chunderbolt chunderbolt added the bug Something isn't working label Oct 20, 2023
@JorTurFer
Copy link
Member

Nice catch!
We aren't using URL format on poolName here: https://github.com/kedacore/keda/blob/main/pkg/scalers/azure_pipelines_scaler.go#L268
Are you willing to contribute with the fix?

In the meantime, as ACA has its own release flow, I'd suggest using poolID to mitigate the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready To Ship
Development

Successfully merging a pull request may close this issue.

2 participants