You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by "retryduck (via GitHub)" <gi...@apache.org> on 2025/03/06 15:20:02 UTC
[I] [Bug][Jenkins] Pipeline fails to Collect Job Data [incubator-devlake]
retryduck opened a new issue, #8326:
URL: https://github.com/apache/incubator-devlake/issues/8326
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar issues.
### What happened
Loading Jenkins Jobs fails when a Jenkins job does not contain any slash '/' in its name. Seems the backend calls an invalid Jenkins path.
### What do you expect to happen
- Configure a Jenkins Connection (Jenkins Version 2.492.1) (Connection Test Successful)
- Add a Data Scope - select a Job name that does not contain any '/' in it. We do not have folder structures in our Jenkins. I selected our `example-app.` (Jenkins Job URL: `https://some-host/jenkins/job/example-app/)` - Multibranch Pipeline
- Add this Data Scope to a Project
- Click Connect Data
- The Current Pipeline succeeds and loads the data for the selected job.
### How to reproduce
- Configure a Jenkins Connection (Jenkins Version 2.492.1) (Connection Test Successful)
- Add a Data Scope - select a Job name that does not contain any '/' in it. We do not have folder structures in our Jenkins. I selected our `example-app.` (Jenkins Job URL: `https://some-host/jenkins/job/example-app/)` - Multibranch Pipeline
- Add this Data Scope to a Project
- Click Connect Data
- The Current Pipeline panel shows status: failed and exception details containing the follwing text:
> Error running pipeline 5. Wraps: (2) Error running task 31. (404) | Wraps: (2) error preparing task data for jenkins (404) | Wraps: (3) error decoding response from https://some-host/jenkins/view/all/api/json?tree=jobs%5BfullName%2Cname%2Cclass%2Curl%2Ccolor%2Cbase%2Cjobs%2CupstreamProjects%5Bname%5D%5D%7B0%2C100%7D: raw response: | | | | | | | | <!DOCTYPE html><html><head resURL="/jenkins/static/d7ed18f1" data-rooturl="/jenkins" data-resurl="/jenkins/static/d7ed18f1" data-extensions-available="true" data-unit-test="false" data-imagesurl="/jenkins/static/d7ed18f1/images" data-crumb-header="Jenkins-Crumb" data-crumb-value="d209b965fdbb4b272b2258b759cd58c0b801d66b26314a9f36094fb773567f83"> | | | | | | | | <title>Not Found [Jenkins]</title> ... and the entire page ...
Seems ther URL, which is called returns the Jenkins HTML 404 (not found) page instead of a JSON response.
When I put the url ` https://some-host/jenkins/view/all/api/json` in my browser, I also recieve a HTML-404 page. When I remove the `view/all` in the path of the URL like `https://some-host/jenkins/api/json` then, I receive a successful JSON response.
### Anything else
Locally, I was able to fix the problem when I commented out line 76 in the follwing file: https://github.com/apache/incubator-devlake/blob/v1.0.1/backend/plugins/jenkins/tasks/task_data.go
line 76: `// op.JobPath = "view/all"`
### Version
v.1.0.1
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
--
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-unsubscribe@devlake.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jenkins] Pipeline fails to Collect Job Data [incubator-devlake]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8326:
URL: https://github.com/apache/incubator-devlake/issues/8326#issuecomment-2856655287
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
--
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-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jenkins] Pipeline fails to Collect Job Data [incubator-devlake]
Posted by "retryduck (via GitHub)" <gi...@apache.org>.
retryduck commented on issue #8326:
URL: https://github.com/apache/incubator-devlake/issues/8326#issuecomment-2704188550
Yeah, that is actually what I proposed. However, I'm unable to run and debug the tests locally in order to verify that this change would not have any unexpected side-effects.
--
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-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jenkins] Pipeline fails to Collect Job Data [incubator-devlake]
Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh commented on issue #8326:
URL: https://github.com/apache/incubator-devlake/issues/8326#issuecomment-2705739806
Seems like the path is changed in the newer jenkins version.
--
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-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Jenkins] Pipeline fails to Collect Job Data [incubator-devlake]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
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: dev-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org