This is an automated email from the ASF dual-hosted git repository.
lynwee pushed a commit to branch lw-fix-azure-0226
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/lw-fix-azure-0226 by this push:
new 99be7c343 fix(azuredevops): fix environment field in cicd_tasks and
cicd_pipelins
99be7c343 is described below
commit 99be7c3436dc158d1f011727623c7197518fb126
Author: Lynwee Hou <[email protected]>
AuthorDate: Mon Feb 26 15:43:35 2024 +0800
fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelins
---
backend/python/plugins/azuredevops/azuredevops/streams/builds.py | 7 ++++---
backend/python/plugins/azuredevops/azuredevops/streams/jobs.py | 6 +++---
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
index b24dc1be8..41518f3a0 100644
--- a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
+++ b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
@@ -62,9 +62,10 @@ class Builds(Stream):
type = devops.CICDType.BUILD
if ctx.scope_config.deployment_pattern and
ctx.scope_config.deployment_pattern.search(b.name):
type = devops.CICDType.DEPLOYMENT
- environment = devops.CICDEnvironment.TESTING
- if ctx.scope_config.production_pattern and
ctx.scope_config.production_pattern.search(b.name):
- environment = devops.CICDEnvironment.PRODUCTION
+
+ environment = devops.CICDEnvironment.PRODUCTION
+ if ctx.scope_config.production_pattern is not None and not
ctx.scope_config.production_pattern.search(b.name):
+ environment = ""
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 06a6e481a..b13a31b87 100644
--- a/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py
+++ b/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py
@@ -81,9 +81,9 @@ class Jobs(Substream):
type = devops.CICDType.BUILD
if ctx.scope_config.deployment_pattern and
ctx.scope_config.deployment_pattern.search(j.name):
type = devops.CICDType.DEPLOYMENT
- environment = devops.CICDEnvironment.TESTING
- if ctx.scope_config.production_pattern and
ctx.scope_config.production_pattern.search(j.name):
- environment = devops.CICDEnvironment.PRODUCTION
+ environment = devops.CICDEnvironment.PRODUCTION
+ if ctx.scope_config.production_pattern is not None and not
ctx.scope_config.production_pattern.search(j.name):
+ environment = ""
if j.finish_time:
duration_sec =
abs(j.finish_time.timestamp()-j.start_time.timestamp())