sstojak1 opened a new issue, #7600:
URL: https://github.com/apache/incubator-devlake/issues/7600

   ### 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
   
   If jenkins job is not part of a folder import for that job will fail.
    
   
   ### What do you expect to happen
   
   Job import to pass.
   
   ### How to reproduce
   
   Create a job that is not part of a folder and run the import. It should fail 
with an error like this:
   `error preparing task data for jenkins (404) Wraps: (2) error decoding 
response from 
https://jenkins.com/view/all/api/json?tree=jobs%5BfullName%2Cname%2Cclass%2Curl%2Ccolor%2Cbase%2Cjobs%2CupstreamProjects%5Bname%5D%5D%7B0%2C100%7D:
 raw response: <html> | <head> | <meta http-equiv="Content-Type" 
content="text/html;charset=ISO-8859-1"/> | <title>Error 404 Not Found</title> | 
</head> | <body><h2>HTTP ERROR 404 Not Found</h2> | <table> | 
<tr><th>URI:</th><td>/view/all/api/json</td></tr> | 
<tr><th>STATUS:</th><td>404</td></tr> | <tr><th>MESSAGE:</th><td>Not 
Found</td></tr> | <tr><th>SERVLET:</th><td>Stapler</td></tr> | </table> | 
<hr/><a href="https://eclipse.org/jetty";>Powered by Jetty:// 10.0.13</a><hr/> | 
| </body> | </html> | (404) Wraps: (3) invalid character '<' looking for 
beginning of value Wraps: (4) invalid character '<' looking for beginning of 
value Error types: (1) *hintdetail.withDetail (2) *hintdetail.withDetail (3) 
*hintdetail.withDetail (4) *json.SyntaxError`
   
   Why is it failing like this?
   Because Devlake's 
[ValidateTaskOptions](https://github.com/apache/incubator-devlake/blob/13b20bd127a7877f5682092ee2d48f332e5cd445/backend/plugins/jenkins/tasks/task_data.go#L66)
 didn't find a "/" in the job's `fullName` attribute, it sets the `JobPath` to 
"view/all/". This causes the import to fail with the stated error because that 
path cannot be found 
   
   Why is the logic set up like that - set to `view/all/`? I didn't find docs 
for that path?
   If job is set like this in case a job is part of a folder import will pass:
   `op.JobPath = `job/` + strings.Join(strings.Split(op.JobFullName[:i], `/`), 
`/job/`)`
   Why not do the same for folderless jobs?
   
   
   ### Anything else
   
   _No response_
   
   ### Version
   
   v1.0.0-beta11
   
   ### 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-unsubscr...@devlake.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to