Commit 4270e31c authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'rename-config-processor-in-ci-command' into 'master'

Rename config_processor in Chain::Command

See merge request gitlab-org/gitlab!40951
parents 23ae6a9b b9e3eab4
...@@ -12,7 +12,7 @@ module Gitlab ...@@ -12,7 +12,7 @@ module Gitlab
:seeds_block, :variables_attributes, :push_options, :seeds_block, :variables_attributes, :push_options,
:chat_data, :allow_mirror_update, :bridge, :content, :dry_run, :chat_data, :allow_mirror_update, :bridge, :content, :dry_run,
# These attributes are set by Chains during processing: # These attributes are set by Chains during processing:
:config_content, :config_processor, :stage_seeds :config_content, :yaml_processor_result, :stage_seeds
) do ) do
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
...@@ -23,7 +23,7 @@ module Gitlab ...@@ -23,7 +23,7 @@ module Gitlab
add_warnings_to_pipeline(result.warnings) add_warnings_to_pipeline(result.warnings)
if result.valid? if result.valid?
@command.config_processor = result @command.yaml_processor_result = result
else else
error(result.errors.first, config_error: true) error(result.errors.first, config_error: true)
end end
......
...@@ -39,7 +39,7 @@ module Gitlab ...@@ -39,7 +39,7 @@ module Gitlab
end end
def workflow_config def workflow_config
@command.config_processor.workflow_attributes || {} @command.yaml_processor_result.workflow_attributes || {}
end end
end end
end end
......
...@@ -6,13 +6,13 @@ module Gitlab ...@@ -6,13 +6,13 @@ module Gitlab
module Chain module Chain
class RemoveUnwantedChatJobs < Chain::Base class RemoveUnwantedChatJobs < Chain::Base
def perform! def perform!
raise ArgumentError, 'missing config processor' unless @command.config_processor raise ArgumentError, 'missing YAML processor result' unless @command.yaml_processor_result
return unless pipeline.chat? return unless pipeline.chat?
# When scheduling a chat pipeline we only want to run the build # When scheduling a chat pipeline we only want to run the build
# that matches the chat command. # that matches the chat command.
@command.config_processor.jobs.select! do |name, _| @command.yaml_processor_result.jobs.select! do |name, _|
name.to_s == command.chat_data[:command].to_s name.to_s == command.chat_data[:command].to_s
end end
end end
......
...@@ -9,7 +9,7 @@ module Gitlab ...@@ -9,7 +9,7 @@ module Gitlab
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
def perform! def perform!
raise ArgumentError, 'missing config processor' unless @command.config_processor raise ArgumentError, 'missing YAML processor result' unless @command.yaml_processor_result
# Allocate next IID. This operation must be outside of transactions of pipeline creations. # Allocate next IID. This operation must be outside of transactions of pipeline creations.
pipeline.ensure_project_iid! pipeline.ensure_project_iid!
...@@ -56,7 +56,7 @@ module Gitlab ...@@ -56,7 +56,7 @@ module Gitlab
end end
def stages_attributes def stages_attributes
@command.config_processor.stages_attributes @command.yaml_processor_result.stages_attributes
end end
end end
end end
......
...@@ -51,7 +51,7 @@ module Gitlab ...@@ -51,7 +51,7 @@ module Gitlab
def validate_service_request def validate_service_request
Gitlab::HTTP.post( Gitlab::HTTP.post(
validation_service_url, timeout: VALIDATION_REQUEST_TIMEOUT, validation_service_url, timeout: VALIDATION_REQUEST_TIMEOUT,
body: validation_service_payload(@pipeline, @command.config_processor.stages_attributes) body: validation_service_payload(@pipeline, @command.yaml_processor_result.stages_attributes)
) )
end end
......
...@@ -11,7 +11,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do ...@@ -11,7 +11,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do
let(:command) do let(:command) do
double(:command, double(:command,
config_processor: double(:processor, yaml_processor_result: double(:processor,
jobs: { echo: double(:job_echo), rspec: double(:job_rspec) }), jobs: { echo: double(:job_echo), rspec: double(:job_rspec) }),
project: project, project: project,
chat_data: { command: 'echo' }) chat_data: { command: 'echo' })
...@@ -25,7 +25,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do ...@@ -25,7 +25,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do
subject subject
expect(command.config_processor.jobs.keys).to eq([:echo]) expect(command.yaml_processor_result.jobs.keys).to eq([:echo])
end end
it 'does not remove any jobs for non chat-pipelines' do it 'does not remove any jobs for non chat-pipelines' do
...@@ -33,7 +33,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do ...@@ -33,7 +33,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do
subject subject
expect(command.config_processor.jobs.keys).to eq([:echo, :rspec]) expect(command.yaml_processor_result.jobs.keys).to eq([:echo, :rspec])
end end
end end
end end
...@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do ...@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do
let(:save_incompleted) { true } let(:save_incompleted) { true }
let(:command) do let(:command) do
Gitlab::Ci::Pipeline::Chain::Command.new( Gitlab::Ci::Pipeline::Chain::Command.new(
project: project, current_user: user, config_processor: yaml_processor_result, save_incompleted: save_incompleted project: project, current_user: user, yaml_processor_result: yaml_processor_result, save_incompleted: save_incompleted
) )
end end
...@@ -128,7 +128,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do ...@@ -128,7 +128,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do
end end
describe '#validation_service_payload' do describe '#validation_service_payload' do
subject(:validation_service_payload) { step.send(:validation_service_payload, pipeline, command.config_processor.stages_attributes) } subject(:validation_service_payload) { step.send(:validation_service_payload, pipeline, command.yaml_processor_result.stages_attributes) }
it 'respects the defined schema' do it 'respects the defined schema' do
expect(validation_service_payload).to match_schema('/external_validation') expect(validation_service_payload).to match_schema('/external_validation')
......
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