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
9ae07dbd
Commit
9ae07dbd
authored
Mar 25, 2020
by
David Fernandez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove forward npm package request feature flag
Remove `forward_npm_package_registry_requests` feature flag
parent
f67998b2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
42 deletions
+19
-42
ee/app/views/admin/application_settings/_package_registry.haml
...p/views/admin/application_settings/_package_registry.haml
+1
-1
ee/lib/api/helpers/packages/dependency_proxy_helpers.rb
ee/lib/api/helpers/packages/dependency_proxy_helpers.rb
+2
-3
ee/spec/lib/api/helpers/packages/dependency_proxy_helpers_spec.rb
...lib/api/helpers/packages/dependency_proxy_helpers_spec.rb
+5
-11
ee/spec/requests/api/npm_packages_spec.rb
ee/spec/requests/api/npm_packages_spec.rb
+10
-26
ee/spec/support/shared_examples/requests/api/packages_tags_shared_examples.rb
...ed_examples/requests/api/packages_tags_shared_examples.rb
+1
-1
No files found.
ee/app/views/admin/application_settings/_package_registry.haml
View file @
9ae07dbd
-
if
Feature
.
enabled?
(
:forward_npm_package_registry_requests
,
default_enabled:
true
)
&&
Gitlab
.
config
.
packages
.
enabled
-
if
Gitlab
.
config
.
packages
.
enabled
%section
.settings.as-package.no-animate
#js-package-settings
{
class:
(
'expanded'
if
expanded_by_default?
)
}
%section
.settings.as-package.no-animate
#js-package-settings
{
class:
(
'expanded'
if
expanded_by_default?
)
}
.settings-header
.settings-header
%h4
%h4
...
...
ee/lib/api/helpers/packages/dependency_proxy_helpers.rb
View file @
9ae07dbd
...
@@ -9,7 +9,7 @@ module API
...
@@ -9,7 +9,7 @@ module API
}.
freeze
}.
freeze
def
redirect_registry_request
(
forward_to_registry
,
package_type
,
options
)
def
redirect_registry_request
(
forward_to_registry
,
package_type
,
options
)
if
redirect_registry_request_available?
&&
forward_to_registry
if
forward_to_registry
&&
redirect_registry_request_available?
redirect
(
registry_url
(
package_type
,
options
))
redirect
(
registry_url
(
package_type
,
options
))
else
else
yield
yield
...
@@ -28,8 +28,7 @@ module API
...
@@ -28,8 +28,7 @@ module API
end
end
def
redirect_registry_request_available?
def
redirect_registry_request_available?
Feature
.
enabled?
(
:forward_npm_package_registry_requests
,
default_enabled:
true
)
&&
::
Gitlab
::
CurrentSettings
.
current_application_settings
.
npm_package_requests_forwarding
::
Gitlab
::
CurrentSettings
.
current_application_settings
.
npm_package_requests_forwarding
end
end
end
end
end
end
...
...
ee/spec/lib/api/helpers/packages/dependency_proxy_helpers_spec.rb
View file @
9ae07dbd
...
@@ -35,20 +35,15 @@ describe API::Helpers::Packages::DependencyProxyHelpers do
...
@@ -35,20 +35,15 @@ describe API::Helpers::Packages::DependencyProxyHelpers do
context
'with npm packages'
do
context
'with npm packages'
do
let
(
:package_type
)
{
:npm
}
let
(
:package_type
)
{
:npm
}
where
(
:feature_flag
,
:application_setting
,
:forward_to_registry
,
:example_name
)
do
where
(
:application_setting
,
:forward_to_registry
,
:example_name
)
do
true
|
true
|
true
|
'executing redirect'
true
|
true
|
'executing redirect'
true
|
true
|
false
|
'executing fallback'
true
|
false
|
'executing fallback'
true
|
false
|
true
|
'executing fallback'
false
|
true
|
'executing fallback'
true
|
false
|
false
|
'executing fallback'
false
|
false
|
'executing fallback'
false
|
true
|
true
|
'executing fallback'
false
|
true
|
false
|
'executing fallback'
false
|
false
|
true
|
'executing fallback'
false
|
false
|
false
|
'executing fallback'
end
end
with_them
do
with_them
do
before
do
before
do
stub_feature_flags
(
forward_npm_package_registry_requests:
{
enabled:
feature_flag
})
stub_application_setting
(
npm_package_requests_forwarding:
application_setting
)
stub_application_setting
(
npm_package_requests_forwarding:
application_setting
)
end
end
...
@@ -60,7 +55,6 @@ describe API::Helpers::Packages::DependencyProxyHelpers do
...
@@ -60,7 +55,6 @@ describe API::Helpers::Packages::DependencyProxyHelpers do
let
(
:forward_to_registry
)
{
true
}
let
(
:forward_to_registry
)
{
true
}
before
do
before
do
stub_feature_flags
(
forward_npm_package_registry_requests:
{
enabled:
true
})
stub_application_setting
(
npm_package_requests_forwarding:
true
)
stub_application_setting
(
npm_package_requests_forwarding:
true
)
end
end
...
...
ee/spec/requests/api/npm_packages_spec.rb
View file @
9ae07dbd
...
@@ -63,42 +63,26 @@ describe API::NpmPackages do
...
@@ -63,42 +63,26 @@ describe API::NpmPackages do
context
'a public project'
do
context
'a public project'
do
it_behaves_like
'returning the npm package info'
it_behaves_like
'returning the npm package info'
context
'with
forward_npm_package_registry_requests
enabled'
do
context
'with
application setting
enabled'
do
before
do
before
do
stub_
feature_flags
(
forward_npm_package_registry_requests:
{
enabled:
true
}
)
stub_
application_setting
(
npm_package_requests_forwarding:
true
)
end
end
context
'with application setting enabled'
do
it_behaves_like
'returning the npm package info'
before
do
stub_application_setting
(
npm_package_requests_forwarding:
true
)
end
it_behaves_like
'returning the npm package info'
context
'with unknown package'
do
context
'with unknown package'
do
it
'returns a redirect'
do
it
'returns a redirect'
do
get
api
(
"/packages/npm/unknown"
)
get
api
(
"/packages/npm/unknown"
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
.
headers
[
'Location'
]).
to
eq
(
'https://registry.npmjs.org/unknown'
)
expect
(
response
.
headers
[
'Location'
]).
to
eq
(
'https://registry.npmjs.org/unknown'
)
end
end
end
end
end
context
'with application setting disabled'
do
before
do
stub_application_setting
(
npm_package_requests_forwarding:
false
)
end
it_behaves_like
'returning the npm package info'
it_behaves_like
'returning forbidden for unknown package'
end
end
end
context
'with
forward_npm_package_registry_requests
disabled'
do
context
'with
application setting
disabled'
do
before
do
before
do
stub_
feature_flags
(
forward_npm_package_registry_requests:
{
enabled:
false
}
)
stub_
application_setting
(
npm_package_requests_forwarding:
false
)
end
end
it_behaves_like
'returning the npm package info'
it_behaves_like
'returning the npm package info'
...
...
ee/spec/support/shared_examples/requests/api/packages_tags_shared_examples.rb
View file @
9ae07dbd
...
@@ -14,7 +14,7 @@ RSpec.shared_examples 'returns package tags' do |user_type|
...
@@ -14,7 +14,7 @@ RSpec.shared_examples 'returns package tags' do |user_type|
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
before
do
before
do
stub_
feature_flags
(
forward_npm_package_registry_requests:
{
enabled:
false
}
)
stub_
application_setting
(
npm_package_requests_forwarding:
false
)
project
.
send
(
"add_
#{
user_type
}
"
,
user
)
unless
user_type
==
:no_type
project
.
send
(
"add_
#{
user_type
}
"
,
user
)
unless
user_type
==
:no_type
end
end
...
...
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