Backport EE API parameters to CE
In https://gitlab.com/gitlab-org/gitlab-ee/issues/9505 we're resolving CE to EE differences in the lib/ directory, which includes a lot of API code. Various APIs have parameters specific to EE, or parameters that are optional in EE while being required in CE. An example would be the following diff (the additions are from EE):
+ params :optional_params_ee do
+ optional :membership_lock, type: Boolean, desc: 'Prevent adding new members to project membership within this group'
+ optional :ldap_cn, type: String, desc: 'LDAP Common Name'
+ optional :ldap_access, type: Integer, desc: 'A valid access level'
+ optional :shared_runners_minutes_limit, type: Integer, desc: '(admin-only) Pipeline minutes quota for this group'
+ all_or_none_of :ldap_cn, :ldap_access
+ end
+
params :optional_params do
use :optional_params_ce
+ use :optional_params_ee
end
To the best of my knowledge, there's no nice way of handling this by prepending modules. Instead, I propose that we port all EE parameters to CE, and just ignore them there. For parameters that are required in CE and required in EE, we'd need some kind of conditional. For example, something like this:
if defined?(License) # we'd need a dedicated/better method for this
optional :foo
else
requires :foo
end
When adding EE parameters, we should clearly document them as such in the code. This can just be a single comment along the lines of "These parameters are only used in Enterprise Edition". This should prevent developers from removing the parameters by accident, thinking they are unused.
Previous discssion: https://gitlab.com/gitlab-org/gitlab-ee/issues/9505#note_143705754