Commit 4ad8f12e authored by Grzegorz Bizon's avatar Grzegorz Bizon Committed by Rémy Coutable
Browse files

Fix editing project with container images present

parent fba2e2ca950d
......@@ -5,7 +5,7 @@ def execute
return error('New visibility level not allowed!')
end
if project.has_container_registry_tags?
if renaming_project_with_container_registry_tags?
return error('Cannot rename project because it contains container registry tags!')
end
......@@ -44,6 +44,13 @@ def visibility_level_allowed?
true
end
def renaming_project_with_container_registry_tags?
new_path = params[:path]
new_path && new_path != project.path &&
project.has_container_registry_tags?
end
def changing_default_branch?
new_branch = params[:default_branch]
......
---
title: Fix editing project with container images present
merge_request: 13028
author:
......@@ -103,7 +103,7 @@
end
end
context 'when renaming project that contains container images' do
context 'when updating a project that contains container images' do
before do
stub_container_registry_config(enabled: true)
stub_container_registry_tags(repository: /image/, tags: %w[rc1])
......@@ -116,6 +116,13 @@
expect(result).to include(status: :error)
expect(result[:message]).to match(/contains container registry tags/)
end
it 'allows to update other settings' do
result = update_project(project, admin, public_builds: true)
expect(result[:status]).to eq :success
expect(project.reload.public_builds).to be true
end
end
context 'when passing invalid parameters' 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