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
c5ff1bef
Commit
c5ff1bef
authored
Apr 06, 2022
by
wortschi
Committed by
Nikola Milojevic
Apr 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove group_import_export feature flag
Changelog: changed
parent
da10c4a7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
159 deletions
+48
-159
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+0
-5
app/controllers/import/gitlab_groups_controller.rb
app/controllers/import/gitlab_groups_controller.rb
+0
-5
app/views/groups/settings/_export.html.haml
app/views/groups/settings/_export.html.haml
+0
-2
config/feature_flags/development/group_import_export.yml
config/feature_flags/development/group_import_export.yml
+0
-8
lib/api/group_export.rb
lib/api/group_export.rb
+0
-2
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+0
-26
spec/features/groups/import_export/export_file_spec.rb
spec/features/groups/import_export/export_file_spec.rb
+0
-16
spec/requests/api/group_export_spec.rb
spec/requests/api/group_export_spec.rb
+48
-81
spec/requests/import/gitlab_groups_controller_spec.rb
spec/requests/import/gitlab_groups_controller_spec.rb
+0
-14
No files found.
app/controllers/groups_controller.rb
View file @
c5ff1bef
...
...
@@ -15,7 +15,6 @@ class GroupsController < Groups::ApplicationController
prepend_before_action
(
only:
[
:show
,
:issues
])
{
authenticate_sessionless_user!
(
:rss
)
}
prepend_before_action
(
only:
[
:issues_calendar
])
{
authenticate_sessionless_user!
(
:ics
)
}
prepend_before_action
:ensure_export_enabled
,
only:
[
:export
,
:download_export
]
prepend_before_action
:check_captcha
,
only: :create
,
if:
->
{
captcha_enabled?
}
before_action
:authenticate_user!
,
only:
[
:new
,
:create
]
...
...
@@ -339,10 +338,6 @@ class GroupsController < Groups::ApplicationController
check_rate_limit!
(
prefixed_action
,
scope:
[
current_user
,
scope
].
compact
)
end
def
ensure_export_enabled
render_404
unless
Feature
.
enabled?
(
:group_import_export
,
@group
,
default_enabled:
true
)
end
private
def
load_recaptcha
...
...
app/controllers/import/gitlab_groups_controller.rb
View file @
c5ff1bef
...
...
@@ -3,7 +3,6 @@
class
Import::GitlabGroupsController
<
ApplicationController
include
WorkhorseAuthorization
before_action
:ensure_group_import_enabled
before_action
:check_import_rate_limit!
,
only:
%i[create]
feature_category
:importers
...
...
@@ -51,10 +50,6 @@ class Import::GitlabGroupsController < ApplicationController
end
end
def
ensure_group_import_enabled
render_404
unless
Feature
.
enabled?
(
:group_import_export
,
@group
,
default_enabled:
true
)
end
def
check_import_rate_limit!
check_rate_limit!
(
:group_import
,
scope:
current_user
)
do
redirect_to
new_group_path
,
alert:
_
(
'This endpoint has been requested too many times. Try again later.'
)
...
...
app/views/groups/settings/_export.html.haml
View file @
c5ff1bef
-
return
unless
Feature
.
enabled?
(
:group_import_export
,
@group
,
default_enabled:
true
)
-
group
=
local_assigns
.
fetch
(
:group
)
.sub-section
...
...
config/feature_flags/development/group_import_export.yml
deleted
100644 → 0
View file @
da10c4a7
---
name
:
group_import_export
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22423
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/282245
milestone
:
'
12.8'
type
:
development
group
:
group::import
default_enabled
:
true
lib/api/group_export.rb
View file @
c5ff1bef
...
...
@@ -3,8 +3,6 @@
module
API
class
GroupExport
<
::
API
::
Base
before
do
not_found!
unless
Feature
.
enabled?
(
:group_import_export
,
user_group
,
default_enabled:
true
)
authorize!
:admin_group
,
user_group
end
...
...
spec/controllers/groups_controller_spec.rb
View file @
c5ff1bef
...
...
@@ -1084,19 +1084,6 @@ RSpec.describe GroupsController, factory_default: :keep do
enable_admin_mode!
(
admin
)
end
context
'when the group export feature flag is not enabled'
do
before
do
sign_in
(
admin
)
stub_feature_flags
(
group_import_export:
false
)
end
it
'returns a not found error'
do
post
:export
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when the user does not have permission to export the group'
do
before
do
sign_in
(
guest
)
...
...
@@ -1197,19 +1184,6 @@ RSpec.describe GroupsController, factory_default: :keep do
end
end
context
'when the group export feature flag is not enabled'
do
before
do
sign_in
(
admin
)
stub_feature_flags
(
group_import_export:
false
)
end
it
'returns a not found error'
do
post
:export
,
params:
{
id:
group
.
to_param
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when the user does not have the required permissions'
do
before
do
sign_in
(
guest
)
...
...
spec/features/groups/import_export/export_file_spec.rb
View file @
c5ff1bef
...
...
@@ -26,22 +26,6 @@ RSpec.describe 'Group Export', :js do
end
end
context
'when the group import/export FF is disabled'
do
before
do
stub_feature_flags
(
group_import_export:
false
)
group
.
add_owner
(
user
)
sign_in
(
user
)
end
it
'does not show the group export options'
do
visit
edit_group_path
(
group
)
expect
(
page
).
to
have_content
(
'Advanced'
)
expect
(
page
).
not_to
have_content
(
'Export group'
)
end
end
context
'when the signed in user does not have the required permission level'
do
before
do
group
.
add_guest
(
user
)
...
...
spec/requests/api/group_export_spec.rb
View file @
c5ff1bef
...
...
@@ -30,76 +30,62 @@ RSpec.describe API::GroupExport do
group
.
add_owner
(
user
)
end
context
'
group_import_export feature flag enabled
'
do
context
'
when export file exists
'
do
before
do
stub_feature_flags
(
group_import_export:
true
)
allow
(
Gitlab
::
ApplicationRateLimiter
)
.
to
receive
(
:increment
)
.
and_return
(
0
)
end
context
'when export file exists'
do
before
do
upload
.
export_file
=
fixture_file_upload
(
'spec/fixtures/group_export.tar.gz'
,
"`/tar.gz"
)
upload
.
save!
end
it
'downloads exported group archive'
do
get
api
(
download_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
upload
.
export_file
=
fixture_file_upload
(
'spec/fixtures/group_export.tar.gz'
,
"`/tar.gz"
)
upload
.
save!
end
context
'when export_file.file does not exist'
do
before
do
expect_next_instance_of
(
ImportExportUploader
)
do
|
uploader
|
expect
(
uploader
).
to
receive
(
:file
).
and_return
(
nil
)
end
end
it
'downloads exported group archive'
do
get
api
(
download_path
,
user
)
it
'returns 404'
do
get
api
(
download_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
context
'when export_file.file does not exist'
do
before
do
expect_next_instance_of
(
ImportExportUploader
)
do
|
uploader
|
expect
(
uploader
).
to
receive
(
:file
).
and_return
(
nil
)
end
end
context
'when object is not present'
do
let
(
:other_group
)
{
create
(
:group
,
:with_export
)
}
let
(
:other_download_path
)
{
"/groups/
#{
other_group
.
id
}
/export/download"
}
it
'returns 404'
do
get
api
(
download_path
,
user
)
before
do
other_group
.
add_owner
(
user
)
other_group
.
export_file
.
file
.
delete
end
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
it
'returns 404'
do
get
api
(
other_download_path
,
user
)
context
'when object is not present'
do
let
(
:other_group
)
{
create
(
:group
,
:with_export
)
}
let
(
:other_download_path
)
{
"/groups/
#{
other_group
.
id
}
/export/download"
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'The group export file is not available yet'
)
end
before
do
other_group
.
add_owner
(
user
)
other_group
.
export_file
.
file
.
delete
end
end
context
'when export file does not exist'
do
it
'returns 404'
do
get
api
(
download_path
,
user
)
get
api
(
other_
download_path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
expect
(
json_response
[
'message'
]).
to
eq
(
'The group export file is not available yet'
)
end
end
end
context
'group_import_export feature flag disabled'
do
before
do
stub_feature_flags
(
group_import_export:
false
)
end
it
'responds with 404 Not Found'
do
context
'when export file does not exist'
do
it
'returns 404'
do
get
api
(
download_path
,
user
)
allow
(
Gitlab
::
ApplicationRateLimiter
)
.
to
receive
(
:increment
)
.
and_return
(
0
)
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
...
...
@@ -122,58 +108,40 @@ RSpec.describe API::GroupExport do
end
describe
'POST /groups/:group_id/export'
do
context
'
group_import_export feature flag enabled
'
do
context
'
when user is a group owner
'
do
before
do
stub_feature_flags
(
group_import_export:
true
)
group
.
add_owner
(
user
)
end
context
'when user is a group owner'
do
before
do
group
.
add_owner
(
user
)
end
it
'accepts download'
do
post
api
(
path
,
user
)
it
'accepts download'
do
post
api
(
path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:accepted
)
end
expect
(
response
).
to
have_gitlab_http_status
(
:accepted
)
end
end
context
'when the export cannot be started'
do
before
do
group
.
add_owner
(
user
)
allow
(
GroupExportWorker
).
to
receive
(
:perform_async
).
and_return
(
nil
)
end
it
'returns an error'
do
post
api
(
path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:error
)
end
context
'when the export cannot be started'
do
before
do
group
.
add_owner
(
user
)
allow
(
GroupExportWorker
).
to
receive
(
:perform_async
).
and_return
(
nil
)
end
context
'when user is not a group owner'
do
before
do
group
.
add_developer
(
user
)
end
it
'forbids the request'
do
post
api
(
path
,
user
)
it
'returns an error'
do
post
api
(
path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:forbidden
)
end
expect
(
response
).
to
have_gitlab_http_status
(
:error
)
end
end
context
'
group_import_export feature flag disabled
'
do
context
'
when user is not a group owner
'
do
before
do
stub_feature_flags
(
group_import_export:
false
)
group
.
add_developer
(
user
)
end
it
'
responds with 404 Not Found
'
do
it
'
forbids the request
'
do
post
api
(
path
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:
not_found
)
expect
(
response
).
to
have_gitlab_http_status
(
:
forbidden
)
end
end
...
...
@@ -202,7 +170,6 @@ RSpec.describe API::GroupExport do
let
(
:status_path
)
{
"/groups/
#{
group
.
id
}
/export_relations/status"
}
before
do
stub_feature_flags
(
group_import_export:
true
)
group
.
add_owner
(
user
)
end
...
...
spec/requests/import/gitlab_groups_controller_spec.rb
View file @
c5ff1bef
...
...
@@ -155,20 +155,6 @@ RSpec.describe Import::GitlabGroupsController do
end
end
context
'when group import FF is disabled'
do
let
(
:request_params
)
{
{
path:
'test-group-import'
,
name:
'test-group-import'
}
}
before
do
stub_feature_flags
(
group_import_export:
false
)
end
it
'returns an error'
do
expect
{
import_request
}.
not_to
change
{
Group
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when the parent group is invalid'
do
let
(
:request_params
)
{
{
path:
'test-group-import'
,
name:
'test-group-import'
,
parent_id:
-
1
}
}
...
...
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