-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
feat: Add workflow dependencies visualization (#26062) #36248
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
base: main
Are you sure you want to change the base?
Conversation
9e8feef to
f685d5f
Compare
## API changes:
- Add job_id field for YAML job identifiers
- Add needs field for job dependencies
- Update swagger documentation
## Frontend features:
- Interactive graph with zoom/pan navigation
- Matrix jobs visualization
- Custom job names support via job_id
- Status-based coloring and animations
- Hover highlighting for related jobs
- Click to navigate to job details
## Technical details:
- Uses existing database columns (no schema changes)
- Backward compatible (omitempty for new fields)
- Handles edge cases (cycles, missing dependencies)
- Performance optimized
## UI integration:
- Updated RepoActionView.vue styles for proper theme compatibility
- Consistent styling with Gitea's CSS variables
| // ActionWorkflowJob represents a WorkflowJob | ||
| type ActionWorkflowJob struct { | ||
| ID int64 `json:"id"` | ||
| JobID string `json:"job_id,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would revert changes to the rest api, since the UI does not use this struct. Might be a leftover from previous tries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The needs and job_id fields are required for the workflow dependency graph functionality implemented in the WorkflowGraph.vue component. The component uses job_id to correctly map dependencies between jobs, especially when custom job names are used in the workflow definition. Without these fields, it is impossible to reliably determine the connections between nodes (edges will not be drawn).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The needs and job_id fields are required for the workflow dependency graph functionality implemented
Yes I agree that you need those information to build the graph, but you do not use the gitea rest api structs in your vue component as far as I understood.
Your template uses the data from the view model
Changes of this file
https://github.com/go-gitea/gitea/blob/f685d5f8d586f3970820e5471706fe9b08d3b315/routers/web/repo/actions/view.go
This then directly use ActionRunJob to create this data for your vue component.
Additional Context As far I know Gitea does not allow for security related reasons to use the api/v1 from the ui code, because they are not protected against webbrowser cross site attacks and so on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I was developing the graph component, I considered keeping the data structures consistent between the API and the view layer. These fields might be needed for direct API usage by third-party applications, not just my component. If you think they won't be necessary, I can remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest api only change as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are affected.
However, these changes are backward compatible.
They are only required for the Dependency Graph functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest api only change as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they are affected.
However, these changes are backward compatible.
They are only required for the Dependency Graph functionality.
|
Would it be possible to show the graph "left-to-right" (like Github / Gitlab) instead of "top to bottom"? |
Good suggestion! I can add an orientation toggle (top-down ↔ left-right) in a separate PR to keep this one focused on the core functionality. |
feat: Add workflow dependencies visualization
Related to #26062
What does this PR do?
This PR adds an interactive visualization component that displays job dependencies in Gitea Actions workflow runs. It helps users understand complex pipeline structures at a glance, addressing the difficulty of comprehending dependency chains in current Gitea UI.
Screenshots / Images
Example 1: Multi-level CI/CD Pipeline (9 levels deep)
Pipeline Source
Example 2: Microservices Deployment with Matrix Jobs
Pipeline Source
Example 3: Real production workflow
Pipeline Source
Docker Image for Testing
A pre-built Docker image with these changes is available for reviewers to test without building locally:
What changes were made?
API Changes:
job_idfield tostructs.ActionJobfor YAML job identifier mappingneedsfield to track job dependencies as defined in workflow YAMLomitemptyfor backward compatibilityFrontend Component:
WorkflowGraph.vuewith TypeScript supportjob_idfield correlationBackend:
job_idmaps to existingjob_namein actions table)Testing
The implementation has been thoroughly tested with:
Manual Testing:
Test Workflows Used:
Performance:
Backwards Compatibility
omitempty)Usage
Checklist
Additional Notes
job_idfield which maps to YAML job identifiersvar(--color-*)) for proper theme integration