From 73a28a19605415d4b48199a47fa799e62f7b649f Mon Sep 17 00:00:00 2001 From: YuTang Song <2313186065@qq.com> Date: Fri, 15 May 2026 14:37:28 +0800 Subject: [PATCH 1/5] feat: add debug job support and exclude debug tasks from statistics Signed-off-by: YuTang Song <2313186065@qq.com> --- .../core/common/repository/models/job_info.go | 2 ++ .../common/repository/models/wokflow_task_v4.go | 1 + .../core/common/repository/mongodb/job_info.go | 14 ++++++++++++++ .../workflowcontroller/jobcontroller/job_apollo.go | 1 + .../jobcontroller/job_custom_deploy.go | 1 + .../workflowcontroller/jobcontroller/job_deploy.go | 3 ++- .../jobcontroller/job_freestyle.go | 1 + .../jobcontroller/job_helm_chart_deploy.go | 1 + .../jobcontroller/job_helm_deploy.go | 1 + .../common/service/workflowcontroller/workflow.go | 11 ++++++----- .../aslan/core/stat/service/build_stat.go | 3 +++ 11 files changed, 33 insertions(+), 6 deletions(-) diff --git a/pkg/microservice/aslan/core/common/repository/models/job_info.go b/pkg/microservice/aslan/core/common/repository/models/job_info.go index 959dcd598d..647d8cf34b 100644 --- a/pkg/microservice/aslan/core/common/repository/models/job_info.go +++ b/pkg/microservice/aslan/core/common/repository/models/job_info.go @@ -32,6 +32,8 @@ type JobInfo struct { StartTime int64 `bson:"start_time" json:"start_time"` EndTime int64 `bson:"end_time" json:"end_time"` Duration int64 `bson:"duration" json:"duration"` + // IsDebug marks if the job belongs to a debug workflow run. + IsDebug bool `bson:"is_debug" json:"is_debug"` // ServiceType, ServiceName and ServiceModule are used exclusively for build & deploy jobs ServiceType string `bson:"service_type" json:"service_type"` ServiceName string `bson:"service_name" json:"service_name"` diff --git a/pkg/microservice/aslan/core/common/repository/models/wokflow_task_v4.go b/pkg/microservice/aslan/core/common/repository/models/wokflow_task_v4.go index a1544c0a53..010a016441 100644 --- a/pkg/microservice/aslan/core/common/repository/models/wokflow_task_v4.go +++ b/pkg/microservice/aslan/core/common/repository/models/wokflow_task_v4.go @@ -859,6 +859,7 @@ type WorkflowTaskCtx struct { WorkflowDisplayName string ProjectName string ProjectDisplayName string + IsDebug bool TaskID int64 Remark string RetryNum int diff --git a/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go b/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go index b80fcc9f66..4d61fd70cd 100644 --- a/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go +++ b/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go @@ -69,6 +69,7 @@ func (c *JobInfoColl) Create(ctx context.Context, args *models.JobInfo) error { func (c *JobInfoColl) GetProductionDeployJobs(startTime, endTime int64, projectName string) ([]*models.JobInfo, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["production"] = true query["type"] = bson.M{"$in": []string{ @@ -94,6 +95,7 @@ func (c *JobInfoColl) GetProductionDeployJobs(startTime, endTime int64, projectN func (c *JobInfoColl) GetTestJobs(startTime, endTime int64, projectName string) ([]*models.JobInfo, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["type"] = config.JobZadigTesting @@ -114,6 +116,7 @@ func (c *JobInfoColl) GetTestJobs(startTime, endTime int64, projectName string) func (c *JobInfoColl) GetTestJobsByWorkflow(workflowName string) ([]*models.JobInfo, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} query["workflow_name"] = workflowName query["type"] = config.JobZadigTesting @@ -130,6 +133,7 @@ func (c *JobInfoColl) GetTestJobsByWorkflow(workflowName string) ([]*models.JobI func (c *JobInfoColl) GetBuildJobs(startTime, endTime int64, projectName string) ([]*models.JobInfo, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["type"] = config.JobZadigBuild @@ -150,6 +154,7 @@ func (c *JobInfoColl) GetBuildJobs(startTime, endTime int64, projectName string) func (c *JobInfoColl) GetBuildJobsStats(startTime, endTime int64, projectNames []string) (*models.ServiceDeployCountWithStatus, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} if startTime > 0 && endTime > 0 { query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} } @@ -216,6 +221,7 @@ func (c *JobInfoColl) GetBuildJobsStats(startTime, endTime int64, projectNames [ func (c *JobInfoColl) GetDeployJobs(startTime, endTime int64, projectNames []string, productionType config.ProductionType) ([]*models.JobInfo, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["type"] = bson.M{"$in": []string{ string(config.JobZadigDeploy), @@ -254,6 +260,7 @@ func (c *JobInfoColl) GetDeployJobs(startTime, endTime int64, projectNames []str func (c *JobInfoColl) GetDeployJobsStats(startTime, endTime int64, projectNames []string, productionType config.ProductionType) ([]*models.ServiceDeployCountWithStatus, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} if startTime > 0 && endTime > 0 { query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} } @@ -346,6 +353,7 @@ func (c *JobInfoColl) GetTopDeployedService(startTime, endTime int64, projectNam }}, "service_name": bson.M{"$ne": ""}, } + query["is_debug"] = bson.M{"$ne": true} switch productionType { case config.Production: @@ -458,6 +466,7 @@ func (c *JobInfoColl) GetTopDeployFailedService(startTime, endTime int64, projec }}, "service_name": bson.M{"$ne": ""}, } + query["is_debug"] = bson.M{"$ne": true} switch productionType { case config.Production: @@ -561,6 +570,7 @@ func (c *JobInfoColl) GetJobInfos(startTime, endTime int64, projectName []string query := bson.M{ "start_time": bson.M{"$gte": startTime, "$lt": endTime}, } + query["is_debug"] = bson.M{"$ne": true} if projectName != nil && len(projectName) != 0 { query["product_name"] = bson.M{"$in": projectName} @@ -613,6 +623,7 @@ func (c *JobInfoColl) GetBuildTrend(startTime, endTime int64, projectName []stri "start_time": bson.M{"$gte": startTime, "$lt": endTime}, "type": config.JobZadigBuild, } + query["is_debug"] = bson.M{"$ne": true} if projectName != nil && len(projectName) != 0 { query["product_name"] = bson.M{"$in": projectName} } @@ -632,6 +643,7 @@ func (c *JobInfoColl) GetBuildTrend(startTime, endTime int64, projectName []stri func (c *JobInfoColl) GetAllProjectNameByTypeName(startTime, endTime int64, typeName string) ([]string, error) { query := bson.M{} + query["is_debug"] = bson.M{"$ne": true} if startTime != 0 && endTime != 0 { query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} } @@ -662,6 +674,7 @@ func (c *JobInfoColl) GetTestTrend(startTime, endTime int64, projectName []strin "product_name": bson.M{"$in": projectName}, "type": config.JobZadigTesting, } + query["is_debug"] = bson.M{"$ne": true} resp := make([]*models.JobInfo, 0) opts := options.Find().SetSort(bson.D{{"start_time", -1}}) @@ -682,6 +695,7 @@ func (c *JobInfoColl) GetDeployTrend(startTime, endTime int64, projectName []str "product_name": bson.M{"$in": projectName}, "type": config.JobZadigDeploy, } + query["is_debug"] = bson.M{"$ne": true} resp := make([]*models.JobInfo, 0) opts := options.Find().SetSort(bson.D{{"start_time", -1}}) diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go index 2ba498bcb1..1ab59ec9ab 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go @@ -114,5 +114,6 @@ func (c *ApolloJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go index 0ab954532e..c42e6de9eb 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go @@ -354,5 +354,6 @@ func (c *CustomDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go index 5d3210ba4f..a2d4d2a745 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go @@ -682,7 +682,7 @@ func workLoadDeployStat(kubeClient client.Client, namespace string, labelMaps [] case "ImagePullBackOff", "ErrImagePull", "CrashLoopBackOff", "ErrImageNeverPull": logContent := fmt.Sprintf("pod: %s, %s: %s", pod.Name, cs.State.Waiting.Reason, cs.State.Waiting.Message) jobLogManager.SaveJobLog(logContent) - return fmt.Errorf(logContent) + return fmt.Errorf("%s", logContent) } } } @@ -933,6 +933,7 @@ func (c *DeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, ServiceType: c.jobTaskSpec.ServiceType, ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go index 73c5526221..a3764da72d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go @@ -1455,6 +1455,7 @@ func (c *FreestyleJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, } if c.job.JobType == string(config.JobZadigVMDeploy) { diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go index b0ee554ff8..1db63e8b07 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go @@ -185,6 +185,7 @@ func (c *HelmChartDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, ServiceType: setting.HelmDeployType, TargetEnv: c.jobTaskSpec.Env, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go index b76a8afcdf..83ca901f08 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go @@ -470,6 +470,7 @@ func (c *HelmDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, ServiceType: c.jobTaskSpec.ServiceType, ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go index 27bc169d66..f1d0a470cb 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go @@ -25,11 +25,6 @@ import ( "time" "github.com/google/uuid" - "github.com/koderover/zadig/v2/pkg/tool/clientmanager" - "go.uber.org/zap" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/util/rand" config2 "github.com/koderover/zadig/v2/pkg/config" "github.com/koderover/zadig/v2/pkg/microservice/aslan/config" commonmodels "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/models" @@ -41,11 +36,16 @@ import ( "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/service/workflowstat" "github.com/koderover/zadig/v2/pkg/setting" "github.com/koderover/zadig/v2/pkg/tool/cache" + "github.com/koderover/zadig/v2/pkg/tool/clientmanager" e "github.com/koderover/zadig/v2/pkg/tool/errors" "github.com/koderover/zadig/v2/pkg/tool/kube/getter" "github.com/koderover/zadig/v2/pkg/tool/kube/podexec" "github.com/koderover/zadig/v2/pkg/tool/kube/updater" "github.com/koderover/zadig/v2/pkg/tool/log" + "go.uber.org/zap" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/rand" ) const ( @@ -231,6 +231,7 @@ func (c *workflowCtl) Run(ctx context.Context, concurrency int) { WorkflowDisplayName: c.workflowTask.WorkflowDisplayName, ProjectName: c.workflowTask.ProjectName, ProjectDisplayName: c.workflowTask.ProjectDisplayName, + IsDebug: c.workflowTask.IsDebug, Remark: c.workflowTask.Remark, TaskID: c.workflowTask.TaskID, RetryNum: c.workflowTask.RetryNum, diff --git a/pkg/microservice/aslan/core/stat/service/build_stat.go b/pkg/microservice/aslan/core/stat/service/build_stat.go index e7ef1a4066..5adb53081b 100644 --- a/pkg/microservice/aslan/core/stat/service/build_stat.go +++ b/pkg/microservice/aslan/core/stat/service/build_stat.go @@ -186,6 +186,9 @@ func getTaskDateMap(productName string, startTimestamp int64) (map[string][]inte if err := v4Cursor.Decode(&workflowTask); err != nil { return taskDateMap, fmt.Errorf("decode workflow v4 task err:%v", err) } + if workflowTask.IsDebug { + continue + } time := time.Unix(workflowTask.CreateTime, 0) date := time.Format(config.Date) if _, isExist := taskDateMap[date]; isExist { From 95641e8e6a75cb1a82f92cc5cfb34a071b388b79 Mon Sep 17 00:00:00 2001 From: YuTang Song <2313186065@qq.com> Date: Mon, 18 May 2026 10:11:53 +0800 Subject: [PATCH 2/5] feat(workflow,stat): Improve task handling and statistics logic in debug mode Signed-off-by: YuTang Song <2313186065@qq.com> --- .../jobcontroller/job_apisix.go | 1 + .../jobcontroller/job_approval.go | 1 + .../jobcontroller/job_blue_green_deploy.go | 1 + .../jobcontroller/job_blue_green_deploy_v2.go | 1 + .../jobcontroller/job_blue_green_release.go | 1 + .../job_blue_green_release_v2.go | 1 + .../jobcontroller/job_blueking.go | 1 + .../jobcontroller/job_canary_deploy.go | 1 + .../jobcontroller/job_canary_release.go | 1 + .../jobcontroller/job_dms.go | 1 + .../jobcontroller/job_grafana.go | 1 + .../jobcontroller/job_gray_release.go | 1 + .../jobcontroller/job_gray_rollback.go | 1 + .../jobcontroller/job_guanceyun.go | 1 + .../jobcontroller/job_istio_release.go | 41 ++++++++++--------- .../jobcontroller/job_istio_rollback.go | 1 + .../jobcontroller/job_jenkins.go | 1 + .../jobcontroller/job_jira.go | 1 + .../jobcontroller/job_k8s_patch.go | 1 + .../jobcontroller/job_meego_transition.go | 1 + .../jobcontroller/job_mse_gray_offline.go | 1 + .../jobcontroller/job_mse_gray_release.go | 1 + .../jobcontroller/job_nacos.go | 1 + .../jobcontroller/job_notification.go | 1 + .../jobcontroller/job_offline_service.go | 1 + .../jobcontroller/job_pingcode.go | 1 + .../jobcontroller/job_plugin.go | 1 + .../jobcontroller/job_restart.go | 1 + .../jobcontroller/job_sae_deploy.go | 1 + .../jobcontroller/job_sql.go | 1 + .../jobcontroller/job_tapd.go | 1 + .../job_update_env_istio_config.go | 1 + .../jobcontroller/job_workflow_trigger.go | 1 + .../stepcontroller/step_junit_report.go | 3 ++ .../aslan/core/stat/service/build_stat.go | 3 ++ .../aslan/core/stat/service/test_stat_v2.go | 3 ++ 36 files changed, 62 insertions(+), 20 deletions(-) diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go index 41a5f68132..1ae89ff9d8 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go @@ -397,5 +397,6 @@ func (c *ApisixJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go index fafb5d335d..a106504f7d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go @@ -752,5 +752,6 @@ func (c *ApprovalJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go index 2e7417bbb4..3882f3c3de 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go @@ -266,5 +266,6 @@ func (c *BlueGreenDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go index a412bef312..e7c10e4059 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go @@ -252,5 +252,6 @@ func (c *BlueGreenDeployV2JobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go index f8ff665fae..78d8be814c 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go @@ -170,5 +170,6 @@ func (c *BlueGreenReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go index 692f383084..eaf67aef06 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go @@ -315,5 +315,6 @@ func (c *BlueGreenReleaseV2JobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go index 9a3df907c2..c49dbbe9d3 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go @@ -150,5 +150,6 @@ func (c *BlueKingJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go index c9342d5162..257b829f1a 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go @@ -197,5 +197,6 @@ func (c *CanaryDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go index c300fff920..18dd3da1d1 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go @@ -166,5 +166,6 @@ func (c *CanaryReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go index 8a4aa7126d..32fd30d6ff 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go @@ -222,6 +222,7 @@ func (c *DMSJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go index 9eda9b4e69..e82f9764ee 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go @@ -182,5 +182,6 @@ func (c *GrafanaJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go index 7d0aaf436c..891230b435 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go @@ -257,5 +257,6 @@ func (c *GrayReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go index 774b6c7298..f25f5649b7 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go @@ -138,5 +138,6 @@ func (c *GrayRollbackJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go index 81f900bb2c..d6118107f7 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go @@ -193,5 +193,6 @@ func (c *GuanceyunCheckJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go index c1b7c8582e..e1e844dccc 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go @@ -492,29 +492,29 @@ func (c *IstioReleaseJobCtl) Run(ctx context.Context) { targetReplica := int32(c.jobTaskSpec.Replicas) deployment.Spec.Replicas = &targetReplica - c.Infof("updating the original workload %s with the new image: %s", deployment.Name, c.jobTaskSpec.Targets.Image) - c.ack() + c.Infof("updating the original workload %s with the new image: %s", deployment.Name, c.jobTaskSpec.Targets.Image) + c.ack() - if err := updater.UpdateDeploymentV2(ctx, c.jobTaskSpec.ClusterID, c.jobTaskSpec.Namespace, deployment.Name, func(d *appsv1.Deployment) error { - var oldImg string - for i, container := range d.Spec.Template.Spec.Containers { - if container.Name == c.jobTaskSpec.Targets.ContainerName { - oldImg = container.Image - d.Spec.Template.Spec.Containers[i].Image = c.jobTaskSpec.Targets.Image + if err := updater.UpdateDeploymentV2(ctx, c.jobTaskSpec.ClusterID, c.jobTaskSpec.Namespace, deployment.Name, func(d *appsv1.Deployment) error { + var oldImg string + for i, container := range d.Spec.Template.Spec.Containers { + if container.Name == c.jobTaskSpec.Targets.ContainerName { + oldImg = container.Image + d.Spec.Template.Spec.Containers[i].Image = c.jobTaskSpec.Targets.Image + } } + if d.Annotations == nil { + d.Annotations = make(map[string]string) + } + d.Annotations[config.ZadigLastAppliedReplicas] = strconv.Itoa(int(*d.Spec.Replicas)) + d.Annotations[config.ZadigLastAppliedImage] = oldImg + targetReplica := int32(c.jobTaskSpec.Replicas) + d.Spec.Replicas = &targetReplica + return nil + }); err != nil { + c.Errorf("update origin deployment: %s failed: %v", deployment.Name, err) + return } - if d.Annotations == nil { - d.Annotations = make(map[string]string) - } - d.Annotations[config.ZadigLastAppliedReplicas] = strconv.Itoa(int(*d.Spec.Replicas)) - d.Annotations[config.ZadigLastAppliedImage] = oldImg - targetReplica := int32(c.jobTaskSpec.Replicas) - d.Spec.Replicas = &targetReplica - return nil - }); err != nil { - c.Errorf("update origin deployment: %s failed: %v", deployment.Name, err) - return - } // waiting for original deployment to run c.Infof("Waiting for deployment: %s to start", c.jobTaskSpec.Targets.WorkloadName) @@ -624,5 +624,6 @@ func (c *IstioReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go index 9658867eb8..e62bf61ff7 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go @@ -213,5 +213,6 @@ func (c *IstioRollbackJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go index 3a5857fabe..6bcb226203 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go @@ -149,5 +149,6 @@ func (c *JenkinsJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go index 7f3944b807..c0bb394d36 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go @@ -117,5 +117,6 @@ func (c *JiraJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go index 1d51a5942e..5adb56c7a1 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go @@ -159,5 +159,6 @@ func (c *K8sPatchJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go index 38c5879f00..704b78ebb9 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go @@ -203,5 +203,6 @@ func (c *MeegoTransitionJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go index 3274aa5fb9..186cef450c 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go @@ -288,5 +288,6 @@ func (c *MseGrayOfflineJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go index 1a0596a650..93e8d3a686 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go @@ -269,5 +269,6 @@ func (c *MseGrayReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go index bab7ec950b..6f7a0dff98 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go @@ -82,5 +82,6 @@ func (c *NacosJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go index dd2053f0e7..58a053bf2c 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go @@ -497,5 +497,6 @@ func (c *NotificationJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go index f037788de4..6b9f4e88a6 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go @@ -229,5 +229,6 @@ func (c *OfflineServiceJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go index 569cf8d79d..794c821692 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go @@ -95,5 +95,6 @@ func (c *PingCodeJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go index 3e5bcf2ff1..7f7c615eb7 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go @@ -204,5 +204,6 @@ func (c *PluginJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go index 1d04f385fc..96a53b59ab 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go @@ -327,6 +327,7 @@ func (c *RestartJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, ServiceType: c.jobTaskSpec.DeployType, ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go index 23acc6b48e..59cbb5d02d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go @@ -230,6 +230,7 @@ func (c *SAEDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, ServiceType: "sae", ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go index ebb54a1f28..9c3b179875 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go @@ -138,5 +138,6 @@ func (c *SQLJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go index 4407fa75b3..95f10265b1 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go @@ -83,5 +83,6 @@ func (c *TapdJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go index 0e4bb74900..92d9777042 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go @@ -87,5 +87,6 @@ func (c *UpdateEnvIstioConfigJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go index 4f98497289..02285190cb 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go @@ -173,5 +173,6 @@ func (c *WorkflowTriggerJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), + IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go index 8e5604c067..a8467e3177 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go @@ -74,6 +74,9 @@ func (s *junitReportCtl) AfterRun(ctx context.Context) error { if s.junitReportSpec.TestName == "" { return nil } + if s.workflowCtx.IsDebug { + return nil + } var testTaskStat *commonmodels.TestTaskStat var isNew bool testTaskStat, _ = commonrepo.NewTestTaskStatColl().FindTestTaskStat(&commonrepo.TestTaskStatOption{Name: s.junitReportSpec.TestName}) diff --git a/pkg/microservice/aslan/core/stat/service/build_stat.go b/pkg/microservice/aslan/core/stat/service/build_stat.go index 5adb53081b..901e8cb4cb 100644 --- a/pkg/microservice/aslan/core/stat/service/build_stat.go +++ b/pkg/microservice/aslan/core/stat/service/build_stat.go @@ -352,6 +352,9 @@ func GetLatestTenBuildMeasure(productNames []string, log *zap.SugaredLogger) ([] if err := cursor.Decode(&workflowTask); err != nil { return nil, fmt.Errorf("decode workflow v4 task err:%v", err) } + if workflowTask.IsDebug { + continue + } containBuild := false for _, stage := range workflowTask.Stages { for _, job := range stage.Jobs { diff --git a/pkg/microservice/aslan/core/stat/service/test_stat_v2.go b/pkg/microservice/aslan/core/stat/service/test_stat_v2.go index 94cd4d0623..632d403615 100644 --- a/pkg/microservice/aslan/core/stat/service/test_stat_v2.go +++ b/pkg/microservice/aslan/core/stat/service/test_stat_v2.go @@ -144,6 +144,9 @@ func GetRecentTestTask(projects []string, number int, logger *zap.SugaredLogger) // Build response recentTasks := make([]*RecentTestTask, 0, len(workflowTasks)) for _, task := range workflowTasks { + if task.IsDebug { + continue + } // Extract test name from workflow display name testName := task.WorkflowDisplayName if testName == "" && task.WorkflowArgs != nil { From b72a5c83b1e03cbe2b2833cacbf1164271a4fbea Mon Sep 17 00:00:00 2001 From: YuTang Song <2313186065@qq.com> Date: Mon, 18 May 2026 15:01:59 +0800 Subject: [PATCH 3/5] feat: add comment Signed-off-by: YuTang Song <2313186065@qq.com> --- .../workflowcontroller/stepcontroller/step_junit_report.go | 1 + pkg/microservice/aslan/core/stat/service/build_stat.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go index a8467e3177..fd9530da56 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/stepcontroller/step_junit_report.go @@ -74,6 +74,7 @@ func (s *junitReportCtl) AfterRun(ctx context.Context) error { if s.junitReportSpec.TestName == "" { return nil } + // 过滤掉debug tag任务 if s.workflowCtx.IsDebug { return nil } diff --git a/pkg/microservice/aslan/core/stat/service/build_stat.go b/pkg/microservice/aslan/core/stat/service/build_stat.go index 901e8cb4cb..a2ae38dc3b 100644 --- a/pkg/microservice/aslan/core/stat/service/build_stat.go +++ b/pkg/microservice/aslan/core/stat/service/build_stat.go @@ -352,6 +352,7 @@ func GetLatestTenBuildMeasure(productNames []string, log *zap.SugaredLogger) ([] if err := cursor.Decode(&workflowTask); err != nil { return nil, fmt.Errorf("decode workflow v4 task err:%v", err) } + // 过滤掉debug tag任务 if workflowTask.IsDebug { continue } From abb3a4f83bdf012a78171058540561575fa7d8dc Mon Sep 17 00:00:00 2001 From: YuTang Song <2313186065@qq.com> Date: Mon, 18 May 2026 15:39:53 +0800 Subject: [PATCH 4/5] refactor(jobcontroller): remove redundant IsDebug fields when saving job info Signed-off-by: YuTang Song <2313186065@qq.com> --- .../service/workflowcontroller/jobcontroller/job_apisix.go | 1 - .../service/workflowcontroller/jobcontroller/job_apollo.go | 1 - .../service/workflowcontroller/jobcontroller/job_approval.go | 1 - .../workflowcontroller/jobcontroller/job_blue_green_deploy.go | 1 - .../workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go | 1 - .../workflowcontroller/jobcontroller/job_blue_green_release.go | 1 - .../jobcontroller/job_blue_green_release_v2.go | 1 - .../service/workflowcontroller/jobcontroller/job_blueking.go | 1 - .../workflowcontroller/jobcontroller/job_canary_deploy.go | 1 - .../workflowcontroller/jobcontroller/job_canary_release.go | 1 - .../common/service/workflowcontroller/jobcontroller/job_dms.go | 1 - .../service/workflowcontroller/jobcontroller/job_grafana.go | 1 - .../service/workflowcontroller/jobcontroller/job_gray_release.go | 1 - .../workflowcontroller/jobcontroller/job_gray_rollback.go | 1 - .../service/workflowcontroller/jobcontroller/job_guanceyun.go | 1 - .../workflowcontroller/jobcontroller/job_istio_release.go | 1 - .../workflowcontroller/jobcontroller/job_istio_rollback.go | 1 - .../service/workflowcontroller/jobcontroller/job_jenkins.go | 1 - .../common/service/workflowcontroller/jobcontroller/job_jira.go | 1 - .../service/workflowcontroller/jobcontroller/job_k8s_patch.go | 1 - .../workflowcontroller/jobcontroller/job_meego_transition.go | 1 - .../workflowcontroller/jobcontroller/job_mse_gray_offline.go | 1 - .../workflowcontroller/jobcontroller/job_mse_gray_release.go | 1 - .../common/service/workflowcontroller/jobcontroller/job_nacos.go | 1 - .../service/workflowcontroller/jobcontroller/job_notification.go | 1 - .../workflowcontroller/jobcontroller/job_offline_service.go | 1 - .../service/workflowcontroller/jobcontroller/job_pingcode.go | 1 - .../service/workflowcontroller/jobcontroller/job_plugin.go | 1 - .../service/workflowcontroller/jobcontroller/job_restart.go | 1 - .../service/workflowcontroller/jobcontroller/job_sae_deploy.go | 1 - .../common/service/workflowcontroller/jobcontroller/job_sql.go | 1 - .../common/service/workflowcontroller/jobcontroller/job_tapd.go | 1 - .../jobcontroller/job_update_env_istio_config.go | 1 - .../workflowcontroller/jobcontroller/job_workflow_trigger.go | 1 - 34 files changed, 34 deletions(-) diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go index 1ae89ff9d8..41a5f68132 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apisix.go @@ -397,6 +397,5 @@ func (c *ApisixJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go index 1ab59ec9ab..2ba498bcb1 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_apollo.go @@ -114,6 +114,5 @@ func (c *ApolloJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go index a106504f7d..fafb5d335d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_approval.go @@ -752,6 +752,5 @@ func (c *ApprovalJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go index 3882f3c3de..2e7417bbb4 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy.go @@ -266,6 +266,5 @@ func (c *BlueGreenDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go index e7c10e4059..a412bef312 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_deploy_v2.go @@ -252,6 +252,5 @@ func (c *BlueGreenDeployV2JobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go index 78d8be814c..f8ff665fae 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release.go @@ -170,6 +170,5 @@ func (c *BlueGreenReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go index eaf67aef06..692f383084 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blue_green_release_v2.go @@ -315,6 +315,5 @@ func (c *BlueGreenReleaseV2JobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go index c49dbbe9d3..9a3df907c2 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_blueking.go @@ -150,6 +150,5 @@ func (c *BlueKingJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go index 257b829f1a..c9342d5162 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_deploy.go @@ -197,6 +197,5 @@ func (c *CanaryDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go index 18dd3da1d1..c300fff920 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_canary_release.go @@ -166,6 +166,5 @@ func (c *CanaryReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go index 32fd30d6ff..8a4aa7126d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_dms.go @@ -222,7 +222,6 @@ func (c *DMSJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go index e82f9764ee..9eda9b4e69 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_grafana.go @@ -182,6 +182,5 @@ func (c *GrafanaJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go index 891230b435..7d0aaf436c 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_release.go @@ -257,6 +257,5 @@ func (c *GrayReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go index f25f5649b7..774b6c7298 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_gray_rollback.go @@ -138,6 +138,5 @@ func (c *GrayRollbackJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go index d6118107f7..81f900bb2c 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_guanceyun.go @@ -193,6 +193,5 @@ func (c *GuanceyunCheckJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go index e1e844dccc..e451bbb38d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_release.go @@ -624,6 +624,5 @@ func (c *IstioReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go index e62bf61ff7..9658867eb8 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_istio_rollback.go @@ -213,6 +213,5 @@ func (c *IstioRollbackJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go index 6bcb226203..3a5857fabe 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jenkins.go @@ -149,6 +149,5 @@ func (c *JenkinsJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go index c0bb394d36..7f3944b807 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_jira.go @@ -117,6 +117,5 @@ func (c *JiraJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go index 5adb56c7a1..1d51a5942e 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_k8s_patch.go @@ -159,6 +159,5 @@ func (c *K8sPatchJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go index 704b78ebb9..38c5879f00 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_meego_transition.go @@ -203,6 +203,5 @@ func (c *MeegoTransitionJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go index 186cef450c..3274aa5fb9 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_offline.go @@ -288,6 +288,5 @@ func (c *MseGrayOfflineJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go index 93e8d3a686..1a0596a650 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_mse_gray_release.go @@ -269,6 +269,5 @@ func (c *MseGrayReleaseJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go index 6f7a0dff98..bab7ec950b 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_nacos.go @@ -82,6 +82,5 @@ func (c *NacosJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go index 58a053bf2c..dd2053f0e7 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_notification.go @@ -497,6 +497,5 @@ func (c *NotificationJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go index 6b9f4e88a6..f037788de4 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_offline_service.go @@ -229,6 +229,5 @@ func (c *OfflineServiceJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go index 794c821692..569cf8d79d 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_pingcode.go @@ -95,6 +95,5 @@ func (c *PingCodeJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go index 7f7c615eb7..3e5bcf2ff1 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_plugin.go @@ -204,6 +204,5 @@ func (c *PluginJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go index 96a53b59ab..1d04f385fc 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_restart.go @@ -327,7 +327,6 @@ func (c *RestartJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, ServiceType: c.jobTaskSpec.DeployType, ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go index 59cbb5d02d..23acc6b48e 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sae_deploy.go @@ -230,7 +230,6 @@ func (c *SAEDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, ServiceType: "sae", ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go index 9c3b179875..ebb54a1f28 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_sql.go @@ -138,6 +138,5 @@ func (c *SQLJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go index 95f10265b1..4407fa75b3 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_tapd.go @@ -83,6 +83,5 @@ func (c *TapdJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go index 92d9777042..0e4bb74900 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_update_env_istio_config.go @@ -87,6 +87,5 @@ func (c *UpdateEnvIstioConfigJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go index 02285190cb..4f98497289 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_workflow_trigger.go @@ -173,6 +173,5 @@ func (c *WorkflowTriggerJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } From 4c3eee4c136a48f705ae1b308039b212e994379a Mon Sep 17 00:00:00 2001 From: YuTang Song <2313186065@qq.com> Date: Tue, 19 May 2026 11:33:41 +0800 Subject: [PATCH 5/5] perf(workflowcontroller): skip database persistence for debug tasks Signed-off-by: YuTang Song <2313186065@qq.com> --- .../core/common/repository/mongodb/job_info.go | 14 -------------- .../workflowcontroller/jobcontroller/job.go | 4 ++++ .../jobcontroller/job_custom_deploy.go | 1 - .../workflowcontroller/jobcontroller/job_deploy.go | 1 - .../jobcontroller/job_freestyle.go | 1 - .../jobcontroller/job_helm_chart_deploy.go | 1 - .../jobcontroller/job_helm_deploy.go | 1 - .../common/service/workflowcontroller/workflow.go | 9 +++++---- 8 files changed, 9 insertions(+), 23 deletions(-) diff --git a/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go b/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go index 4d61fd70cd..b80fcc9f66 100644 --- a/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go +++ b/pkg/microservice/aslan/core/common/repository/mongodb/job_info.go @@ -69,7 +69,6 @@ func (c *JobInfoColl) Create(ctx context.Context, args *models.JobInfo) error { func (c *JobInfoColl) GetProductionDeployJobs(startTime, endTime int64, projectName string) ([]*models.JobInfo, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["production"] = true query["type"] = bson.M{"$in": []string{ @@ -95,7 +94,6 @@ func (c *JobInfoColl) GetProductionDeployJobs(startTime, endTime int64, projectN func (c *JobInfoColl) GetTestJobs(startTime, endTime int64, projectName string) ([]*models.JobInfo, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["type"] = config.JobZadigTesting @@ -116,7 +114,6 @@ func (c *JobInfoColl) GetTestJobs(startTime, endTime int64, projectName string) func (c *JobInfoColl) GetTestJobsByWorkflow(workflowName string) ([]*models.JobInfo, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} query["workflow_name"] = workflowName query["type"] = config.JobZadigTesting @@ -133,7 +130,6 @@ func (c *JobInfoColl) GetTestJobsByWorkflow(workflowName string) ([]*models.JobI func (c *JobInfoColl) GetBuildJobs(startTime, endTime int64, projectName string) ([]*models.JobInfo, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["type"] = config.JobZadigBuild @@ -154,7 +150,6 @@ func (c *JobInfoColl) GetBuildJobs(startTime, endTime int64, projectName string) func (c *JobInfoColl) GetBuildJobsStats(startTime, endTime int64, projectNames []string) (*models.ServiceDeployCountWithStatus, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} if startTime > 0 && endTime > 0 { query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} } @@ -221,7 +216,6 @@ func (c *JobInfoColl) GetBuildJobsStats(startTime, endTime int64, projectNames [ func (c *JobInfoColl) GetDeployJobs(startTime, endTime int64, projectNames []string, productionType config.ProductionType) ([]*models.JobInfo, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} query["type"] = bson.M{"$in": []string{ string(config.JobZadigDeploy), @@ -260,7 +254,6 @@ func (c *JobInfoColl) GetDeployJobs(startTime, endTime int64, projectNames []str func (c *JobInfoColl) GetDeployJobsStats(startTime, endTime int64, projectNames []string, productionType config.ProductionType) ([]*models.ServiceDeployCountWithStatus, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} if startTime > 0 && endTime > 0 { query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} } @@ -353,7 +346,6 @@ func (c *JobInfoColl) GetTopDeployedService(startTime, endTime int64, projectNam }}, "service_name": bson.M{"$ne": ""}, } - query["is_debug"] = bson.M{"$ne": true} switch productionType { case config.Production: @@ -466,7 +458,6 @@ func (c *JobInfoColl) GetTopDeployFailedService(startTime, endTime int64, projec }}, "service_name": bson.M{"$ne": ""}, } - query["is_debug"] = bson.M{"$ne": true} switch productionType { case config.Production: @@ -570,7 +561,6 @@ func (c *JobInfoColl) GetJobInfos(startTime, endTime int64, projectName []string query := bson.M{ "start_time": bson.M{"$gte": startTime, "$lt": endTime}, } - query["is_debug"] = bson.M{"$ne": true} if projectName != nil && len(projectName) != 0 { query["product_name"] = bson.M{"$in": projectName} @@ -623,7 +613,6 @@ func (c *JobInfoColl) GetBuildTrend(startTime, endTime int64, projectName []stri "start_time": bson.M{"$gte": startTime, "$lt": endTime}, "type": config.JobZadigBuild, } - query["is_debug"] = bson.M{"$ne": true} if projectName != nil && len(projectName) != 0 { query["product_name"] = bson.M{"$in": projectName} } @@ -643,7 +632,6 @@ func (c *JobInfoColl) GetBuildTrend(startTime, endTime int64, projectName []stri func (c *JobInfoColl) GetAllProjectNameByTypeName(startTime, endTime int64, typeName string) ([]string, error) { query := bson.M{} - query["is_debug"] = bson.M{"$ne": true} if startTime != 0 && endTime != 0 { query["start_time"] = bson.M{"$gte": startTime, "$lt": endTime} } @@ -674,7 +662,6 @@ func (c *JobInfoColl) GetTestTrend(startTime, endTime int64, projectName []strin "product_name": bson.M{"$in": projectName}, "type": config.JobZadigTesting, } - query["is_debug"] = bson.M{"$ne": true} resp := make([]*models.JobInfo, 0) opts := options.Find().SetSort(bson.D{{"start_time", -1}}) @@ -695,7 +682,6 @@ func (c *JobInfoColl) GetDeployTrend(startTime, endTime int64, projectName []str "product_name": bson.M{"$in": projectName}, "type": config.JobZadigDeploy, } - query["is_debug"] = bson.M{"$ne": true} resp := make([]*models.JobInfo, 0) opts := options.Find().SetSort(bson.D{{"start_time", -1}}) diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job.go index ce6c3199cb..50acd3e5a9 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job.go @@ -142,6 +142,10 @@ func runJob(ctx context.Context, job *commonmodels.JobTask, workflowCtx *commonm logger.Infof("finish job: %s,status: %s", job.Name, job.Status) setJobFinalStatusContext(job, workflowCtx) ack() + if workflowCtx.IsDebug { + logger.Infof("skip updating debug job info into db") + return + } logger.Infof("updating job info into db...") err := jobCtl.SaveInfo(ctx) if err != nil { diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go index c42e6de9eb..0ab954532e 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_custom_deploy.go @@ -354,6 +354,5 @@ func (c *CustomDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, }) } diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go index a2d4d2a745..44bc809dbf 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_deploy.go @@ -933,7 +933,6 @@ func (c *DeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, ServiceType: c.jobTaskSpec.ServiceType, ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go index a3764da72d..73c5526221 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_freestyle.go @@ -1455,7 +1455,6 @@ func (c *FreestyleJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, } if c.job.JobType == string(config.JobZadigVMDeploy) { diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go index 1db63e8b07..b0ee554ff8 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_chart_deploy.go @@ -185,7 +185,6 @@ func (c *HelmChartDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, ServiceType: setting.HelmDeployType, TargetEnv: c.jobTaskSpec.Env, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go index 83ca901f08..b76a8afcdf 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job_helm_deploy.go @@ -470,7 +470,6 @@ func (c *HelmDeployJobCtl) SaveInfo(ctx context.Context) error { EndTime: c.job.EndTime, Duration: c.job.EndTime - c.job.StartTime, Status: string(c.job.Status), - IsDebug: c.workflowCtx.IsDebug, ServiceType: c.jobTaskSpec.ServiceType, ServiceName: c.jobTaskSpec.ServiceName, diff --git a/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go b/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go index f1d0a470cb..3256d845a7 100644 --- a/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go +++ b/pkg/microservice/aslan/core/common/service/workflowcontroller/workflow.go @@ -25,6 +25,11 @@ import ( "time" "github.com/google/uuid" + "go.uber.org/zap" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/util/rand" + config2 "github.com/koderover/zadig/v2/pkg/config" "github.com/koderover/zadig/v2/pkg/microservice/aslan/config" commonmodels "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/models" @@ -42,10 +47,6 @@ import ( "github.com/koderover/zadig/v2/pkg/tool/kube/podexec" "github.com/koderover/zadig/v2/pkg/tool/kube/updater" "github.com/koderover/zadig/v2/pkg/tool/log" - "go.uber.org/zap" - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/util/rand" ) const (