You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ly...@apache.org on 2024/05/08 09:18:51 UTC

(incubator-devlake) branch main updated: fix: jenkins jobs are mislabeled as production deployments when they are skipped. (#7444)

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

lynwee 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 4b89aa064 fix: jenkins jobs are mislabeled as production deployments when they are skipped. (#7444)
4b89aa064 is described below

commit 4b89aa06426a67c9156c2fd82dfb61c4fcee14a0
Author: abeizn <zi...@merico.dev>
AuthorDate: Wed May 8 17:18:46 2024 +0800

    fix: jenkins jobs are mislabeled as production deployments when they are skipped. (#7444)
---
 backend/plugins/jenkins/tasks/build_cicd_convertor.go | 4 ++++
 backend/plugins/jenkins/tasks/stage_convertor.go      | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/backend/plugins/jenkins/tasks/build_cicd_convertor.go b/backend/plugins/jenkins/tasks/build_cicd_convertor.go
index 22e12bd48..34ec88d57 100644
--- a/backend/plugins/jenkins/tasks/build_cicd_convertor.go
+++ b/backend/plugins/jenkins/tasks/build_cicd_convertor.go
@@ -155,6 +155,10 @@ func ConvertBuildsToCicdTasks(taskCtx plugin.SubTaskContext) (err errors.Error)
 					Environment: data.RegexEnricher.ReturnNameIfOmittedOrMatched(devops.PRODUCTION, jenkinsBuild.FullName),
 					PipelineId:  buildIdGen.Generate(jenkinsBuild.ConnectionId, jenkinsBuild.FullName),
 				}
+				// if the task is not executed, set the result to default, so that it will not be calculated in the dora
+				if jenkinsTask.OriginalStatus == "NOT_EXECUTED" {
+					jenkinsTask.Result = devops.RESULT_DEFAULT
+				}
 				results = append(results, jenkinsTask)
 
 			}
diff --git a/backend/plugins/jenkins/tasks/stage_convertor.go b/backend/plugins/jenkins/tasks/stage_convertor.go
index 352eca22a..35c31fade 100644
--- a/backend/plugins/jenkins/tasks/stage_convertor.go
+++ b/backend/plugins/jenkins/tasks/stage_convertor.go
@@ -155,6 +155,10 @@ func ConvertStages(taskCtx plugin.SubTaskContext) (err errors.Error) {
 				Type:           data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, body.Name),
 				Environment:    data.RegexEnricher.ReturnNameIfOmittedOrMatched(devops.PRODUCTION, body.Name),
 			}
+			// if the task is not executed, set the result to default, so that it will not be calculated in the dora
+			if jenkinsTask.OriginalStatus == "NOT_EXECUTED" {
+				jenkinsTask.Result = devops.RESULT_DEFAULT
+			}
 			results = append(results, jenkinsTask)
 			return results, nil
 		},