Commit b9e3eab4 authored by Fabio Pitino's avatar Fabio Pitino

Rename config_processor to yaml_processor_result

After refactoring YamlProcessor to return a Result object
the method name `config_processor` that holds the result seems
misleading.
parent db29952b
......@@ -12,7 +12,7 @@ module Gitlab
:seeds_block, :variables_attributes, :push_options,
:chat_data, :allow_mirror_update, :bridge, :content, :dry_run,
# These attributes are set by Chains during processing:
:config_content, :config_processor, :stage_seeds
:config_content, :yaml_processor_result, :stage_seeds
) do
include Gitlab::Utils::StrongMemoize
......
......@@ -23,7 +23,7 @@ module Gitlab
add_warnings_to_pipeline(result.warnings)
if result.valid?
@command.config_processor = result
@command.yaml_processor_result = result
else
error(result.errors.first, config_error: true)
end
......
......@@ -39,7 +39,7 @@ module Gitlab
end
def workflow_config
@command.config_processor.workflow_attributes || {}
@command.yaml_processor_result.workflow_attributes || {}
end
end
end
......
......@@ -6,13 +6,13 @@ module Gitlab
module Chain
class RemoveUnwantedChatJobs < Chain::Base
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?
# When scheduling a chat pipeline we only want to run the build
# 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
end
end
......
......@@ -9,7 +9,7 @@ module Gitlab
include Gitlab::Utils::StrongMemoize
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.
pipeline.ensure_project_iid!
......@@ -56,7 +56,7 @@ module Gitlab
end
def stages_attributes
@command.config_processor.stages_attributes
@command.yaml_processor_result.stages_attributes
end
end
end
......
......@@ -51,7 +51,7 @@ module Gitlab
def validate_service_request
Gitlab::HTTP.post(
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
......
......@@ -11,7 +11,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do
let(:command) do
double(:command,
config_processor: double(:processor,
yaml_processor_result: double(:processor,
jobs: { echo: double(:job_echo), rspec: double(:job_rspec) }),
project: project,
chat_data: { command: 'echo' })
......@@ -25,7 +25,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do
subject
expect(command.config_processor.jobs.keys).to eq([:echo])
expect(command.yaml_processor_result.jobs.keys).to eq([:echo])
end
it 'does not remove any jobs for non chat-pipelines' do
......@@ -33,7 +33,7 @@ RSpec.describe ::Gitlab::Ci::Pipeline::Chain::RemoveUnwantedChatJobs do
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
......@@ -44,7 +44,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do
let(:save_incompleted) { true }
let(:command) do
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
......@@ -128,7 +128,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do
end
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
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