diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-12-11 19:00:11 -0200 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-12-13 13:36:52 -0200 |
commit | 504f77b43a92362b07899e946855dc689b45b3ae (patch) | |
tree | ad394ad0c53b3b3283a375a16e8097b543543f72 /app/workers/update_head_pipeline_for_merge_request_worker.rb | |
parent | 0cdc840b7fd710e58130a06e94d508c7c8cb133b (diff) | |
download | gitlab-ce-504f77b43a92362b07899e946855dc689b45b3ae.tar.gz |
Prevent worker that updates merge requests head pipeline from failing jobs
Diffstat (limited to 'app/workers/update_head_pipeline_for_merge_request_worker.rb')
-rw-r--r-- | app/workers/update_head_pipeline_for_merge_request_worker.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/workers/update_head_pipeline_for_merge_request_worker.rb b/app/workers/update_head_pipeline_for_merge_request_worker.rb index 0a2e9b63578..68c71a2b7a7 100644 --- a/app/workers/update_head_pipeline_for_merge_request_worker.rb +++ b/app/workers/update_head_pipeline_for_merge_request_worker.rb @@ -8,8 +8,19 @@ class UpdateHeadPipelineForMergeRequestWorker pipeline = Ci::Pipeline.where(project: merge_request.source_project, ref: merge_request.source_branch).last return unless pipeline && pipeline.latest? - raise ArgumentError, 'merge request sha does not equal pipeline sha' if merge_request.diff_head_sha != pipeline.sha + + if merge_request.diff_head_sha != pipeline.sha + log_error_message_for(merge_request) + + return + end merge_request.update_attribute(:head_pipeline_id, pipeline.id) end + + def log_error_message_for(merge_request) + Rails.logger.error( + "Outdated head pipeline for active merge request: id=#{merge_request.id}, source_branch=#{merge_request.source_branch}, diff_head_sha=#{merge_request.diff_head_sha}" + ) + end end |