You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2024/02/29 08:39:53 UTC

(incubator-devlake) branch release-v0.21 updated: fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines (#7061)

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch release-v0.21
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.21 by this push:
     new e96c8f21d fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines (#7061)
e96c8f21d is described below

commit e96c8f21d71db5dda9b34c57bc29d9089dcda3ab
Author: Lynwee <li...@merico.dev>
AuthorDate: Thu Feb 29 16:39:44 2024 +0800

    fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines (#7061)
---
 backend/python/plugins/azuredevops/azuredevops/streams/builds.py | 2 +-
 backend/python/plugins/azuredevops/azuredevops/streams/jobs.py   | 2 +-
 backend/python/pydevlake/pydevlake/domain_layer/devops.py        | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
index aaf7a7be0..cb3b9f652 100644
--- a/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
+++ b/backend/python/plugins/azuredevops/azuredevops/streams/builds.py
@@ -67,7 +67,7 @@ class Builds(Stream):
         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 = ""
+            environment = devops.CICDEnvironment.EMPTY
 
         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 39c8883cc..9a309a2a7 100644
--- a/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py
+++ b/backend/python/plugins/azuredevops/azuredevops/streams/jobs.py
@@ -84,7 +84,7 @@ class Jobs(Substream):
         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 = ""
+            environment = devops.CICDEnvironment.EMPTY
 
         if j.finish_time:
             duration_sec = abs(j.finish_time.timestamp() - j.start_time.timestamp())
diff --git a/backend/python/pydevlake/pydevlake/domain_layer/devops.py b/backend/python/pydevlake/pydevlake/domain_layer/devops.py
index abcd93448..3b6608fb3 100644
--- a/backend/python/pydevlake/pydevlake/domain_layer/devops.py
+++ b/backend/python/pydevlake/pydevlake/domain_layer/devops.py
@@ -44,6 +44,7 @@ class CICDEnvironment(Enum):
     PRODUCTION = "PRODUCTION"
     STAGING = "STAGING"
     TESTING = "TESTING"
+    EMPTY = ""
 
 
 class CICDPipeline(DomainModel, table=True):
@@ -66,7 +67,7 @@ class CICDPipeline(DomainModel, table=True):
     queued_duration_sec: Optional[float]
 
     type: Optional[CICDType]
-    environment: Optional[str]
+    environment: Optional[CICDEnvironment]
 
 
 class CiCDPipelineCommit(NoPKModel, table=True):
@@ -100,7 +101,7 @@ class CICDTask(DomainModel, table=True):
     original_result: Optional[str]
 
     type: Optional[CICDType]
-    environment: Optional[str]
+    environment: Optional[CICDEnvironment]
 
     created_date: Optional[datetime]
     queued_date: Optional[datetime]