dosubot[bot] commented on issue #8326:
URL:
https://github.com/apache/incubator-devlake/issues/8326#issuecomment-2704163258
<!-- Greeting -->
Hey there, @retryduck! I'm here to assist you with bug fixes, questions, and
even becoming a contributor. Let's squash those bugs together! 🤖
<!-- Answer -->
To address the issue where Jenkins pipeline fails to collect job data for
job names without slashes, resulting in a 404 error, you can modify the code in
the `task_data.go` file. The problem arises because the code sets the
`op.JobPath` to `view/all` for job names without slashes, which leads to an
invalid API endpoint.
Here's a suggested update to handle job names without slashes more flexibly:
1. Locate the section in `task_data.go` where `op.JobPath` is set.
2. Modify the logic to avoid setting `op.JobPath` to `view/all` when the job
name does not contain slashes.
Here's an example of how you might adjust the code:
```go
if i := strings.LastIndex(op.JobFullName, `/`); i >= 0 {
op.JobName = op.JobFullName[i+1:]
op.JobPath = `job/` + strings.Join(strings.Split(op.JobFullName[:i],
`/`), `/job/`)
if op.Class == WORKFLOW_MULTI_BRANCH_PROJECT {
op.JobPath = `view/all/` + op.JobPath
}
} else {
op.JobName = op.JobFullName
// Remove or modify the line setting op.JobPath to "view/all"
op.JobPath = "" // or another appropriate default
}
```
By ensuring that `op.JobPath` is not set to `view/all` for job names without
slashes, you can prevent the 404 error and allow successful API calls for these
jobs
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/jenkins/tasks/task_data.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/ed7072bf-9497-492d-b398-a6bd7c62813f?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/ed7072bf-9497-492d-b398-a6bd7c62813f?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/ed7072bf-9497-492d-b398-a6bd7c62813f?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/ed7072bf-9497-492d-b398-a6bd7c62813f?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/ed7072bf-9497-492d-b398-a6bd7c62813f?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/ed7072bf-9497-492d-b398-a6bd7c62813f?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/ed7072bf-9497-492d-b398-a6bd7c62813f?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]