Self-hosted DAP: add check for online license
What does this MR do and why?
This MR updates the permissions logic regarding self-hosted models for DAP feature setting:
- Since the Self-Hosted DAP add-on is only available for offline licenses in 18.8, we now check for DAP add-on only on offline licenses. For online licenses, self-hosted models are shown if Duo Enterprise add-on exists and Self-Hosted beta features are enabled (matching 18.7 behavior implemented in Hide DAP Self-hosted Models if the GitLab Testi... (!215690 - merged)).
- Reverts Hide DAP Self-hosted Models if the GitLab Testi... (!215690 - merged): beta enabled checks are no longer needed at this level since they're handled by the self-hosted DAP permission check.
References
Follow up to Update policies to support Self-hosted DAP SKU ... (!215456 - merged)
Screenshots or screen recordings
| Case | After |
|---|---|
| DAP SKU + offline license |
DAP features:
Classic features (no regressions):
|
| DAP SKU + online license | N/A |
| No SKU (Duo Enterprise add-on) + offline |
DAP features:
Classic features (no regressions):
|
|
No SKU (Duo Enterprise add-on) + online license + beta not enabled |
DAP features:
Classic features (no regressions):
|
| No SKU (Duo Enterprise add-on) + online license + beta enabled |
DAP features:
Classic features (no regressions):
|
How to set up and validate locally
Setup:
Duo Enterprise add-on
- Run
GITLAB_SIMULATE_SAAS=0 bundle exec 'rake gitlab:duo:setup'
Self-Hosted DAP add-on
- Apply this patch to update the GitLab Duo script:
diff --git a/ee/lib/gitlab/duo/developments/setup.rb b/ee/lib/gitlab/duo/developments/setup.rb
index a4f93beb6cb9..a9178adcf797 100644
--- a/ee/lib/gitlab/duo/developments/setup.rb
+++ b/ee/lib/gitlab/duo/developments/setup.rb
@@ -45,6 +45,8 @@ def create_add_on_purchases!(group: nil)
# Core already created, nothing more needed
when 'duo_pro'
create_add_on_purchase!(group, :code_suggestions, 'C-12345', "Duo Pro add-on added...")
+ when 'self_hosted_dap'
+ create_add_on_purchase!(group, :self_hosted_dap, 'C-12345', "Duo Self Hosted DAP add-on added...")
else
# Default to enterprise
create_add_on_purchase!(group, :duo_enterprise, 'C-98766', "Duo Enterprise add-on added...")
- Run
GITLAB_SIMULATE_SAAS=0 bundle exec 'rake gitlab:duo:setup["self_hosted_dap"]'to create the add-on - After testing, clean up by running the following in the Rails console:
GitlabSubscriptions::AddOnPurchase.by_add_on_name(:self_hosted_dap).destroy_all
Offline license
- Update the
offline_cloud_license?method inee/app/models/license.rb
Toggle self-hosted beta features
- Go to
/admin/gitlab_duo/configuration - Toggle the
Use beta models and features in GitLab Duo Self-Hosted - Save settings
Steps:
- Run GDK on non-SAAS mode:
GITLAB_SIMULATE_SAAS=0 gdk start - Go to the instance-level model configuration page:
admin/gitlab_duo/self_hosted - Follow the setup steps to achieve test case and refer to screen recording table above for expected behavior
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.