Skip to content

Extract VSA stage controller actions to a module

What does this MR do and why?

This MR extracts all group-level VSA controller code related to the Stage model to the StageActions module so we can reuse it for the project-level controller actions. By doing this, we will be able to make the group-level VSA feature available for projects via the Namespaces::ProjectNamespace model.

The MR does not contain user-facing changes.

How to set up and validate locally

Verify that the FOSS version of project-level VSA works

  1. Seed VSA: SEED_CYCLE_ANALYTICS=true SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
  2. Go to the printed-out project path
  3. Open the network tab in your browser
  4. Navigate to Analytics -> Value Stream
  5. All network requests should succeed (no 500 errors) and the page should show some number.

Verify that the FOSS version works with license

This is a temporary "state". For paid users, we still show the FOSS VSA because the FE changes are not ready yet.

  1. License your GL: ultimate or premium
  2. Repeat the same steps as in the previous section.

Verify that the licensed functionality also works

Note: this is not user-facing yet, so we need to do some manual work:

  1. Start rails c
  2. Find the project and create a stage
project = Project.find_by_full_path("vsmg-1674200626/vsmp-1674200626") # use your generated project path
value_stream = Analytics::CycleAnalytics::ValueStream.create!(namespace: project.project_namespace, name: 'my value stream')
stage = Analytics::CycleAnalytics::Stage.create(name: 'Test Stage', namespace: project.project_namespace, value_stream: value_stream, start_event_identifier: 'merge_request_created', end_event_identifier: 'merge_request_merged')
puts "value stream id: #{value_stream.id}"
puts "stage id: #{stage.id}"
puts "constructed URLs:"

puts Rails.application.routes.url_helpers.namespace_project_analytics_cycle_analytics_value_streams_path(namespace_id: project.group.to_param, project_id: project.to_param)
puts "----"
puts Rails.application.routes.url_helpers.namespace_project_analytics_cycle_analytics_value_stream_path(id: value_stream.id, namespace_id: project.group.to_param, project_id: project.to_param)
  1. Visit the URLs and verify that it returns data

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #382493 (closed)

Edited by Adam Hegyi

Merge request reports