-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matrices with varying number of elements are breaking the build output #2045
Comments
I'm still unable to repeat. Below is the yaml I am testing with:
The build passes. The api endpoint returns the expected output:
Is it possible that the lack of a variable is causing an invalid yaml for one of your axis? And have you updated to the absolute latest version of 0.6 (to ensure you have this fix #2018) Can you please provide a full yaml that reproduces the problem? |
I've pulled drone/drone:0.6 :
And restarted the server after dropping the database. I've tried both the sqlite and MySQL database backends. Nothing fancy about the installation, it's very much like the documented "docker-compose" setup. I've reused your yaml example and applied the following sequence to trigger the problem : matrix:
include:
- golang: 1.7
+ redis: 3.0
- golang: 1.8
redis: 3.0 - golang: 1.7
redis: 3.0
- golang: 1.8
- redis: 3.0 After that none of the builds can be displayed. Only the last element of the proc array gets a |
I still cannot repeat the error. The changes above work as expected. Can you please provide a full yaml configuration that can be used to repeat the error?
|
I've reused your own example on a test repo... clone:
git:
image: plugins/git
skip_verify: true
pipeline:
foo:
image: golang:${golang}
commands:
- go version
- sleep 20
matrix:
include:
- golang: 1.7
redis: 3.0
- golang: 1.8
Output : {
"procs": [
{
"id": 25,
"build_id": 5,
"pid": 1,
"ppid": 0,
"pgid": 1,
"name": "",
"state": "success",
"exit_code": 0,
"start_time": 1495067057,
"end_time": 1495067082,
"environ": {
"golang": "1.7",
"redis": "3.0"
}
},
{
"id": 28,
"build_id": 5,
"pid": 2,
"ppid": 0,
"pgid": 2,
"name": "",
"state": "success",
"exit_code": 0,
"start_time": 1495067082,
"end_time": 1495067107,
"environ": {
"golang": "1.8"
},
"children": [
{
"id": 26,
"build_id": 5,
"pid": 3,
"ppid": 1,
"pgid": 3,
"name": "git",
"state": "success",
"exit_code": 0,
"start_time": 1495067058,
"end_time": 1495067060
},
{
"id": 27,
"build_id": 5,
"pid": 4,
"ppid": 1,
"pgid": 4,
"name": "foo",
"state": "success",
"exit_code": 0,
"start_time": 1495067060,
"end_time": 1495067082
},
{
"id": 29,
"build_id": 5,
"pid": 5,
"ppid": 2,
"pgid": 5,
"name": "git",
"state": "success",
"exit_code": 0,
"start_time": 1495067082,
"end_time": 1495067084
},
{
"id": 30,
"build_id": 5,
"pid": 6,
"ppid": 2,
"pgid": 6,
"name": "foo",
"state": "success",
"exit_code": 0,
"start_time": 1495067084,
"end_time": 1495067106
}
]
}
]
} |
Hello Brad, I've looked into the Tree func of model/proc.go. I've notice the procs array passed to the function was ordered as displayed above (parent, parent, child, child, child, child), but the Tree function seems to assume that this array is always nicely ordered. I've tried out the following piece of code to bound child and parent processes relying on their ids. nodes []*Proc
parent *Proc
)
+ kids := make([]*Proc, len(procs))
+ copy(kids, procs)
for _, proc := range procs {
if proc.PPID == 0 {
nodes = append(nodes, proc)
parent = proc
- continue
- } else {
- parent.Children = append(parent.Children, proc)
+ for _, child := range kids {
+ if child.PPID == parent.PID {
+ parent.Children = append(parent.Children, child)
+ }
+ }
}
}
return nodes Let me know what you think about this lead. The way the rows are inserted/updated/returned might me an explanation on why the issue can't be easily reproduced. |
Hello again,
This is a follow up of https://github.com/drone/drone-ui/issues/114.
Matrices with unbalanced number of elements break how the
procs
are returned in abuild
:This happens on the latest drone:0.6. All works fine until a variable is added or removed from a set. The database seems to be populated correctly (the pid, ppid tree is OK), but children in the
proc
struct are not retrieved accordingling. They all end up in the lastproc
.The text was updated successfully, but these errors were encountered: