diff options
author | Kamil Trzciński (OoO till 3th) <ayufan@ayufan.eu> | 2018-07-04 09:17:42 +0000 |
---|---|---|
committer | Kamil Trzciński (OoO till 3th) <ayufan@ayufan.eu> | 2018-07-04 09:17:42 +0000 |
commit | 391710f29d1e82dafb3244691d541573a21acda2 (patch) | |
tree | 765a5c3ea38387222e81cefbaf1fbe141ef57281 | |
parent | 5714e57b1338ed2b1893b85d31e6119102de1859 (diff) | |
parent | 1d3dbe461283a75d91029bd4ab276284cdef1be0 (diff) | |
download | gitlab-ce-391710f29d1e82dafb3244691d541573a21acda2.tar.gz |
Merge branch '47040-inconsistent-job-list-in-job-details-view' into 'master'
Resolve "Inconsistent job list in job details view"
Closes #47040
See merge request gitlab-org/gitlab-ce!20243
3 files changed, 16 insertions, 4 deletions
diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb index 63f0aea3195..02cac862c3d 100644 --- a/app/controllers/projects/jobs_controller.rb +++ b/app/controllers/projects/jobs_controller.rb @@ -44,12 +44,10 @@ class Projects::JobsController < Projects::ApplicationController end def show - @builds = @project.pipelines - .find_by_sha(@build.sha) - .builds + @pipeline = @build.pipeline + @builds = @pipeline.builds .order('id DESC') .present(current_user: current_user) - @pipeline = @build.pipeline respond_to do |format| format.html diff --git a/changelogs/unreleased/47040-inconsistent-job-list-in-job-details-view.yml b/changelogs/unreleased/47040-inconsistent-job-list-in-job-details-view.yml new file mode 100644 index 00000000000..5629a40a1f1 --- /dev/null +++ b/changelogs/unreleased/47040-inconsistent-job-list-in-job-details-view.yml @@ -0,0 +1,5 @@ +--- +title: Show jobs from same pipeline in sidebar in job details view. +merge_request: 20243 +author: +type: fixed diff --git a/spec/controllers/projects/jobs_controller_spec.rb b/spec/controllers/projects/jobs_controller_spec.rb index 06c8a432561..b10421b8f26 100644 --- a/spec/controllers/projects/jobs_controller_spec.rb +++ b/spec/controllers/projects/jobs_controller_spec.rb @@ -102,6 +102,8 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do describe 'GET show' do let!(:job) { create(:ci_build, :failed, pipeline: pipeline) } + let!(:second_job) { create(:ci_build, :failed, pipeline: pipeline) } + let!(:third_job) { create(:ci_build, :failed) } context 'when requesting HTML' do context 'when job exists' do @@ -113,6 +115,13 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do expect(response).to have_gitlab_http_status(:ok) expect(assigns(:build).id).to eq(job.id) end + + it 'has the correct build collection' do + builds = assigns(:builds).map(&:id) + + expect(builds).to include(job.id, second_job.id) + expect(builds).not_to include(third_job.id) + end end context 'when job does not exist' do |