ActiveRecord::StaleObjectError: Attempted to update a stale object: Ci::Build

This seems to be problem with Optimistic Locking and concurrent access to Ci::Build:

  1. We update status,
  2. We upload artifacts.

We should limit optimistic locking only to status change.

https://sentry.gitlap.com/gitlab/gitlabcom/issues/23926/

ActiveRecord::StaleObjectError: Attempted to update a stale object: Ci::Build
  config/initializers/ar_monkey_patch.rb:44:in `_update_record'
    raise ActiveRecord::StaleObjectError.new(self, "update")
  lib/ci/api/builds.rb:73:in `block (2 levels) in <class:Builds>'
    build.drop
  lib/gitlab/middleware/multipart.rb:93:in `call'
    return @app.call(env) if encoded_message.blank?
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
    @app.call(env)
  lib/gitlab/middleware/go.rb:16:in `call'
    @app.call(env)
...
(191 additional frame(s) were not displayed)

ActiveRecord::StaleObjectError: Attempted to update a stale object: Ci::Build