Add rotation interval support to group secret create/update services and mutations
Dependent on !225338 (merged) being merged first. Will rebase on master once ready.
What does this MR do and why?
Adds rotation_interval_days support to group secret create and update services and GraphQL mutations, as part of #577344 (closed).
With the GroupSecretRotationInfo model introduced in !225247 (merged) and the rename in !225338 (merged), this MR wires up rotation creation through the existing service layer so that group secrets can have rotation reminders just like project secrets.
Since rotation creation logic is now common behavior for both projects and groups, this MR also extracts the shared rotation tests into shared examples and moves secret_rotation_info_invalid_error into UpdateServiceHelpers to avoid duplication.
Implementation details
GraphQL mutations:
- Adds
rotation_interval_daysargument toGroupSecretCreateandGroupSecretUpdatemutations - Passes the parameter through to the respective services
Services:
-
GroupSecrets::CreateService— addsrotation_interval_daysparam, definesbuild_secret_rotation_infoto createGroupSecretRotationInforecords -
GroupSecrets::UpdateService— addsrotation_interval_daysparam, definesbuild_secret_rotation_info, handles rotation upsert/validation before update -
UpdateServiceHelpers— extracts sharedsecret_rotation_info_invalid_errorfromProjectSecrets::UpdateService(was duplicated) -
ProjectSecrets::UpdateService— removessecret_rotation_info_invalid_error(now in shared helpers)
Specs:
-
secret_create_service_examples.rb— adds shared rotation creation tests (creates with rotation info, skips when nil) -
secret_update_service_examples.rb— adds shared rotation update tests (add rotation, remove rotation, update interval, invalid interval) - Individual project/group service specs define
rotation_info_for_secretand delegate to the type-specific helper, removing duplicated rotation tests - GraphQL mutation specs verify rotation info records are created correctly
Series overview
Part of a series for #577344 (closed):
| # | MR | Description |
|---|---|---|
| 1 | !225247 (merged) | DB migration + GroupSecretRotationInfo model + BaseSecretRotationInfo base class |
| 2 | !225338 (merged) | Rename SecretRotationInfo → ProjectSecretRotationInfo for naming consistency |
| 3 |
|
CreateService + UpdateService + GraphQL mutations (add rotation_interval_days param) |
| 4 | !225935 (merged) | List/Read services + GroupSecretType GraphQL type (add rotation info loading/field) |
| 5 | !226133 (merged) | Background jobs for group and project secret rotation reminders |
References
- Partially closes #577344 (closed)
- Depends on !225338 (merged)
- Related epic: &17904
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.