Commit c58c97cc authored by Robert Speicher's avatar Robert Speicher

Merge branch...

Merge branch '197130-using-the-web-ide-web-terminal-leads-to-error-500-when-accessing-the-dashboard-projects-list' into 'master'

Resolve "Using the Web IDE Web Terminal leads to error 500 when accessing the dashboard/projects list"

Closes #197130

See merge request gitlab-org/gitlab!24443
parents a644e7d0 bfb09b56
......@@ -185,7 +185,7 @@ module Ci
pipeline.run_after_commit do
PipelineHooksWorker.perform_async(pipeline.id)
ExpirePipelineCacheWorker.perform_async(pipeline.id)
ExpirePipelineCacheWorker.perform_async(pipeline.id) if pipeline.cacheable?
end
end
......@@ -902,6 +902,10 @@ module Ci
statuses.latest.success.where(name: names).pluck(:id)
end
def cacheable?
Ci::PipelineEnums.ci_config_sources.key?(config_source.to_sym)
end
private
def pipeline_data
......
......@@ -46,13 +46,18 @@ module Ci
}
end
def self.ci_config_sources_values
config_sources.values_at(
def self.ci_config_sources
config_sources.slice(
:unknown_source,
:repository_source,
:auto_devops_source,
:remote_source,
:external_project_source)
:external_project_source
)
end
def self.ci_config_sources_values
ci_config_sources.values
end
end
end
......
......@@ -32,7 +32,7 @@ class BuildFinishedWorker
# We execute these async as these are independent operations.
BuildHooksWorker.perform_async(build.id)
ArchiveTraceWorker.perform_async(build.id)
ExpirePipelineCacheWorker.perform_async(build.pipeline_id)
ExpirePipelineCacheWorker.perform_async(build.pipeline_id) if build.pipeline.cacheable?
ChatNotificationWorker.perform_async(build.id) if build.pipeline.chat?
end
end
......
......@@ -11,7 +11,7 @@ class ExpirePipelineCacheWorker
# rubocop: disable CodeReuse/ActiveRecord
def perform(pipeline_id)
pipeline = Ci::Pipeline.find_by(id: pipeline_id)
return unless pipeline
return unless pipeline&.cacheable?
Ci::ExpirePipelineCacheService.new.execute(pipeline)
end
......
---
title: Resolve 500 error after Web IDE terminal use
merge_request: 24443
author:
type: fixed
......@@ -373,6 +373,18 @@ describe Ci::Pipeline do
end
end
end
context 'when pipeline is web terminal triggered' do
before do
pipeline.config_source = 'webide_source'
end
it 'does not schedule the pipeline cache worker' do
expect(ExpirePipelineCacheWorker).not_to receive(:perform_async)
pipeline.cancel!
end
end
end
describe '#latest_merge_request_pipeline?' do
......
......@@ -3,10 +3,7 @@
module QA
# This test was quarantined because relative URL isn't supported
# See https://gitlab.com/gitlab-org/gitlab/issues/13833
# It's now skipped because another bug breaks the projects list and
# causes subsequent tests to fail
# See https://gitlab.com/gitlab-org/gitlab/issues/197130
context 'Create', :skip do
context 'Create', :quarantine do
describe 'Web IDE web terminal', :docker do
before do
project = Resource::Project.fabricate_via_api! do |project|
......
......@@ -1117,6 +1117,10 @@ describe Ci::Pipeline, :mailer do
end
describe 'pipeline caching' do
before do
pipeline.config_source = 'repository_source'
end
it 'performs ExpirePipelinesCacheWorker' do
expect(ExpirePipelineCacheWorker).to receive(:perform_async).with(pipeline.id)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe ExpirePipelineCacheWorker do
let(:user) { create(:user) }
let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
subject { described_class.new }
......@@ -22,5 +22,14 @@ describe ExpirePipelineCacheWorker do
subject.perform(617748)
end
it "doesn't do anything if the pipeline cannot be cached" do
allow_any_instance_of(Ci::Pipeline).to receive(:cacheable?).and_return(false)
expect_any_instance_of(Ci::ExpirePipelineCacheService).not_to receive(:execute)
expect_any_instance_of(Gitlab::EtagCaching::Store).not_to receive(:touch)
subject.perform(pipeline.id)
end
end
end
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