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_days argument to GroupSecretCreate and GroupSecretUpdate mutations
  • Passes the parameter through to the respective services

Services:

  • GroupSecrets::CreateService — adds rotation_interval_days param, defines build_secret_rotation_info to create GroupSecretRotationInfo records
  • GroupSecrets::UpdateService — adds rotation_interval_days param, defines build_secret_rotation_info, handles rotation upsert/validation before update
  • UpdateServiceHelpers — extracts shared secret_rotation_info_invalid_error from ProjectSecrets::UpdateService (was duplicated)
  • ProjectSecrets::UpdateService — removes secret_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_secret and 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 SecretRotationInfoProjectSecretRotationInfo for naming consistency
3 👉 You are here 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

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.

Edited by Erick Bajao

Merge request reports

Loading