diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2018-03-21 19:08:56 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2018-03-22 17:39:20 +0300 |
commit | 04b8e00feb6a06bfef3903a9e03d24296c4734a6 (patch) | |
tree | ef7e3267da40bb33db73d285fd14c26ed4661e2d | |
parent | 22fc4863d33ad68ab65cd74182741e9a7e6d316f (diff) |
Use porcelain commit lookup method on CI::CreatePipelineService
Before we were using a "plumbing" Gitlab::Git method that does not go
through Gitaly migration checking.
-rw-r--r-- | app/services/ci/create_pipeline_service.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/ci-pipeline-commit-lookup.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb index 3b3d9239086..ad27f320853 100644 --- a/app/services/ci/create_pipeline_service.rb +++ b/app/services/ci/create_pipeline_service.rb @@ -65,7 +65,7 @@ module Ci project.pipelines .where(ref: pipeline.ref) .where.not(id: pipeline.id) - .where.not(sha: project.repository.sha_from_ref(pipeline.ref)) + .where.not(sha: project.commit(pipeline.ref).try(:id)) .created_or_pending end diff --git a/changelogs/unreleased/ci-pipeline-commit-lookup.yml b/changelogs/unreleased/ci-pipeline-commit-lookup.yml new file mode 100644 index 00000000000..b2a1e4c2163 --- /dev/null +++ b/changelogs/unreleased/ci-pipeline-commit-lookup.yml @@ -0,0 +1,5 @@ +--- +title: Use porcelain commit lookup method on CI::CreatePipelineService +merge_request: 17911 +author: +type: fixed diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 208710b0935..c15c128507d 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -516,10 +516,6 @@ module Gitlab end end - def sha_from_ref(ref) - rev_parse_target(ref).oid - end - # Return the object that +revspec+ points to. If +revspec+ is an # annotated tag, then return the tag's target instead. def rev_parse_target(revspec) @@ -2409,6 +2405,10 @@ module Gitlab def rev_list_param(spec) spec == :all ? ['--all'] : spec end + + def sha_from_ref(ref) + rev_parse_target(ref).oid + end end end end |