File tree 3 files changed +24
-0
lines changed
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,10 @@ def move_dir
127
127
# Ensure old directory exists before moving it
128
128
gitlab_shell . add_namespace ( path_was )
129
129
130
+ if any_project_has_container_registry_tags?
131
+ raise Exception . new ( 'namespace cannot be moved, because at least one project has tags in container registry' )
132
+ end
133
+
130
134
if gitlab_shell . mv_namespace ( path_was , path )
131
135
Gitlab ::UploadsTransfer . new . rename_namespace ( path_was , path )
132
136
@@ -148,6 +152,10 @@ def move_dir
148
152
end
149
153
end
150
154
155
+ def any_project_has_container_registry_tags?
156
+ projects . any? ( :has_container_registry_tags? )
157
+ end
158
+
151
159
def send_update_instructions
152
160
projects . each do |project |
153
161
project . send_move_instructions ( "#{ path_was } /#{ project . path } " )
Original file line number Diff line number Diff line change @@ -391,6 +391,12 @@ def container_registry_repository_url
391
391
end
392
392
end
393
393
394
+ def has_container_registry_tags?
395
+ if container_registry_enabled? && Gitlab . config . registry . enabled
396
+ container_registry_repository . tags . any?
397
+ end
398
+ end
399
+
394
400
def commit ( id = 'HEAD' )
395
401
repository . commit ( id )
396
402
end
@@ -806,6 +812,11 @@ def rename_repo
806
812
807
813
expire_caches_before_rename ( old_path_with_namespace )
808
814
815
+ if has_container_registry_tags?
816
+ # we currently doesn't support renaming repository if it contains tags in container registry
817
+ raise Exception . new ( 'repository cannot be renamed, due to tags in container registry' )
818
+ end
819
+
809
820
if gitlab_shell . mv_repository ( old_path_with_namespace , new_path_with_namespace )
810
821
# If repository moved successfully we need to send update instructions to users.
811
822
# However we cannot allow rollback since we moved repository
Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ def transfer(project, new_namespace)
34
34
raise TransferError . new ( "Project with same path in target namespace already exists" )
35
35
end
36
36
37
+ if project . has_container_registry_tags?
38
+ # we currently doesn't support renaming repository if it contains tags in container registry
39
+ raise TransferError . new ( 'Repository cannot be renamed, due to tags in container registry' )
40
+ end
41
+
37
42
project . expire_caches_before_rename ( old_path )
38
43
39
44
# Apply new namespace id and visibility level
You can’t perform that action at this time.
0 commit comments