diff --git a/backend/plugins/jenkins/e2e/stages_test.go b/backend/plugins/jenkins/e2e/stages_test.go index 60725c63ebc..1a241809268 100644 --- a/backend/plugins/jenkins/e2e/stages_test.go +++ b/backend/plugins/jenkins/e2e/stages_test.go @@ -50,10 +50,6 @@ func TestJenkinsStagesDataFlow(t *testing.T) { dataflowTester.FlushTabler(&models.JenkinsBuild{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/_tool_jenkins_builds_for_stages.csv", models.JenkinsBuild{}) - // import tool table - dataflowTester.ImportCsvIntoTabler("./snapshot_tables/_tool_jenkins_build_commits.csv", models.JenkinsBuildCommit{}) - dataflowTester.ImportCsvIntoTabler("./snapshot_tables/cicd_tasks.csv", devops.CICDTask{}) - // verify extraction dataflowTester.FlushTabler(&models.JenkinsStage{}) dataflowTester.Subtask(tasks.ExtractApiStagesMeta, taskData) diff --git a/backend/plugins/jenkins/tasks/stage_convertor.go b/backend/plugins/jenkins/tasks/stage_convertor.go index 774427476b6..76d7a033287 100644 --- a/backend/plugins/jenkins/tasks/stage_convertor.go +++ b/backend/plugins/jenkins/tasks/stage_convertor.go @@ -99,7 +99,14 @@ func ConvertStages(taskCtx plugin.SubTaskContext) (err errors.Error) { if body.Name == "" { return nil, err } - durationSec := int64(body.DurationMillis / 1000) + var durationMillis int + if body.DurationMillis > 0 { + durationMillis = body.DurationMillis + } else { + durationMillis = 0 + } + + durationSec := int64(durationMillis / 1000) jenkinsTaskResult := devops.GetResult(&devops.ResultRule{ Success: []string{SUCCESS}, Failure: []string{FAILED, FAILURE, ABORTED}, @@ -125,7 +132,7 @@ func ConvertStages(taskCtx plugin.SubTaskContext) (err errors.Error) { PipelineId: buildIdGen.Generate(body.ConnectionId, body.BuildName), Result: jenkinsTaskResult, Status: jenkinsTaskStatus, - DurationSec: uint64(body.DurationMillis / 1000), + DurationSec: uint64(durationMillis / 1000), StartedDate: startedDate, FinishedDate: jenkinsTaskFinishedDate, CicdScopeId: jobIdGen.Generate(body.ConnectionId, data.Options.JobFullName),