Class: Ci::PipelineSchedules::BaseSaveService
- Inherits:
-
Object
- Object
- Ci::PipelineSchedules::BaseSaveService
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/ci/pipeline_schedules/base_save_service.rb
Direct Known Subclasses
Constant Summary collapse
- INVALID_REF_MESSAGE =
The only way that ref can be unexpanded after #expand_short_ref runs is if the ref is ambiguous because both a branch and a tag with the name exist, or it is ambiguous because neither exists.
'Ref is ambiguous'- INVALID_REF_MODEL_MESSAGE =
'is ambiguous'
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/services/ci/pipeline_schedules/base_save_service.rb', line 14 def execute schedule.assign_attributes(params) return forbidden_to_save unless allowed_to_save? return forbidden_to_save_variables unless allowed_to_save_variables? # This validation cannot be added to the model yet due to operation hooks # causing incidents unless valid_ref_format? schedule. # Only return an error if the ref fails to expand return invalid_ref_format unless valid_ref_format? end if schedule.save ServiceResponse.success(payload: schedule) else ServiceResponse.error(payload: schedule, message: schedule.errors.) end end |