pballester opened a new pull request, #9178:
URL: https://github.com/apache/devlake/pull/9178

   ### Summary
   
   Fixes the incremental Jenkins stage collection described in #9177 (full 
diagnosis and evidence there).
   
   The build collectors store a build only once it has a result, so a build 
that started before the previous collection and finished after it reaches 
`_tool_jenkins_builds` in a later run. `collectApiStages` selected builds with 
`tjb.start_time >= since`, so it skipped those builds in that run and in every 
run after it, and their deployment stages never reached `cicd_tasks` / DORA.
   
   - Both stage collectors (single job and multi-branch) now select the builds 
that **finished** since the previous collection, through a small 
`FinishedSince` clause: `tjb.timestamp + tjb.duration >= since`.
   - `timestamp` (start) and `duration` are both milliseconds, so the condition 
is plain arithmetic, the same on MySQL and PostgreSQL. No dialect branching, 
and the filter stays in SQL.
   - It includes every build the old condition did (duration ≥ 0), plus the 
long-running ones. The builds query is still scoped to the job 
(`job_path`/`job_name` or `full_name`), so the extra cost is the DB scan, not 
API calls: stages are only requested for the builds selected.
   
   **Upgrade note:** stages already missed are not backfilled by incremental 
runs, because those builds finished before the new `since`. A full sync of the 
Jenkins scopes recovers them.
   
   **Tests**
   - New e2e `TestJenkinsStagesFinishedSince`: three builds (finished before 
the last collection; started before and finished after; started after). It 
expects the last two, and fails with the old condition (it returns only the 
build that started after).
   - Jenkins e2e suite passes on MySQL 8.0 and PostgreSQL 14.
   - `gofmt` / `go vet` clean; `golangci-lint` reports no new findings in the 
plugin.
   
   ### Does this close any open issues?
   
   Closes #9177
   
   ### Screenshots
   
   N/A
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to