From a7e4aed2b9a312b145121e6bd4f29783f37e749b Mon Sep 17 00:00:00 2001 From: Adebayo Oluwadunsin Iyanuoluwa <88881603+oiadebayo@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:37:16 +0100 Subject: [PATCH] [Integration][ADO] wiql base query update (#1142) --- integrations/azure-devops/CHANGELOG.md | 9 +++++++++ .../azure_devops/client/azure_devops_client.py | 6 ++---- integrations/azure-devops/pyproject.toml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/integrations/azure-devops/CHANGELOG.md b/integrations/azure-devops/CHANGELOG.md index 52ff59dd05..13ea80e2cd 100644 --- a/integrations/azure-devops/CHANGELOG.md +++ b/integrations/azure-devops/CHANGELOG.md @@ -7,11 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## 0.1.83 (2024-11-12) + + +### Improvements + +- Updated wiql base query to use immutable fields for fetching work items related to a project + + ## 0.1.82 (2024-11-12) ### Improvements + - Bumped ocean version to ^0.13.1 diff --git a/integrations/azure-devops/azure_devops/client/azure_devops_client.py b/integrations/azure-devops/azure_devops/client/azure_devops_client.py index 4e86886148..981f37dffb 100644 --- a/integrations/azure-devops/azure_devops/client/azure_devops_client.py +++ b/integrations/azure-devops/azure_devops/client/azure_devops_client.py @@ -21,7 +21,7 @@ # Maximum number of work item IDs allowed in a single API request # (based on Azure DevOps API limitations) https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work-items/list?view=azure-devops-rest-7.1&tabs=HTTP MAX_WORK_ITEMS_PER_REQUEST = 200 -MAX_WORK_ITEMS_RESULTS_PER_PROJECT = 20000 +MAX_WORK_ITEMS_RESULTS_PER_PROJECT = 19999 class AzureDevopsClient(HTTPBaseClient): @@ -190,9 +190,7 @@ async def _fetch_work_item_ids(self, project: dict[str, Any]) -> list[int]: :return: A list of work item IDs. """ config = typing.cast(AzureDevopsWorkItemResourceConfig, event.resource_config) - wiql_query = ( - f"SELECT [Id] from WorkItems WHERE [System.AreaPath] = '{project['name']}'" - ) + wiql_query = f"SELECT [Id] from WorkItems WHERE [System.TeamProject] = '{project['name']}'" if config.selector.wiql: # Append the user-provided wiql to the WHERE clause diff --git a/integrations/azure-devops/pyproject.toml b/integrations/azure-devops/pyproject.toml index 988a458c69..d469f600f9 100644 --- a/integrations/azure-devops/pyproject.toml +++ b/integrations/azure-devops/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "azure-devops" -version = "0.1.82" +version = "0.1.83" description = "An Azure Devops Ocean integration" authors = ["Matan Geva "]