Class: Ci::CloneJobService
- Inherits:
-
Object
- Object
- Ci::CloneJobService
- Defined in:
- app/services/ci/clone_job_service.rb
Instance Method Summary collapse
- #execute(new_job_variables: [], new_job_inputs: {}) ⇒ Object
-
#initialize(job, current_user:) ⇒ CloneJobService
constructor
A new instance of CloneJobService.
Constructor Details
#initialize(job, current_user:) ⇒ CloneJobService
Returns a new instance of CloneJobService.
5 6 7 8 |
# File 'app/services/ci/clone_job_service.rb', line 5 def initialize(job, current_user:) @job = job @current_user = current_user end |
Instance Method Details
#execute(new_job_variables: [], new_job_inputs: {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/ci/clone_job_service.rb', line 10 def execute(new_job_variables: [], new_job_inputs: {}) new_attributes = build_base_attributes add_job_variables_attributes!(new_attributes, new_job_variables) add_job_inputs_attributes!(new_attributes, new_job_inputs) add_job_definition_attributes!(new_attributes) new_attributes[:user] = current_user job.class.new(new_attributes) end |