diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-28 17:10:07 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-28 17:10:07 +0000 |
commit | b8d75d41aad1e3d06bb30e1838b1e8b2b2cd8c78 (patch) | |
tree | 1dce6077fc50b31ca930c5b31fc71ac3233fa74d /lib | |
parent | 53ad9522c46edf8ede068145fa3d89e2b047c076 (diff) | |
parent | 2b8f04a669d9fb388983b6509135984588fb8306 (diff) | |
download | gitlab-ce-b8d75d41aad1e3d06bb30e1838b1e8b2b2cd8c78.tar.gz |
Merge branch 'fix/builds-api-builds-for-commit-search' into 'master'
Find all builds for commit if there are multiple pipelines for it
## What does this MR do?
This MR fixes a builds API. When multiple pipelines were triggered for a commit, then API returned builds only from the last pipeline.
## What are the relevant issue numbers?
Closes #18912
Closes #19243
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !4849
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/builds.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 979328efe0e..086d8511e8f 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -33,10 +33,10 @@ module API get ':id/repository/commits/:sha/builds' do authorize_read_builds! - commit = user_project.pipelines.find_by_sha(params[:sha]) - return not_found! unless commit + return not_found! unless user_project.commit(params[:sha]) - builds = commit.builds.order('id DESC') + pipelines = user_project.pipelines.where(sha: params[:sha]) + builds = user_project.builds.where(pipeline: pipelines).order('id DESC') builds = filter_builds(builds, params[:scope]) present paginate(builds), with: Entities::Build, |