Commit 08baa998 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Use pipelines in context of Project

parent 0a51c954
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
- if @commit.status - if @commit.status
.commit-info-row .commit-info-row
Builds for Builds for
= pluralize(@commit.ci_commits.count, 'pipeline') = pluralize(@commit.pipelines.count, 'pipeline')
= link_to builds_namespace_project_commit_path(@project.namespace, @project, @commit.id), class: "ci-status-link ci-status-icon-#{@commit.status}" do = link_to builds_namespace_project_commit_path(@project.namespace, @project, @commit.id), class: "ci-status-link ci-status-icon-#{@commit.status}" do
= ci_icon_for_status(@commit.status) = ci_icon_for_status(@commit.status)
= ci_label_for_status(@commit.status) = ci_label_for_status(@commit.status)
- if @commit.ci_commits.duration - if @commit.pipelines.duration
in in
= time_interval_in_words @commit.ci_commits.duration = time_interval_in_words @commit.pipelines.duration
.commit-box.content-block .commit-box.content-block
%h3.commit-title %h3.commit-title
......
...@@ -16,4 +16,4 @@ ...@@ -16,4 +16,4 @@
%li %li
Commits covered: Commits covered:
%strong %strong
= @project.ci_commits.count(:all) = @project.pipelines.count(:all)
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
- @merge_requests.each do |merge_request| - @merge_requests.each do |merge_request|
%li %li
%span.merge-request-ci-status %span.merge-request-ci-status
- if merge_request.ci_commit - if merge_request.pipeline
= render_pipeline_status(merge_request.ci_commit) = render_pipeline_status(merge_request.pipeline)
- elsif has_any_ci - elsif has_any_ci
= icon('blank fw') = icon('blank fw')
%span.merge-request-id %span.merge-request-id
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
- @related_branches.each do |branch| - @related_branches.each do |branch|
%li %li
- sha = @project.repository.find_branch(branch).target - sha = @project.repository.find_branch(branch).target
- ci_commit = @project.ci_commit(sha, branch) if sha - pipeline = @project.pipeline(sha, branch) if sha
- if ci_commit - if ci_copipelinemmit
%span.related-branch-ci-status %span.related-branch-ci-status
= render_pipeline_status(ci_commit) = render_pipeline_status(pipeline)
%span.related-branch-info %span.related-branch-info
%strong %strong
= link_to namespace_project_compare_path(@project.namespace, @project, from: @project.default_branch, to: branch), class: "label-branch" do = link_to namespace_project_compare_path(@project.namespace, @project, from: @project.default_branch, to: branch), class: "label-branch" do
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
= icon('ban') = icon('ban')
CLOSED CLOSED
- if merge_request.ci_commit - if merge_request.pipeline
%li %li
= render_pipeline_status(merge_request.ci_commit) = render_pipeline_status(merge_request.pipeline)
- if merge_request.open? && merge_request.broken? - if merge_request.open? && merge_request.broken?
%li %li
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
check_enable: #{@merge_request.unchecked? ? "true" : "false"}, check_enable: #{@merge_request.unchecked? ? "true" : "false"},
ci_status_url: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}", ci_status_url: "#{ci_status_namespace_project_merge_request_path(@project.namespace, @project, @merge_request)}",
gitlab_icon: "#{asset_path 'gitlab_logo.png'}", gitlab_icon: "#{asset_path 'gitlab_logo.png'}",
ci_status: "#{@merge_request.ci_commit ? @merge_request.ci_commit.status : ''}", ci_status: "#{@merge_request.pipeline ? @merge_request.pipeline.status : ''}",
ci_message: { ci_message: {
normal: "Build {{status}} for \"{{title}}\"", normal: "Build {{status}} for \"{{title}}\"",
preparing: "{{status}} build for \"{{title}}\"" preparing: "{{status}} build for \"{{title}}\""
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do = link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
%span %span
Pipelines Pipelines
%span.badge.count.ci_counter= number_with_delimiter(@project.ci_commits.running_or_pending.count) %span.badge.count.ci_counter= number_with_delimiter(@project.pipelines.running_or_pending.count)
- if project_nav_tab? :builds - if project_nav_tab? :builds
= nav_link(controller: %w(builds)) do = nav_link(controller: %w(builds)) do
......
...@@ -19,7 +19,7 @@ class Gitlab::Seeder::Builds ...@@ -19,7 +19,7 @@ class Gitlab::Seeder::Builds
commits = @project.repository.commits('master', nil, 5) commits = @project.repository.commits('master', nil, 5)
commits_sha = commits.map { |commit| commit.raw.id } commits_sha = commits.map { |commit| commit.raw.id }
commits_sha.map do |sha| commits_sha.map do |sha|
@project.ensure_ci_commit(sha, 'master') @project.ensure_pipeline(sha, 'master')
end end
rescue rescue
[] []
......
...@@ -33,7 +33,7 @@ module API ...@@ -33,7 +33,7 @@ module API
get ':id/repository/commits/:sha/builds' do get ':id/repository/commits/:sha/builds' do
authorize_read_builds! authorize_read_builds!
commit = user_project.ci_commits.find_by_sha(params[:sha]) commit = user_project.pipelines.find_by_sha(params[:sha])
return not_found! unless commit return not_found! unless commit
builds = commit.builds.order('id DESC') builds = commit.builds.order('id DESC')
......
...@@ -22,7 +22,7 @@ module API ...@@ -22,7 +22,7 @@ module API
not_found!('Commit') unless user_project.commit(params[:sha]) not_found!('Commit') unless user_project.commit(params[:sha])
ci_commits = user_project.ci_commits.where(sha: params[:sha]) ci_commits = user_project.pipelines.where(sha: params[:sha])
statuses = ::CommitStatus.where(commit: ci_commits) statuses = ::CommitStatus.where(commit: ci_commits)
statuses = statuses.latest unless parse_boolean(params[:all]) statuses = statuses.latest unless parse_boolean(params[:all])
statuses = statuses.where(ref: params[:ref]) if params[:ref].present? statuses = statuses.where(ref: params[:ref]) if params[:ref].present?
...@@ -64,7 +64,7 @@ module API ...@@ -64,7 +64,7 @@ module API
ref = branches.first ref = branches.first
end end
ci_commit = @project.ensure_ci_commit(commit.sha, ref) ci_commit = @project.ensure_pipeline(commit.sha, ref)
name = params[:name] || params[:context] name = params[:name] || params[:context]
status = GenericCommitStatus.running_or_pending.find_by(commit: ci_commit, name: name, ref: params[:ref]) status = GenericCommitStatus.running_or_pending.find_by(commit: ci_commit, name: name, ref: params[:ref])
......
...@@ -59,7 +59,7 @@ describe API::API, api: true do ...@@ -59,7 +59,7 @@ describe API::API, api: true do
describe 'GET /projects/:id/repository/commits/:sha/builds' do describe 'GET /projects/:id/repository/commits/:sha/builds' do
before do before do
project.ensure_ci_commit(commit.sha, 'master') project.ensure_pipeline(commit.sha, 'master')
get api("/projects/#{project.id}/repository/commits/#{commit.sha}/builds", api_user) get api("/projects/#{project.id}/repository/commits/#{commit.sha}/builds", api_user)
end end
......
...@@ -90,7 +90,7 @@ describe API::API, api: true do ...@@ -90,7 +90,7 @@ describe API::API, api: true do
end end
it "should return status for CI" do it "should return status for CI" do
ci_commit = project.ensure_ci_commit(project.repository.commit.sha, 'master') ci_commit = project.ensure_pipeline(project.repository.commit.sha, 'master')
get api("/projects/#{project.id}/repository/commits/#{project.repository.commit.id}", user) get api("/projects/#{project.id}/repository/commits/#{project.repository.commit.id}", user)
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(json_response['status']).to eq(ci_commit.status) expect(json_response['status']).to eq(ci_commit.status)
......
...@@ -5,7 +5,7 @@ module Ci ...@@ -5,7 +5,7 @@ module Ci
let(:service) { ImageForBuildService.new } let(:service) { ImageForBuildService.new }
let(:project) { FactoryGirl.create(:empty_project) } let(:project) { FactoryGirl.create(:empty_project) }
let(:commit_sha) { '01234567890123456789' } let(:commit_sha) { '01234567890123456789' }
let(:commit) { project.ensure_ci_commit(commit_sha, 'master') } let(:commit) { project.ensure_pipeline(commit_sha, 'master') }
let(:build) { FactoryGirl.create(:ci_build, pipeline: commit) } let(:build) { FactoryGirl.create(:ci_build, pipeline: commit) }
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