Skip to content

Add a checkbox for adding SAST to a new project

What does this MR do and why?

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/333196.

This is an experiment for new projects, that adds a checkbox to add SAST configuration to the repo automatically. When checked, a new project will get the standard SAST configuration commit on the default branch.

Screenshots or screen recordings

When creating a new blank project, a user who is assigned to the experiment is presented with a checkbox to enable SAST.

Screen_Shot_2021-09-30_at_11.27.25_AM

When both checkboxes are checked you end up with the following two commits:

Screen_Shot_2021-09-16_at_2.10.56_PM

You can alternately only check one of the checkboxes.

How to set up and validate locally

Verifying the candidate. You can always check the control as well with:

  1. Enable the experiment for your test user
    ApplicationExperiment.new(:new_project_sast_enabled, :candidate, user: User.find_by_username!('root'))
  2. Create a new blank project (@ http://gdk.test:3000/projects/new)
  3. Check the Enable SAST checkbox to see the commit that's added to the default branch

Verifying the free indicator variant. There's an additional variant that includes a "free" badge at the end of the label, but is otherwise identical to the candidate.

  1. Enable the experiment for your test user
    ApplicationExperiment.new(:new_project_sast_enabled, :free_indicator, user: User.find_by_username!('root'))
  2. Create a new blank project (@ http://gdk.test:3000/projects/new)
  3. You should see the free label.

Verifying the control. You can always check the control as well with:

ApplicationExperiment.new(:new_project_sast_enabled, :control, user: User.find_by_username!('root'))

MR acceptance checklist

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

Edited by Jeremy Jackson

Merge request reports