Add instance setting to enable or disable Duo Nano features

What does this MR do and why?

This change adds a new column to enable or disable Duo Nano features on an instance level. The new setting will also be used to control the display of a banner about the Duo Nano availability. The following values need to be supported:

  • true: Duo Nano features are enabled.
  • false: Duo Nano features are disabled.
  • null: No action was taken.

References

https://gitlab.com/gitlab-org/gitlab/-/issues/533435+

Migrations

Up migration
main: == [advisory_lock_connection] object_id: 134060, pg_backend_pid: 18508
main: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: migrating ===
main: -- add_column(:application_settings, :duo_nano_features_enabled, :boolean, {:null=>true})
main:    -> 0.0022s
main: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: migrated (0.0066s) 

main: == [advisory_lock_connection] object_id: 134060, pg_backend_pid: 18508
ci: == [advisory_lock_connection] object_id: 134360, pg_backend_pid: 18510
ci: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: migrating ===
ci: -- add_column(:application_settings, :duo_nano_features_enabled, :boolean, {:null=>true})
ci:    -> 0.0018s
ci: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: migrated (0.0109s) 

ci: == [advisory_lock_connection] object_id: 134360, pg_backend_pid: 18510
Down migration(s)
main: == [advisory_lock_connection] object_id: 133740, pg_backend_pid: 17671
main: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: reverting ===
main: -- remove_column(:application_settings, :duo_nano_features_enabled, :boolean, {:null=>true})
main:    -> 0.0027s
main: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: reverted (0.0087s) 

ci: == [advisory_lock_connection] object_id: 133740, pg_backend_pid: 18099
ci: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: reverting ===
ci: -- remove_column(:application_settings, :duo_nano_features_enabled, :boolean, {:null=>true})
ci:    -> 0.0030s
ci: == 20250407080000 AddDuoNanoFeaturesEnabledToApplicationSettings: reverted (0.0144s) 

How to set up and validate locally

  1. A green test suite should be sufficient for this change.
  2. Manual testing can be done by updating and checking the new column:
Gitlab::CurrentSettings.duo_nano_features_enabled # => nil
Gitlab::CurrentSettings.duo_nano_features_enabled? # => false

Gitlab::CurrentSettings.update(duo_nano_features_enabled: false)
Gitlab::CurrentSettings.duo_nano_features_enabled? # => false

Gitlab::CurrentSettings.update(duo_nano_features_enabled: true)
Gitlab::CurrentSettings.duo_nano_features_enabled? # => true

Gitlab::CurrentSettings.update(duo_nano_features_enabled: nil) # reset to nil

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Corinna Gogolok

Merge request reports

Loading