diff --git a/backend/python/plugins/azuredevops/azuredevops/api.py b/backend/python/plugins/azuredevops/azuredevops/api.py index 0ceb0b5f4c1..4caf91af65a 100644 --- a/backend/python/plugins/azuredevops/azuredevops/api.py +++ b/backend/python/plugins/azuredevops/azuredevops/api.py @@ -78,7 +78,9 @@ def commits(self, org: str, project: str, repo_id: str): return self.get(org, project, '_apis/git/repositories', repo_id, 'commits') def builds(self, org: str, project: str, repository_id: str, provider: str): - return self.get(org, project, '_apis/build/builds', repositoryId=repository_id, repositoryType=provider, deletedFilter='excludeDeleted') + return self.get(org, project, '_apis/build/builds', repositoryId=repository_id, repositoryType=provider, + deletedFilter='excludeDeleted', + queryOrder="finishTimeDescending") def jobs(self, org: str, project: str, build_id: int): return self.get(org, project, '_apis/build/builds', build_id, 'timeline') diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py index cb3b9f652da..ef47177591e 100644 --- a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py +++ b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py @@ -67,7 +67,7 @@ def convert(self, b: Build, ctx: Context): environment = devops.CICDEnvironment.PRODUCTION if ctx.scope_config.production_pattern is not None and ctx.scope_config.production_pattern.search( b.name) is None: - environment = devops.CICDEnvironment.EMPTY + environment = None if b.finish_time: duration_sec = abs(b.finish_time.timestamp() - b.start_time.timestamp()) diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py b/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py index 9a309a2a786..9c625c5f3e8 100644 --- a/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py +++ b/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py @@ -84,7 +84,7 @@ def convert(self, j: Job, ctx: Context) -> Iterable[devops.CICDPipeline]: environment = devops.CICDEnvironment.PRODUCTION if ctx.scope_config.production_pattern is not None and ctx.scope_config.production_pattern.search( j.name) is None: - environment = devops.CICDEnvironment.EMPTY + environment = None if j.finish_time: duration_sec = abs(j.finish_time.timestamp() - j.start_time.timestamp())