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:30:04 UTC

(incubator-devlake) branch main updated: fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines (#7060)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new d9816d1af fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines (#7060)
d9816d1af is described below

commit d9816d1afc2cd6299c4038663c40ecbf4131c43d
Author: Lynwee <li...@merico.dev>
AuthorDate: Thu Feb 29 16:29:59 2024 +0800

    fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines (#7060)
    
    * fix(azuredevops): fix environment field in cicd_tasks and cicd_pipelines
    
    * fix(log): format codes
---
 backend/impls/logruslog/init.go                                  | 6 +++---
 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 +++--
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/backend/impls/logruslog/init.go b/backend/impls/logruslog/init.go
index bb5ad4cd9..17df490f9 100644
--- a/backend/impls/logruslog/init.go
+++ b/backend/impls/logruslog/init.go
@@ -50,8 +50,8 @@ func init() {
 
 	var formatter logrus.Formatter
 
-    format := os.Getenv("LOGGING_FORMAT")
-	
+	format := os.Getenv("LOGGING_FORMAT")
+
 	switch format {
 	case "json":
 		formatter = &logrus.JSONFormatter{
@@ -63,7 +63,7 @@ func init() {
 			FullTimestamp:   true,
 		}
 	}
-	
+
 	inner.SetFormatter(formatter)
 
 	basePath := cfg.GetString("LOGGING_DIR")
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]