Commit d93c09be authored by Kamil Trzciński's avatar Kamil Trzciński

Fix `add_job_service` to also update project of metadata

In some cases `metadata` object might already be provisioned.
This ensures that metadata is properly configured.
parent d31b218a
......@@ -39,6 +39,12 @@ module Ci
job.pipeline = pipeline
job.project = pipeline.project
job.ref = pipeline.ref
# update metadata since it might have been lazily initialised before this call
# metadata is present on `Ci::Processable`
if job.respond_to?(:metadata) && job.metadata
job.metadata.project = pipeline.project
end
end
end
end
......
......@@ -31,7 +31,7 @@ RSpec.describe Ci::Pipelines::AddJobService do
execute
end.to change { job.slice(:pipeline, :project, :ref) }.to(
pipeline: pipeline, project: pipeline.project, ref: pipeline.ref
)
).and change { job.metadata.project }.to(pipeline.project)
end
it 'returns a service response with the job as payload' do
......
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