Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d5d8e76b
Commit
d5d8e76b
authored
May 09, 2016
by
Kamil Trzcinski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Block renaming project or repository if it has container registry tags
parent
b5043d5d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
app/models/namespace.rb
app/models/namespace.rb
+8
-0
app/models/project.rb
app/models/project.rb
+11
-0
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+5
-0
No files found.
app/models/namespace.rb
View file @
d5d8e76b
...
...
@@ -127,6 +127,10 @@ class Namespace < ActiveRecord::Base
# Ensure old directory exists before moving it
gitlab_shell
.
add_namespace
(
path_was
)
if
any_project_has_container_registry_tags?
raise
Exception
.
new
(
'namespace cannot be moved, because at least one project has tags in container registry'
)
end
if
gitlab_shell
.
mv_namespace
(
path_was
,
path
)
Gitlab
::
UploadsTransfer
.
new
.
rename_namespace
(
path_was
,
path
)
...
...
@@ -148,6 +152,10 @@ class Namespace < ActiveRecord::Base
end
end
def
any_project_has_container_registry_tags?
projects
.
any?
(
:has_container_registry_tags?
)
end
def
send_update_instructions
projects
.
each
do
|
project
|
project
.
send_move_instructions
(
"
#{
path_was
}
/
#{
project
.
path
}
"
)
...
...
app/models/project.rb
View file @
d5d8e76b
...
...
@@ -391,6 +391,12 @@ class Project < ActiveRecord::Base
end
end
def
has_container_registry_tags?
if
container_registry_enabled?
&&
Gitlab
.
config
.
registry
.
enabled
container_registry_repository
.
tags
.
any?
end
end
def
commit
(
id
=
'HEAD'
)
repository
.
commit
(
id
)
end
...
...
@@ -806,6 +812,11 @@ class Project < ActiveRecord::Base
expire_caches_before_rename
(
old_path_with_namespace
)
if
has_container_registry_tags?
# we currently doesn't support renaming repository if it contains tags in container registry
raise
Exception
.
new
(
'repository cannot be renamed, due to tags in container registry'
)
end
if
gitlab_shell
.
mv_repository
(
old_path_with_namespace
,
new_path_with_namespace
)
# If repository moved successfully we need to send update instructions to users.
# However we cannot allow rollback since we moved repository
...
...
app/services/projects/transfer_service.rb
View file @
d5d8e76b
...
...
@@ -34,6 +34,11 @@ module Projects
raise
TransferError
.
new
(
"Project with same path in target namespace already exists"
)
end
if
project
.
has_container_registry_tags?
# we currently doesn't support renaming repository if it contains tags in container registry
raise
TransferError
.
new
(
'Repository cannot be renamed, due to tags in container registry'
)
end
project
.
expire_caches_before_rename
(
old_path
)
# Apply new namespace id and visibility level
...
...
Alain Takoudjou
@alain.takoudjou
mentioned in commit
d0293463
·
Aug 21, 2018
mentioned in commit
d0293463
mentioned in commit d02934637df96a57907bb0869812b9c92fbfa6fe
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment