diff --git a/doc/api/projects.md b/doc/api/projects.md index 5764abda7ce62a64b2bbccf7b32cf34682aeed5f..64e8bc7223d8faa138321da32207122cd1396b80 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1474,7 +1474,8 @@ Refer to the [Events API documentation](events.md#list-a-projects-visible-events ## Create project -> `operations_access_level` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/385798) in GitLab 16.0. +> - `operations_access_level` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/385798) in GitLab 16.0. +> - `model_registry_access_level` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/412734) in GitLab 16.7. Creates a new project owned by the authenticated user. @@ -1550,6 +1551,7 @@ curl --request POST --header "PRIVATE-TOKEN: " \ | `infrastructure_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `monitor_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `model_experiments_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | +| `model_registry_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `remove_source_branch_after_merge` | boolean | No | Enable `Delete source branch` option by default for all new merge requests. | | `repository_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `repository_storage` | string | No | Which storage shard the repository is on. _(administrator only)_ | @@ -1573,7 +1575,8 @@ curl --request POST --header "PRIVATE-TOKEN: " \ ## Create project for user -> `operations_access_level` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/385798) in GitLab 16.0. +> - `operations_access_level` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/385798) in GitLab 16.0. +> - `model_registry_access_level` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/412734) in GitLab 16.7. Creates a new project owned by the specified user. Available only for administrators. @@ -1639,6 +1642,7 @@ POST /projects/user/:user_id | `infrastructure_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `monitor_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `model_experiments_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | +| `model_registry_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `remove_source_branch_after_merge` | boolean | No | Enable `Delete source branch` option by default for all new merge requests. | | `repository_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `repository_storage` | string | No | Which storage shard the repository is on. _(administrators only)_ | @@ -1664,7 +1668,8 @@ POST /projects/user/:user_id ## Edit project -> `operations_access_level` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/385798) in GitLab 16.0. +> - `operations_access_level` [removed](https://gitlab.com/gitlab-org/gitlab/-/issues/385798) in GitLab 16.0. +> - `model_registry_access_level` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/412734) in GitLab 16.7. Updates an existing project. @@ -1754,6 +1759,7 @@ Supported attributes: | `feature_flags_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `infrastructure_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `monitor_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | +| `model_registry_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `remove_source_branch_after_merge` | boolean | No | Enable `Delete source branch` option by default for all new merge requests. | | `repository_access_level` | string | No | One of `disabled`, `private`, or `enabled`. | | `repository_storage` | string | No | Which storage shard the repository is on. _(administrators only)_ | diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb index 12e022bfb2044f5ac43ea5c4ef166c32d7b9104e..af93e09ef0dfc358a5354e6fe017a5adf7d6e4d9 100644 --- a/lib/api/entities/project.rb +++ b/lib/api/entities/project.rb @@ -85,6 +85,7 @@ class Project < BasicProjectDetails expose(:infrastructure_access_level, documentation: { type: 'string', example: 'enabled' }) { |project, options| project_feature_string_access_level(project, :infrastructure) } expose(:monitor_access_level, documentation: { type: 'string', example: 'enabled' }) { |project, options| project_feature_string_access_level(project, :monitor) } expose(:model_experiments_access_level, documentation: { type: 'string', example: 'enabled' }) { |project, options| project_feature_string_access_level(project, :model_experiments) } + expose(:model_registry_access_level, documentation: { type: 'string', example: 'enabled' }) { |project, options| project_feature_string_access_level(project, :model_registry) } expose(:emails_disabled, documentation: { type: 'boolean' }) { |project, options| project.emails_disabled? } expose :emails_enabled, documentation: { type: 'boolean' } diff --git a/lib/api/helpers/projects_helpers.rb b/lib/api/helpers/projects_helpers.rb index 23e83d9d54fcc7e313b9c03c5d23c01796fe94d1..5eda670b8327075719d05aed6d8e054d0d5cd654 100644 --- a/lib/api/helpers/projects_helpers.rb +++ b/lib/api/helpers/projects_helpers.rb @@ -40,6 +40,7 @@ module ProjectsHelpers optional :infrastructure_access_level, type: String, values: %w[disabled private enabled], desc: 'Infrastructure access level. One of `disabled`, `private` or `enabled`' optional :monitor_access_level, type: String, values: %w[disabled private enabled], desc: 'Monitor access level. One of `disabled`, `private` or `enabled`' optional :model_experiments_access_level, type: String, values: %w[disabled private enabled], desc: 'Model experiments access level. One of `disabled`, `private` or `enabled`' + optional :model_registry_access_level, type: String, values: %w[disabled private enabled], desc: 'Model registry access level. One of `disabled`, `private` or `enabled`' optional :emails_disabled, type: Boolean, desc: 'Deprecated: Use emails_enabled instead.' optional :emails_enabled, type: Boolean, desc: 'Enable email notifications' @@ -197,6 +198,7 @@ def self.update_params_at_least_one_of :infrastructure_access_level, :monitor_access_level, :model_experiments_access_level, + :model_registry_access_level, # TODO: remove in API v5, replaced by *_access_level :issues_enabled, diff --git a/spec/requests/api/project_attributes.yml b/spec/requests/api/project_attributes.yml index ab03df84cd5b983acbb9b1a1c016f33d20a5c175..bab5bd2b6acf09e0dbcf0aec59b639e0ddadb6cd 100644 --- a/spec/requests/api/project_attributes.yml +++ b/spec/requests/api/project_attributes.yml @@ -133,7 +133,6 @@ project_feature: - project_id - updated_at - operations_access_level - - model_registry_access_level computed_attributes: - issues_enabled - jobs_enabled diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 41ea27f95de6e5b2c2dbfcd412ec22841e722132..650b21aa0e6b9356c445b24d08f2ec96bd13c5bb 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1313,6 +1313,7 @@ def request attrs[:merge_requests_access_level] = 'disabled' attrs[:issues_access_level] = 'disabled' attrs[:model_experiments_access_level] = 'disabled' + attrs[:model_registry_access_level] = 'disabled' end post api(path, user), params: project @@ -1323,7 +1324,7 @@ def request next if %i[ has_external_issue_tracker has_external_wiki issues_enabled merge_requests_enabled wiki_enabled storage_version container_registry_access_level releases_access_level environments_access_level feature_flags_access_level - infrastructure_access_level monitor_access_level model_experiments_access_level + infrastructure_access_level monitor_access_level model_experiments_access_level model_registry_access_level ].include?(k) expect(json_response[k.to_s]).to eq(v) @@ -3930,7 +3931,7 @@ def failure_message(diff) expect(Project.find_by(path: project[:path]).analytics_access_level).to eq(ProjectFeature::PRIVATE) end - %i[releases_access_level environments_access_level feature_flags_access_level infrastructure_access_level monitor_access_level model_experiments_access_level].each do |field| + %i[releases_access_level environments_access_level feature_flags_access_level infrastructure_access_level monitor_access_level model_experiments_access_level model_registry_access_level].each do |field| it "sets #{field}" do put api(path, user), params: { field => 'private' } diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb index c393125de3faa6c9ac74188869febf16747f8f1e..db447e78d80f1c900e823178b0db9e643db483d2 100644 --- a/spec/services/projects/update_service_spec.rb +++ b/spec/services/projects/update_service_spec.rb @@ -356,7 +356,7 @@ context 'when changes project features' do # Using some sample features for testing. # Not using all the features because some of them must be enabled/disabled together - %w[issues wiki forking model_experiments].each do |feature_name| + %w[issues wiki forking model_experiments model_registry].each do |feature_name| context "with feature_name:#{feature_name}" do let(:feature) { "#{feature_name}_access_level" } let(:params) do