Fix pipeline schedule when owner is nil

Fixing the bug
This commit is contained in:
Shinya Maeda 2019-06-11 18:03:40 +07:00
parent c327d02bd2
commit 7ac5dfc1e9
3 changed files with 14 additions and 1 deletions

View file

@ -7,7 +7,7 @@ module Ci
# Otherwise, multiple pipelines could be created in a short interval.
schedule.schedule_next_run!
RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner.id)
RunPipelineScheduleWorker.perform_async(schedule.id, schedule.owner&.id)
end
end
end

View file

@ -0,0 +1,5 @@
---
title: Fix pipeline schedules when owner is nil
merge_request:
author:
type: fixed

View file

@ -24,5 +24,13 @@ describe Ci::PipelineScheduleService do
subject
end
context 'when owner is nil' do
let(:schedule) { create(:ci_pipeline_schedule, project: project, owner: nil) }
it 'does not raise an error' do
expect { subject }.not_to raise_error
end
end
end
end