Skip to content

Fix error in updating runner session

Stan Hu requested to merge sh-fix-issue-34366 into master

If a runner attempted to pass along session parameters, an error in Ci::RegisterJobService would be encountered if an existing session were present. This occurred because the id field did not exist in the parameters, so Rails would signal an error:

Failed to remove the existing associated runner_session. The record failed to save after its foreign key was set to nil.

By adding the update_only: true, we allow Rails to update an existing session (https://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html).

Closes #34366 (closed)

Edited by Stan Hu

Merge request reports