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
e5561b73
Commit
e5561b73
authored
Mar 01, 2022
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup create_project_namespace_on_project_create FF
Cleanup FF that was set to enabled by default
parent
27ca9b47
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
60 deletions
+4
-60
app/models/namespace.rb
app/models/namespace.rb
+0
-4
app/models/project.rb
app/models/project.rb
+4
-5
config/feature_flags/development/create_project_namespace_on_project_create.yml
...evelopment/create_project_namespace_on_project_create.yml
+0
-8
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-43
No files found.
app/models/namespace.rb
View file @
e5561b73
...
...
@@ -509,10 +509,6 @@ class Namespace < ApplicationRecord
Feature
.
enabled?
(
:block_issue_repositioning
,
self
,
type: :ops
,
default_enabled: :yaml
)
end
def
project_namespace_creation_enabled?
Feature
.
enabled?
(
:create_project_namespace_on_project_create
,
self
,
default_enabled: :yaml
)
end
def
storage_enforcement_date
# should return something like Date.new(2022, 02, 03)
# TBD: https://gitlab.com/gitlab-org/gitlab/-/issues/350632
...
...
app/models/project.rb
View file @
e5561b73
...
...
@@ -506,7 +506,7 @@ class Project < ApplicationRecord
validates
:project_feature
,
presence:
true
validates
:namespace
,
presence:
true
validates
:project_namespace
,
presence:
true
,
on: :create
,
if:
->
{
self
.
namespace
&&
self
.
root_namespace
.
project_namespace_creation_enabled?
}
validates
:project_namespace
,
presence:
true
,
on: :create
,
if:
->
{
self
.
namespace
}
validates
:project_namespace
,
presence:
true
,
on: :update
,
if:
->
{
self
.
project_namespace_id_changed?
(
to:
nil
)
}
validates
:name
,
uniqueness:
{
scope: :namespace_id
}
validates
:import_url
,
public_url:
{
schemes:
->
(
project
)
{
project
.
persisted?
?
VALID_MIRROR_PROTOCOLS
:
VALID_IMPORT_PROTOCOLS
},
...
...
@@ -3018,16 +3018,15 @@ class Project < ApplicationRecord
end
def
ensure_project_namespace_in_sync
# create project_namespace when project is created
if create_project_namespace_on_project_create FF is enabled
# create project_namespace when project is created
build_project_namespace
if
project_namespace_creation_enabled?
# regardless of create_project_namespace_on_project_create FF we need
# to keep project and project namespace in sync if there is one
# we need to keep project and project namespace in sync if there is one
sync_attributes
(
project_namespace
)
if
sync_project_namespace?
end
def
project_namespace_creation_enabled?
new_record?
&&
!
project_namespace
&&
self
.
namespace
&&
self
.
root_namespace
.
project_namespace_creation_enabled?
new_record?
&&
!
project_namespace
&&
self
.
namespace
end
def
sync_project_namespace?
...
...
config/feature_flags/development/create_project_namespace_on_project_create.yml
deleted
100644 → 0
View file @
27ca9b47
---
name
:
create_project_namespace_on_project_create
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70972
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/344954
milestone
:
'
14.5'
type
:
development
group
:
group::workspace
default_enabled
:
true
spec/models/project_spec.rb
View file @
e5561b73
...
...
@@ -246,20 +246,6 @@ RSpec.describe Project, factory_default: :keep do
expect
(
project
.
project_namespace
).
to
be_in_sync_with_project
(
project
)
expect
(
project
.
reload
.
project_namespace
.
traversal_ids
).
to
eq
([
project
.
namespace
.
traversal_ids
,
project
.
project_namespace
.
id
].
flatten
.
compact
)
end
context
'with FF disabled'
do
before
do
stub_feature_flags
(
create_project_namespace_on_project_create:
false
)
end
it
'does not create a project namespace'
do
project
=
build
(
:project
,
path:
'hopefully-valid-path2'
)
project
.
save!
expect
(
project
).
to
be_persisted
expect
(
project
.
project_namespace
).
to
be_nil
end
end
end
it_behaves_like
'creates project namespace'
...
...
@@ -306,35 +292,6 @@ RSpec.describe Project, factory_default: :keep do
end
end
end
context
'with create_project_namespace_on_project_create FF enabled'
do
it_behaves_like
'project update'
it
'keeps project namespace in sync with project'
do
project
=
create
(
:project
)
project
.
update!
(
path:
'hopefully-valid-path1'
)
expect
(
project
).
to
be_persisted
expect
(
project
.
project_namespace
).
to
be_persisted
expect
(
project
.
project_namespace
).
to
be_in_sync_with_project
(
project
)
end
end
context
'with create_project_namespace_on_project_create FF disabled'
do
before
do
stub_feature_flags
(
create_project_namespace_on_project_create:
false
)
end
it_behaves_like
'project update'
it
'does not create a project namespace when project is updated'
do
project
=
create
(
:project
)
project
.
update!
(
path:
'hopefully-valid-path1'
)
expect
(
project
).
to
be_persisted
expect
(
project
.
project_namespace
).
to
be_nil
end
end
end
context
'updating cd_cd_settings'
do
...
...
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