Commit 9eb3bed1 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'ce-fj-create-webide-terminal-service' into 'master'

CE port of Add new service to create the web ide terminal

See merge request gitlab-org/gitlab-ce!23514
parents 8f36de52 2a14bb06
...@@ -171,6 +171,8 @@ module Ci ...@@ -171,6 +171,8 @@ module Ci
scope :internal, -> { where(source: internal_sources) } scope :internal, -> { where(source: internal_sources) }
scope :for_user, -> (user) { where(user: user) }
# Returns the pipelines in descending order (= newest first), optionally # Returns the pipelines in descending order (= newest first), optionally
# limited to a number of references. # limited to a number of references.
# #
...@@ -496,6 +498,8 @@ module Ci ...@@ -496,6 +498,8 @@ module Ci
end end
def ci_yaml_file_path def ci_yaml_file_path
return unless repository_source? || unknown_source?
if project.ci_config_path.blank? if project.ci_config_path.blank?
'.gitlab-ci.yml' '.gitlab-ci.yml'
else else
...@@ -664,6 +668,7 @@ module Ci ...@@ -664,6 +668,7 @@ module Ci
def ci_yaml_from_repo def ci_yaml_from_repo
return unless project return unless project
return unless sha return unless sha
return unless ci_yaml_file_path
project.repository.gitlab_ci_yml_for(sha, ci_yaml_file_path) project.repository.gitlab_ci_yml_for(sha, ci_yaml_file_path)
rescue GRPC::NotFound, GRPC::Internal rescue GRPC::NotFound, GRPC::Internal
......
...@@ -1249,6 +1249,12 @@ describe Ci::Pipeline, :mailer do ...@@ -1249,6 +1249,12 @@ describe Ci::Pipeline, :mailer do
describe '#ci_yaml_file_path' do describe '#ci_yaml_file_path' do
subject { pipeline.ci_yaml_file_path } subject { pipeline.ci_yaml_file_path }
%i[unknown_source repository_source].each do |source|
context source.to_s do
before do
pipeline.config_source = described_class.config_sources.fetch(source)
end
it 'returns the path from project' do it 'returns the path from project' do
allow(pipeline.project).to receive(:ci_config_path) { 'custom/path' } allow(pipeline.project).to receive(:ci_config_path) { 'custom/path' }
...@@ -1267,6 +1273,18 @@ describe Ci::Pipeline, :mailer do ...@@ -1267,6 +1273,18 @@ describe Ci::Pipeline, :mailer do
is_expected.to eq('.gitlab-ci.yml') is_expected.to eq('.gitlab-ci.yml')
end end
end end
end
context 'when pipeline is for auto-devops' do
before do
pipeline.config_source = 'auto_devops_source'
end
it 'does not return config file' do
is_expected.to be_nil
end
end
end
describe '#set_config_source' do describe '#set_config_source' do
context 'when pipelines does not contain needed data and auto devops is disabled' do context 'when pipelines does not contain needed data and auto devops is disabled' do
......
...@@ -11,6 +11,7 @@ describe PipelineScheduleWorker do ...@@ -11,6 +11,7 @@ describe PipelineScheduleWorker do
end end
before do before do
stub_application_setting(auto_devops_enabled: false)
stub_ci_pipeline_to_return_yaml_file stub_ci_pipeline_to_return_yaml_file
pipeline_schedule.update_column(:next_run_at, 1.day.ago) pipeline_schedule.update_column(:next_run_at, 1.day.ago)
......
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