Implements form submission for creating container protection tag rule
What does this MR do and why?
Implements form submission for creating container protection tag rule
- Adds submit & cancel button.
- Adds client side validations for input length on form submission.
- Calls create graphql mutation on form submit.
- Show error alert when mutation fails.
- Show toast when mutation succeeds.
Tests
- Adds fixtures for create mutation.
- Use fixtures for unit tests.
- Adds feature specs.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- Previous MR which adds form: Adds form to add container tag protection rules (!177698 - merged)
- Designs:
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Form | Server Error | Inline validation |
|---|---|---|
![]() |
![]() |
![]() |
How to set up and validate locally
-
Setup container registry.
-
Enable the metadata database https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/registry.md#metadata-database
- Alternatively, you can apply the patch:
diff --git a/app/helpers/packages_helper.rb b/app/helpers/packages_helper.rb index c35ad19155f6..ccad3b0c195e 100644 --- a/app/helpers/packages_helper.rb +++ b/app/helpers/packages_helper.rb @@ -143,10 +143,7 @@ def settings_data(project) cleanup_settings_data(project).merge( show_container_registry_settings: show_container_registry_settings(project).to_s, show_package_registry_settings: show_package_registry_settings(project).to_s, - is_container_registry_metadata_database_enabled: ( - show_container_registry_settings(project) && - ContainerRegistry::GitlabApiClient.supports_gitlab_api? - ).to_s, + is_container_registry_metadata_database_enabled: true.to_s, cleanup_settings_path: cleanup_image_tags_project_settings_packages_and_registries_path(project) ) end
- Alternatively, you can apply the patch:
-
Enable feature flag
Feature.enable(:container_registry_protected_tags) -
Visit
Project > Settings > Packages and registries. -
Expand
Container registrysection -
Create container registry protection rules & confirm validations & error messages are displayed.
-
Upon creation, confirm that the new rule is displayed in the table.
Related to #499871


