dosubot[bot] commented on issue #7694:
URL: 
https://github.com/apache/incubator-devlake/issues/7694#issuecomment-2207378846

   <!-- Answer -->
   To ensure that DevLake populates the `created_date` column in the `refs` 
table when using the Azure DevOps Go Connection/Plugin, you need to verify that 
the relevant functions handle this field correctly.
   
   In the Azure DevOps Go Connection/Plugin, the `ConvertApiTimelineRecords` 
function is responsible for inserting records into the `refs` table and 
includes logic for setting the `created_date` field. Here is the relevant code 
snippet:
   
   ```go
   createdAt := time.Now()
   if tlRecord.StartTime != nil {
       createdAt = *tlRecord.StartTime
   }
   
   domainTask := &devops.CICDTask{
       DomainEntity: domainlayer.DomainEntity{
           Id: tlRecordIdGen.Generate(data.Options.ConnectionId, 
tlRecord.RecordId, tlRecord.BuildId),
       },
       Name:           tlRecord.Name,
       PipelineId:     buildIdGen.Generate(data.Options.ConnectionId, 
tlRecord.BuildId),
       Result:         devops.GetResult(cicdTaskResultRule, tlRecord.Result),
       Status:         devops.GetStatus(cicdTaskStatusRule, tlRecord.State),
       OriginalStatus: tlRecord.State,
       OriginalResult: tlRecord.Result,
       DurationSec:    duration,
       Environment:    
data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, tlRecord.Name),
       Type:           
data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, tlRecord.Name),
       TaskDatesInfo: devops.TaskDatesInfo{
           CreatedDate:  createdAt,
           StartedDate:  tlRecord.StartTime,
           FinishedDate: tlRecord.FinishTime,
       },
       CicdScopeId: repoIdGen.Generate(data.Options.ConnectionId, 
data.Options.RepositoryId),
   }
   ```
   
   This function sets the `created_date` field to the current time or the 
`StartTime` of the timeline record if it is available 
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/azuredevops_go/tasks/ci_cd_timeline_records_converter.go)</sup>.
   
   Ensure that this function is correctly invoked during the data extraction 
process. If the `created_date` field is still not being populated, you may need 
to review the data flow and ensure that the `ConvertApiTimelineRecords` 
function is properly integrated into your pipeline.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to