Skip to content

Commit

Permalink
fix: Azure Pipelines Scaler uses correct endpoint when demands are set (
Browse files Browse the repository at this point in the history
kedacore#4387) (kedacore#4401)

Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Co-authored-by: Andy Ward <mortx@toothless.eldarrin.io>
  • Loading branch information
3 people committed Apr 13, 2023
1 parent 5ba7116 commit 6ac7099
Show file tree
Hide file tree
Showing 4 changed files with 564 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio
### Fixes

- **AWS SQS Scaler**: Respect `scaleOnInFlight` value ([#4276](https://github.com/kedacore/keda/issue/4276))
- **Azure Pipelines**: Fix for disallowing `$top` on query when using `meta.parentID` method ([#4397])

### Deprecations

Expand Down
8 changes: 7 additions & 1 deletion pkg/scalers/azure_pipelines_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,13 @@ func getAzurePipelineRequest(ctx context.Context, url string, metadata *azurePip
}

func (s *azurePipelinesScaler) GetAzurePipelinesQueueLength(ctx context.Context) (int64, error) {
url := fmt.Sprintf("%s/_apis/distributedtask/pools/%d/jobrequests?$top=%d", s.metadata.organizationURL, s.metadata.poolID, s.metadata.jobsToFetch)
// HotFix Issue (#4387), $top changes the format of the returned JSON
var url string
if s.metadata.parent != "" {
url = fmt.Sprintf("%s/_apis/distributedtask/pools/%d/jobrequests", s.metadata.organizationURL, s.metadata.poolID)
} else {
url = fmt.Sprintf("%s/_apis/distributedtask/pools/%d/jobrequests?$top=%d", s.metadata.organizationURL, s.metadata.poolID, s.metadata.jobsToFetch)
}
body, err := getAzurePipelineRequest(ctx, url, s.metadata, s.httpClient)
if err != nil {
return -1, err
Expand Down
2 changes: 2 additions & 0 deletions tests/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ TF_AZURE_APP_INSIGHTS_NAME=
TF_AZURE_DATA_EXPLORER_DB=
TF_AZURE_DATA_EXPLORER_ENDPOINT=
AZURE_DEVOPS_BUILD_DEFINITION_ID=
AZURE_DEVOPS_DEMAND_PARENT_BUILD_DEFINITION_ID=
AZURE_DEVOPS_ORGANIZATION_URL=
AZURE_DEVOPS_PAT=
AZURE_DEVOPS_POOL_NAME=
AZURE_DEVOPS_DEMAND_POOL_NAME=
AZURE_DEVOPS_PROJECT=
TF_AZURE_EVENTHBUS_MANAGEMENT_CONNECTION_STRING=
TF_AZURE_KEYVAULT_URI=
Expand Down
Loading

0 comments on commit 6ac7099

Please sign in to comment.