fix(jenkins): collect builds and stages that finish after the next sync - #9178
Open
pballester wants to merge 2 commits into
Open
pballester wants to merge 2 commits into
pballester wants to merge 2 commits into
Conversation
… sync Builds are stored only once they have a result, so a build that started before the previous collection and finished after it reaches _tool_jenkins_builds in a later run. The incremental stage collector filtered on start_time >= since and skipped it forever. Select builds that finished since the previous collection instead: timestamp + duration (both milliseconds) >= since, which works the same on MySQL and PostgreSQL and includes every build the old condition did. Closes apache#9177
…ast sync The single-job build collector lists builds newest first and stops at the first one that started before the previous collection, and it dropped builds that were still running. A build running during one sync and finished before the next was therefore never collected: neither the build nor its stages. Keep running builds (stored with building=true) and use the finalizable collector's CollectUnfinishedDetails to re-collect them from job/<name>/<number>/api/json until they finish. A build deleted while running is skipped (404) instead of failing the task. Multi-branch jobs are not affected: they re-list every build on each run. Refs apache#9177
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the incremental Jenkins collection described in #9177: builds that are still running during one sync and finish before the next are lost, entirely for single jobs and their stages for multi-branch jobs. Full diagnosis and evidence are in the issue. Two commits, kept separate for review:
1.
fix(jenkins): collect stages of builds that finish after the previous sync_tool_jenkins_buildsin a later run.collectApiStagesselected builds withtjb.start_time >= since, so it skipped those builds in that run and every run after, and their deployment stages never reachedcicd_tasks/ DORA.FinishedSinceclause:tjb.timestamp + tjb.duration >= since.timestamp(start) anddurationare both milliseconds, so this is plain arithmetic, the same on MySQL and PostgreSQL. No dialect branching, and the filter stays in SQL.2.
fix(jenkins): re-collect single-job builds that were running at the last syncbuilding = true), and the finalizable collector'sCollectUnfinishedDetailsre-collects them fromjob/<name>/<number>/api/jsonuntil they finish. This is the helper's intended pattern, as in pagerduty and circleci. A build deleted while running is skipped (404) instead of failing the task.cicd_pipelines(statusIN_PROGRESS, result empty) while they run. The convertor already supports that, and DORA ignores them.Upgrade note: incremental runs don't backfill what was already missed, because those builds finished before the new
since. A full sync of the Jenkins scopes recovers them.Tests
TestJenkinsStagesFinishedSince: builds finished before the last collection / started before and finished after / started after. It expects the last two; the old condition returns only the build that started after.TestJenkinsUnfinishedBuilds(only this job's running builds are re-collected) andTestJenkinsUnfinishedBuildExtraction(a build listed while running, then re-collected finished, ends with its final state).inputduring the first collection, finished before the second (incremental) one.main: the build is missing from_tool_jenkins_builds, with no stages and nocicd_tasks.…/<number>/api/json, and it lands withbuilding=0 result=SUCCESS, its stages and itscicd_tasks.gofmt/go vetclean;golangci-lintreports no new findings in the plugin.Does this close any open issues?
Closes #9177
Screenshots
N/A