Skip to content

Reduce Gitaly calls in BuildHooksWorker

Stan Hu requested to merge sh-reduce-gitaly-calls-in-ci-build into master

Ci::Build.execute_hooks always made Gitaly calls regardless of whether a project had any hooks or services. Now we lazily only perform these calls only if there are active hooks or services.

This is similar to what we did for PostReceive in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31741/diffs.

Relates to https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/8407

This also fixes some failing specs. When the hooks were present, ListCommitsByOid would be called before to create the serialized build data. When hooks are disabled, this RPC is called lazily, so it is done when the build is serialized by the controller.

Edited by Stan Hu

Merge request reports