Add visualization functionality to Authoring home
What does this MR do?
We are adding a ci config visualization that takes the blob content of the ci config file and send it to the API for linting. The returned result is a payload with stages, groups, jobs and their needs which we parse and then render jobs and links to show what the graph actually looks like.
To note that this functionality already existed behind a flag in the repository view, but its release was delayed due to concerns of how we parsed the data (on the FE vs on the BE) and therefore this MR doesn't change much of how it's parsed, but rather took the existing component and moved it in the right section. We are also plugging it with the graphQL api that parses the YML instead of parsing it on the client side.
To note that this MR doesn't add E2E test simply because currently, there is nothing to test from that point of view. The only interaction a user can do is hovering on a job pill and seeing the highlight. It could be a nice to have to test, but it will require some serious thought. That plus the fact that this feature will change drastically in the following months made me think it was not worth the effort as is. The best solution would be visual testing, which we will explore soon as a team outside of this MR.
This is behind a feature flag so we don't need a changelog.
To test
This is behind two feature flags. One is to enable the new pipeline authoring home, which is necessary to go in the Pipeline Editor
section in our nav under Ci/CD
and the other is to enable the tab in which the visualization is rendered. This is to ensure that we can turn it off independently if something was to go wrong.
- Enable the editor page feature flag in your rails console
rails c
, thenFeature.enable(:ci_pipeline_editor_page)
- Enable the visualization tab
Feature.enable(:ci_config_visualization_tab)
- Navigate under
CI/CD
to theeditor
section - Add a valid CI configuration. Here is one pretty basic:
stages:
- prepare
- optimize
- build
prepare_1:
script: "echo hello"
stage: "prepare"
prepare_2:
script: "echo hello"
stage: "prepare"
prepare_3:
script: "echo hello"
stage: "prepare"
prepare_4:
script: "echo hello"
stage: "prepare"
optimize_1:
script: "echo hello"
stage: "optimize"
needs: ["prepare_2"]
optimize_2:
script: "echo hello"
stage: "optimize"
needs: ["prepare_3"]
optimize_3:
script: "echo hello"
stage: "optimize"
needs: ["prepare_3"]
build_1:
script: "echo hello"
stage: "build"
needs: ["prepare_2"]
build_2:
script: "echo hello"
stage: "build"
needs: ["optimize_2","prepare_2"]
- Click on the visualize tab
- You should see the graph!
- Hover on a node with dependencies to see it highlighted
- If you modify the yml file, the visualization will update itself automatically and when you go back in the tab, you should see the updates
- If the configuration is invalid, there will be a message at the top to say so and the graph will not render (we cannot construct it if the config is invalid.
Screenshots (strongly suggested)
Before | After |
---|---|
|
Demo
Screen_Recording_2020-12-09_at_11.51.42_AM
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team