Skip to content

Cleanup `ci_limit_environment_scope` feature flag

Mireya Andres requested to merge ma/cleanup_ci_limit_environment_scope into master

What does this MR do and why?

This cleans up the ci_limit_environment_scope feature flag.

The feature flag only affects the form/modal for project-level CI variables. Vue components for CI variables are shared across the instance-level, group-level, and project-level CI variables, so it's necessary to add a conditional (hasEnvScopeQuery) for project-level CI variables when making the feature available by default.

The project-level CI variable form uses a GraphQL query for fetching environments for the environment scope dropdown. The ci_limit_environment_scope feature flag (which this MR enables by default) makes sure that the query only fetches a maximum of 30 environments, both in the initial fetch and during a search.

The group-level CI variable form does not use a dedicated GraphQL query for fetching environment scopes. When searching for an environment, the search is done on the client side (no network request).

The instance-level CI variable form does not have an environment scope dropdown.

Note: In a future MR (!124134 (merged)), we will introduce a GraphQL query for fetching environments for group-level CI variables. Creating the hasEnvScopeQuery conditional here will simplify this future implementation as well.

Screenshots or screen recordings

Project Group Instance
Screen_Recording_2023-06-27_at_20.31.24 Screen_Recording_2023-06-27_at_20.31.58 Screenshot_2023-06-27_at_20.32.43

How to set up and validate locally

Setup

  1. Make sure the feature flag is disabled.

    Feature.disable(:ci_limit_environment_scope)
  2. You can use the following commands to seed your project/group with environments. (Docs)

    # Seed environments
    # Uses a default of 10 for seed_count and `ENV_` for the prefix
    bundle exec rake "gitlab:seed:project_environments[project_path, seed_count, prefix]"
    
    # Seed CI variables for group
    # Uses a default of 10 for seed_count, "*" for environment_scope, and `GROUP_VAR_` for the prefix.
    # Set environment_scope is set to "unique", each variable will have its own unique environment
    bundle exec rake "gitlab:seed:ci_variables_group[group_name, seed_count, environment_scope, prefix]"
  3. Go to Settings > CI/CD > and expand the Variables section. Click Add variable to open the modal.

Validation

For Projects

  1. The dropdown for Environment Scopes should now only fetch 30 environments at most.
  2. When using the search bar in the dropdown, this also queries for at most 30 environments.

For Groups

  1. The dropdown for Environment Scopes does not send a new network request when searching for environments.

For Admin

  1. The dropdown for Environment Scopes does not exist.

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 Mireya Andres

Merge request reports