You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by "matrixji (via GitHub)" <gi...@apache.org> on 2024/03/31 15:24:07 UTC
[I] [Bug][Jenkins] Incorrect logic for handling actions fields in raw json [incubator-devlake]
matrixji opened a new issue, #7261:
URL: https://github.com/apache/incubator-devlake/issues/7261
### 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
`_tool_jenkins_builds.triggered_by` field is not collected, but in my test Jenkins job, I do use `job00` -> `job01`is

### What do you expect to happen
`_tool_jenkins_builds.triggered_by` to be collected.
This is my local patched version:

### How to reproduce
N/A
### Anything else
It seems there is some Incorrect logic for handling `actions` in Jenkins's API JSON raw data.
The `actions` in raw JSON from Jenkins's API are like below:
```json
"actions": [
{
"_class": "hudson.model.CauseAction",
"causes": [
{
"_class": "org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause",
"shortDescription": "Started by upstream project \"job00\" build number 3",
"upstreamBuild": 3,
"upstreamProject": "job00",
"upstreamUrl": "job/job00/"
}
]
},
{},
{
"_class": "hudson.model.ParametersAction"
},
{
"_class": "jenkins.metrics.impl.TimeInQueueAction"
},
{
"_class": "org.jenkinsci.plugins.workflow.libs.LibrariesAction"
},
{},
{
"_class": "hudson.plugins.git.util.BuildData",
"lastBuiltRevision": {
"SHA1": "45804691223635953f311cf31a10c632553bbfc3",
"branch": [
{
"name": "refs/remotes/origin/main"
}
]
},
"remoteUrls": [
"https://gitee.com/jb/googletest.git"
]
},
{},
{},
{
"_class": "org.jenkinsci.plugins.displayurlapi.actions.RunDisplayAction"
},
{
"_class": "org.jenkinsci.plugins.pipeline.modeldefinition.actions.RestartDeclarativePipelineAction"
},
{},
{
"_class": "org.jenkinsci.plugins.workflow.job.views.FlowGraphAction"
},
{},
{},
{}
]
```
Each action in actions will only have one key/value pair.
https://github.com/matrixji/incubator-devlake/blob/ef714f90c60343c5fdd45a5e6d1dbcfcc53e5c5d/backend/plugins/jenkins/tasks/build_extractor.go#L78
```
for _, a := range body.Actions {
if a.LastBuiltRevision == nil {
continue
}
```
It seems we will skip all actions without the `lastBuiltRevision` key. That is to say except for the `lastBuiltRevision` field, all other fields will not proceed.
### Version
v0.21.0-beta9@71f3e1f
### Are you willing to submit PR?
- [X] 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] Incorrect logic for handling actions fields in raw json [incubator-devlake]
Posted by "klesh (via GitHub)" <gi...@apache.org>.
klesh closed issue #7261: [Bug][Jenkins] Incorrect logic for handling actions fields in raw json
URL: https://github.com/apache/incubator-devlake/issues/7261
--
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] Incorrect logic for handling actions fields in raw json [incubator-devlake]
Posted by "Startrekzky (via GitHub)" <gi...@apache.org>.
Startrekzky commented on issue #7261:
URL: https://github.com/apache/incubator-devlake/issues/7261#issuecomment-2054264854
Awesome. Can you review the PR? @klesh
--
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