Store workflow/step dependencies in database and update API#6130
Store workflow/step dependencies in database and update API#6130lafriks wants to merge 5 commits intowoodpecker-ci:mainfrom
Conversation
…r frontend to draw dependency graph
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6130 +/- ##
==========================================
+ Coverage 31.65% 31.66% +0.01%
==========================================
Files 421 421
Lines 28430 28464 +34
==========================================
+ Hits 8999 9014 +15
- Misses 18609 18626 +17
- Partials 822 824 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| Networks []Conn `json:"networks,omitempty"` | ||
| DNS []string `json:"dns,omitempty"` | ||
| DNSSearch []string `json:"dns_search,omitempty"` | ||
| DependsOn []string `json:"depends_on,omitempty"` |
There was a problem hiding this comment.
because it goes through compiler to backend types and then from backend types it's assigned to model type
| State: model.StatusPending, | ||
| Failure: step.Failure, | ||
| Type: model.StepType(step.Type), | ||
| DependsOnNames: step.DependsOn, |
There was a problem hiding this comment.
why not name it DependsOn like the rest of the codebase?!?
There was a problem hiding this comment.
Because you need to resolve string DependsOn (step names) to IDs but they are only known when all records are inserted, model has both DopendsOnNames -> string array and DependsOn -> int64 array that will be populated after saving all workflows and steps to database from DependsOnNames and then we can update depends_on column with depends_on step ID's
There was a problem hiding this comment.
can we not do it DependsOn -> string array and DependsOnIDs -> int64 array to be consistent with the rest?
|
In my previous tests of showing a DAG in the UI, I have used the yaml configs (already exposed via api) to generate dags. |
Yes but it has many problems:
matrix:
ENV:
- staging
- production
steps:
- name: validate-config-${ENV}
image: alpine
commands:
- echo "validate-config-${ENV}"
depends_on: []
- name: fetch-secrets-${ENV}
image: alpine
commands:
- echo "fetch-secrets-${ENV}"
depends_on: []
- name: build-manifest-${ENV}
image: alpine
commands:
- echo "build-manifest-${ENV}"
depends_on:
- validate-config-${ENV}
- fetch-secrets-${ENV}so in fronted you would need to expand them and guess workflow matrix axis
Saving them to database after compiler is already done correct computations is imho best way to do this |
this is a open todo to be remove by #3967 ... so we should not introduce a new issue |

Needed for frontend to be able to draw dependency graph for pipeline (workflows and steps)
I wanted to split frontend PR from backend as it still needs to be discussed on how to better implement UI for this but that should not be blocking to merge backend part