Merge branch '46452-nomethoderror-undefined-method-previous_changes-for-nil-nilclass' into 'master'
Resolve "NoMethodError: undefined method `previous_changes' for nil:NilClass" Closes #46452 See merge request gitlab-org/gitlab-ce!19190
This commit is contained in:
commit
636d70381e
|
@ -38,7 +38,7 @@ module Projects
|
|||
end
|
||||
|
||||
def run_auto_devops_pipeline?
|
||||
return false if project.repository.gitlab_ci_yml || !project.auto_devops.previous_changes.include?('enabled')
|
||||
return false if project.repository.gitlab_ci_yml || !project.auto_devops&.previous_changes&.include?('enabled')
|
||||
|
||||
project.auto_devops.enabled? || (project.auto_devops.enabled.nil? && Gitlab::CurrentSettings.auto_devops_enabled?)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Check for nil AutoDevOps when saving project CI/CD settings.
|
||||
merge_request: 19190
|
||||
author:
|
||||
type: fixed
|
|
@ -275,6 +275,10 @@ describe Projects::UpdateService do
|
|||
it { is_expected.to eq(false) }
|
||||
end
|
||||
|
||||
context 'when auto devops is nil' do
|
||||
it { is_expected.to eq(false) }
|
||||
end
|
||||
|
||||
context 'when auto devops is explicitly enabled' do
|
||||
before do
|
||||
project.create_auto_devops!(enabled: true)
|
||||
|
|
Loading…
Reference in New Issue