Skip to content

Expose default VSA stages on project level

Adam Hegyi requested to merge 329208-project-level-value-stream into master

What does this MR do?

This MR moves/rearranges Value Stream Analytics related files to prepare for the project level value stream refactor. The MR might look big because moving files and splitting them for CE.

Note: the change is not user facing. FE implementation is a separate issue.

Current status:

Goal:

Project level VSA should provide the same features as Group level VSA for licensed groups (not part of this MR). For FOSS users, provide the same functionality by reusing/sharing as much code with the group level implementation as possible.

For FOSS version the backend will expose 1 value stream object (in memory, not persisted) named 'default' with the default stages.

File changes:

  • Adding Analytics::CycleAnalytics::Stages::BaseService to FOSS that only contains the ability of building in-memory default stages.
  • Adding Analytics::CycleAnalytics::Stages::ListService to FOSS that only lists in-memory default stages.
  • Renaming Analytics::CycleAnalytics::GroupValueStreamEntity to Analytics::CycleAnalytics::ValueStreamEntity and move it to FOSS. It works with GroupValueStream and ProjectValueStream objects.
    • Same story with the Entity object.

How to test it:

  1. Log in
  2. Visit: http://localhost:3000/flightjs/Flight/-/analytics/value_stream_analytics/value_streams (empty stages array is expected)
  3. Visit: http://localhost:3000/flightjs/Flight/-/analytics/value_stream_analytics/value_streams/default/stages

Database

The migrations are re-creating the same structure on the project level what we have on the group level: Group -> GroupStage -> Group ValueStream

UP:

== 20210503105022 CreateProjectValueStreams: migrating ========================
-- create_table(:analytics_cycle_analytics_project_value_streams, {})
-- quote_column_name(:name)
   -> 0.0000s
   -> 0.0417s
-- quote_table_name("check_9b1970a898")
   -> 0.0000s
-- quote_table_name(:analytics_cycle_analytics_project_value_streams)
   -> 0.0000s
-- execute("ALTER TABLE \"analytics_cycle_analytics_project_value_streams\"\nADD CONSTRAINT \"check_9b1970a898\" CHECK (char_length(\"name\") <= 100)\n")
   -> 0.0009s
== 20210503105022 CreateProjectValueStreams: migrated (0.0472s) ===============

== 20210503105845 AddProjectValueStreamIdToProjectStages: migrating ===========
-- transaction()
-- add_reference(:analytics_cycle_analytics_project_stages, :project_value_stream, {:null=>false, :index=>{:name=>"index_analytics_ca_project_stages_on_value_stream_id"}, :foreign_key=>{:on_delete=>:cascade, :to_table=>:analytics_cycle_analytics_project_value_streams}, :type=>:bigint})
   -> 0.0084s
   -> 0.0104s
== 20210503105845 AddProjectValueStreamIdToProjectStages: migrated (0.0233s) ==

DOWN:

== 20210503105845 AddProjectValueStreamIdToProjectStages: reverting ===========
-- remove_reference(:analytics_cycle_analytics_project_stages, :project_value_stream)
   -> 0.0023s
== 20210503105845 AddProjectValueStreamIdToProjectStages: reverted (0.0023s) ==

== 20210503105022 CreateProjectValueStreams: reverting ========================
-- drop_table(:analytics_cycle_analytics_project_value_streams)
   -> 0.0021s
== 20210503105022 CreateProjectValueStreams: reverted (0.0087s) ===============

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

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

Related to #329208 (closed)

Edited by Adam Hegyi

Merge request reports