Skip to content
Snippets Groups Projects
Commit 636d7038 authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

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
parents 9ca8d88b 291dc5a2
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
Loading
Loading
---
title: Check for nil AutoDevOps when saving project CI/CD settings.
merge_request: 19190
author:
type: fixed
Loading
Loading
@@ -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
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment