Skip to content

Enable modification of ci_instance_level_variables limit via API and UI

What does this MR do and why?

This is a first iteration, hoping to get the ball rolling on enabling the modification of the ci_instance_level_variables limit via UI and API in addition to Rails console. The problem was raised in a customer support ticket, and when completed, this functionality would allow Dedicated customers the ability to self serve when they need to adjust this limit for their instance.

Closes #391626 (closed)

Screenshots or screen recordings

UI

Adds in a new field for setting the ci_instance_level_variables limit under the default plan, with label Maximum number of Instance-level CI/CD variables that can be defined

Before After
before after

API

Example API response from GET issued to http://gdk.local:3000/api/v4/application/plan_limits where "ci_instance_level_variables": is now returned at the top:

After:

{
  "ci_instance_level_variables": 5,
  "ci_pipeline_size": 0,
  "ci_active_jobs": 0,
  "ci_project_subscriptions": 2,
  "ci_pipeline_schedules": 10,
  "ci_needs_size_limit": 50,
  "ci_registered_group_runners": 1000,
  "ci_registered_project_runners": 1000,
  "conan_max_file_size": 3221225472,
  "enforcement_limit": 0,
  "generic_packages_max_file_size": 5368709120,
  "helm_max_file_size": 5242880,
  "limits_history": {},
  "maven_max_file_size": 3221225472,
  "notification_limit": 0,
  "npm_max_file_size": 524288000,
  "nuget_max_file_size": 524288000,
  "pipeline_hierarchy_size": 1000,
  "pypi_max_file_size": 3221225472,
  "terraform_module_max_file_size": 1073741824,
  "storage_size_limit": 0
}

Before:

{
  "ci_pipeline_size": 0,
  "ci_active_jobs": 0,
  "ci_project_subscriptions": 2,
  "ci_pipeline_schedules": 10,
  "ci_needs_size_limit": 50,
  "ci_registered_group_runners": 1000,
  "ci_registered_project_runners": 1000,
  "conan_max_file_size": 3221225472,
  "enforcement_limit": 0,
  "generic_packages_max_file_size": 5368709120,
  "helm_max_file_size": 5242880,
  "limits_history": {},
  "maven_max_file_size": 3221225472,
  "notification_limit": 0,
  "npm_max_file_size": 524288000,
  "nuget_max_file_size": 524288000,
  "pipeline_hierarchy_size": 1000,
  "pypi_max_file_size": 3221225472,
  "terraform_module_max_file_size": 1073741824,
  "storage_size_limit": 0
}

How to set up and validate locally

Prerequisite: A GDK instance set up with changes branch active

UI:

  1. In GDK instance, navigate to the settings page: /admin/application_settings/ci_cd and scroll down to CI/CD limits section
  2. Fill a value into the box for Maximum number of Instance-level CI/CD variables that can be defined and save to apply
  3. Use Plan limits API or Rails console to check updated limit value:
Plan.default.actual_limits.ci_instance_level_variables

API:

Note: Administrator access is required to use Plan limits API - need an API token for auth with admin access for the following steps)

  1. Use GET request to obtain the current limits
  2. Issue a PUT request to update the ci_instance_level_variables limit value PUT http://gdk.local:3000/api/v4/application/plan_limits?plan_name=default&ci_instance_level_variables=100
  3. Use another GET request to confirm the limit is updated

For both methods (API and UI), you can set the limit low (i.e. 2 variables) and confirm that creating new variables to exceed it is not possible.

Merge request reports

Loading