Abstract persisted/legacy stages in pipeline model
This commit is contained in:
parent
fb706d69ab
commit
76a7157c76
|
@ -1,5 +1,5 @@
|
|||
class Projects::PipelinesController < Projects::ApplicationController
|
||||
# before_action :whitelist_query_limiting, only: [:create, :retry]
|
||||
before_action :whitelist_query_limiting, only: [:create, :retry] # TODO?
|
||||
before_action :pipeline, except: [:index, :new, :create, :charts]
|
||||
before_action :commit, only: [:show, :builds, :failures]
|
||||
before_action :authorize_read_pipeline!
|
||||
|
|
|
@ -249,6 +249,16 @@ module Ci
|
|||
stage unless stage.statuses_count.zero?
|
||||
end
|
||||
|
||||
##
|
||||
# TODO consider switching to persisted stages only in pipelines table
|
||||
# (not necessairly in the show pipeline page because of #23257.
|
||||
# Hide this behind two feature flags - enabled / disabled and only
|
||||
# gitlab-ce / everywhere.
|
||||
#
|
||||
def stages
|
||||
super
|
||||
end
|
||||
|
||||
def legacy_stages
|
||||
# TODO, this needs refactoring, see gitlab-ce#26481.
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
class PipelineDetailsEntity < PipelineEntity
|
||||
expose :details do
|
||||
##
|
||||
# TODO consider switching to persisted stages only in pipelines table
|
||||
# (not necessairly in the show pipeline page because of #23257.
|
||||
# Hide this behind two feature flags - enabled / disabled and only
|
||||
# gitlab-ce / everywhere.
|
||||
expose :stages, as: :stages, using: StageEntity
|
||||
expose :stages, using: StageEntity
|
||||
expose :artifacts, using: BuildArtifactEntity
|
||||
expose :manual_actions, using: BuildActionEntity
|
||||
end
|
||||
|
|
|
@ -17,8 +17,7 @@ describe Projects::PipelinesController do
|
|||
|
||||
describe 'GET index.json' do
|
||||
before do
|
||||
%w(pending running running success canceled)
|
||||
.each_with_index do |status, index|
|
||||
%w(pending running success failed).each_with_index do |status, index|
|
||||
create_pipeline(status, project.commit("HEAD~#{index}"))
|
||||
end
|
||||
end
|
||||
|
@ -32,11 +31,13 @@ describe Projects::PipelinesController do
|
|||
expect(response).to match_response_schema('pipeline')
|
||||
|
||||
expect(json_response).to include('pipelines')
|
||||
expect(json_response['pipelines'].count).to eq 5
|
||||
expect(json_response['count']['all']).to eq '5'
|
||||
expect(json_response['count']['running']).to eq '2'
|
||||
expect(json_response['pipelines'].count).to eq 4
|
||||
expect(json_response['count']['all']).to eq '4'
|
||||
expect(json_response['count']['running']).to eq '1'
|
||||
expect(json_response['count']['pending']).to eq '1'
|
||||
expect(json_response['count']['finished']).to eq '2'
|
||||
puts queries.log
|
||||
puts "Queries count: #{queries.count}"
|
||||
expect(queries.count).to be < 32
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue