Commit 73b04beb authored by Kamil Trzcinski's avatar Kamil Trzcinski

Fix errors

parent 2b7a75ce
...@@ -81,8 +81,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -81,8 +81,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def builds def builds
@ci_project = @merge_request.source_project.gitlab_ci_project
respond_to do |format| respond_to do |format|
format.html { render 'show' } format.html { render 'show' }
format.json { render json: { html: view_to_html_string('projects/merge_requests/show/_builds') } } format.json { render json: { html: view_to_html_string('projects/merge_requests/show/_builds') } }
...@@ -106,7 +104,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -106,7 +104,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@first_commit = @merge_request.first_commit @first_commit = @merge_request.first_commit
@diffs = @merge_request.compare_diffs @diffs = @merge_request.compare_diffs
@ci_project = @source_project.gitlab_ci_project
@ci_commit = @merge_request.ci_commit @ci_commit = @merge_request.ci_commit
@statuses = @ci_commit.statuses if @ci_commit @statuses = @ci_commit.statuses if @ci_commit
......
...@@ -77,7 +77,7 @@ class CommitStatus < ActiveRecord::Base ...@@ -77,7 +77,7 @@ class CommitStatus < ActiveRecord::Base
end end
after_transition [:pending, :running] => :success do |build, transition| after_transition [:pending, :running] => :success do |build, transition|
MergeRequests::MergeWhenBuildSucceedsService.new(build.commit.gl_project, nil).trigger(build) MergeRequests::MergeWhenBuildSucceedsService.new(build.commit.project, nil).trigger(build)
end end
state :pending, value: 'pending' state :pending, value: 'pending'
......
...@@ -26,4 +26,3 @@ class CreateCommitBuildsService ...@@ -26,4 +26,3 @@ class CreateCommitBuildsService
commit commit
end end
end end
.gray-content-block.middle-block .gray-content-block.middle-block
.pull-right .pull-right
- if @ci_project && can?(current_user, :manage_builds, @ci_commit.project) - if can?(current_user, :manage_builds, @ci_commit.project)
- if @ci_commit.builds.latest.failed.any?(&:retryable?) - if @ci_commit.builds.latest.failed.any?(&:retryable?)
= link_to "Retry failed", retry_builds_namespace_project_commit_path(@ci_commit.project.namespace, @ci_commit.project, @ci_commit.sha), class: 'btn btn-grouped btn-primary', method: :post = link_to "Retry failed", retry_builds_namespace_project_commit_path(@ci_commit.project.namespace, @ci_commit.project, @ci_commit.sha), class: 'btn btn-grouped btn-primary', method: :post
......
...@@ -12,7 +12,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -12,7 +12,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
end end
context "Active build for Merge Request" do context "Active build for Merge Request" do
let!(:ci_commit) { create(:ci_commit, gl_project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } let!(:ci_commit) { create(:ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) }
let!(:ci_build) { create(:ci_build, commit: ci_commit) } let!(:ci_build) { create(:ci_build, commit: ci_commit) }
before do before do
...@@ -47,7 +47,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do ...@@ -47,7 +47,7 @@ feature 'Merge When Build Succeeds', feature: true, js: true do
merge_user: user, title: "MepMep", merge_when_build_succeeds: true) merge_user: user, title: "MepMep", merge_when_build_succeeds: true)
end end
let!(:ci_commit) { create(:ci_commit, gl_project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) } let!(:ci_commit) { create(:ci_commit, project: project, sha: merge_request.last_commit.id, ref: merge_request.source_branch) }
let!(:ci_build) { create(:ci_build, commit: ci_commit) } let!(:ci_build) { create(:ci_build, commit: ci_commit) }
before do before do
......
...@@ -168,4 +168,3 @@ describe CreateCommitBuildsService, services: true do ...@@ -168,4 +168,3 @@ describe CreateCommitBuildsService, services: true do
end end
end end
end end
...@@ -11,7 +11,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do ...@@ -11,7 +11,7 @@ describe MergeRequests::MergeWhenBuildSucceedsService do
end end
let(:project) { create(:project) } let(:project) { create(:project) }
let(:ci_commit) { create(:ci_commit_with_one_job, ref: mr_merge_if_green_enabled.source_branch, gl_project: project) } let(:ci_commit) { create(:ci_commit_with_one_job, ref: mr_merge_if_green_enabled.source_branch, project: project) }
let(:service) { MergeRequests::MergeWhenBuildSucceedsService.new(project, user, commit_message: 'Awesome message') } let(:service) { MergeRequests::MergeWhenBuildSucceedsService.new(project, user, commit_message: 'Awesome message') }
describe "#execute" do describe "#execute" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment