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
71730c28
Commit
71730c28
authored
Jan 20, 2022
by
Darby Frey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing API to be behind a feature flag
parent
1ead057d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
config/feature_flags/development/ci_secure_files.yml
config/feature_flags/development/ci_secure_files.yml
+8
-0
lib/api/ci/secure_files.rb
lib/api/ci/secure_files.rb
+7
-1
spec/requests/api/ci/secure_files_spec.rb
spec/requests/api/ci/secure_files_spec.rb
+18
-0
No files found.
config/feature_flags/development/ci_secure_files.yml
0 → 100644
View file @
71730c28
---
name
:
ci_secure_files
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/78227
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/350748
milestone
:
'
14.8'
type
:
development
group
:
group::incubation
default_enabled
:
false
lib/api/ci/secure_files.rb
View file @
71730c28
...
...
@@ -8,6 +8,7 @@ module API
before
do
authenticate!
authorize!
:admin_build
,
user_project
feature_flag_enabled?
end
feature_category
:pipeline_authoring
...
...
@@ -60,7 +61,6 @@ module API
route_setting
:authentication
,
basic_auth_personal_access_token:
true
,
job_token_allowed:
true
post
':id/secure_files'
do
secure_file
=
user_project
.
secure_files
.
new
(
name:
params
[
:name
],
permissions:
params
[
:permissions
]
||
:read_only
...
...
@@ -87,6 +87,12 @@ module API
no_content!
end
end
helpers
do
def
feature_flag_enabled?
service_unavailable!
unless
Feature
.
enabled?
(
:ci_secure_files
,
user_project
,
default_enabled: :yaml
)
end
end
end
end
end
spec/requests/api/ci/secure_files_spec.rb
View file @
71730c28
...
...
@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec
.
describe
API
::
Ci
::
SecureFiles
do
before
do
stub_ci_secure_file_object_storage
stub_feature_flags
(
ci_secure_files:
true
)
end
let_it_be
(
:user
)
{
create
(
:user
)
}
...
...
@@ -15,6 +16,23 @@ RSpec.describe API::Ci::SecureFiles do
let_it_be
(
:secure_file
)
{
create
(
:ci_secure_file
,
project:
project
)
}
describe
'GET /projects/:id/secure_files'
do
context
'feature flag'
do
it
'returns a 503 when the feature flag is disabled'
do
stub_feature_flags
(
ci_secure_files:
false
)
get
api
(
"/projects/
#{
project
.
id
}
/secure_files"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:service_unavailable
)
end
it
'returns a 200 when the feature flag is enabled'
do
get
api
(
"/projects/
#{
project
.
id
}
/secure_files"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_a
(
Array
)
end
end
context
'authorized user with proper permissions'
do
it
'returns project secure files'
do
get
api
(
"/projects/
#{
project
.
id
}
/secure_files"
,
user
)
...
...
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