dosubot[bot] commented on issue #8430:
URL:
https://github.com/apache/incubator-devlake/issues/8430#issuecomment-2858144391
<!-- Answer -->
To address the issue of the `_raw_jenkins_api_builds` table becoming bloated
with faulty records, you can ensure that the job name and path are correctly
extracted from the input when dealing with multi-branch workflows. The existing
code snippet already includes a mechanism to handle this:
```go
input := &SimpleJob{}
err1 := json.Unmarshal(row.Input, input)
if err1 == nil && input.Class == WORKFLOW_JOB {
// For jobs from multi-branch workflow, the job name and path must come
from the input,
// otherwise it will be set to the multi-branch workflow name and path
jobName = input.Name
jobPath = input.Path
fullName = fmt.Sprintf(`%s#%d`, input.FullName, body.Number)
}
```
This code checks if the input can be unmarshaled into a `SimpleJob` and if
the class is `WORKFLOW_JOB`. If so, it uses the job name and path from the
input, ensuring they are in sync with the URL of the jobs in Jenkins. This
approach helps maintain consistency and prevents the table from being populated
with incorrect records
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jenkins/tasks/build_extractor.go)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/660c1253-cc68-4e82-a516-5fa57334af7f?feedback_type=other)</sup>
--
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]