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
33b368da
Commit
33b368da
authored
Sep 07, 2020
by
Furkan Ayhan
Committed by
Mark Chao
Sep 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove FF ci_variables_api_filter_environment_scope
It was enabled by default a month ago.
parent
9063dea6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
84 deletions
+10
-84
doc/api/project_level_variables.md
doc/api/project_level_variables.md
+1
-23
lib/api/variables.rb
lib/api/variables.rb
+0
-1
lib/gitlab/ci/features.rb
lib/gitlab/ci/features.rb
+0
-5
spec/requests/api/variables_spec.rb
spec/requests/api/variables_spec.rb
+9
-55
No files found.
doc/api/project_level_variables.md
View file @
33b368da
...
@@ -154,11 +154,7 @@ curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://git
...
@@ -154,11 +154,7 @@ curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://git
## The `filter` parameter
## The `filter` parameter
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34490) in GitLab 13.2.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34490) in GitLab 13.2.
> - It's deployed behind a feature flag, disabled by default.
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/227052) in GitLab 13.4.
> - [Became enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39209) on GitLab 13.3.
> - It's enabled on GitLab.com.
> - It's recommended for production use.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable).
This parameter is used for filtering by attributes, such as
`environment_scope`
.
This parameter is used for filtering by attributes, such as
`environment_scope`
.
...
@@ -167,21 +163,3 @@ Example usage:
...
@@ -167,21 +163,3 @@ Example usage:
```
shell
```
shell
curl
--request
DELETE
--header
"PRIVATE-TOKEN: <your_access_token>"
"https://gitlab.example.com/api/v4/projects/1/variables/VARIABLE_1?filter[environment_scope]=production"
curl
--request
DELETE
--header
"PRIVATE-TOKEN: <your_access_token>"
"https://gitlab.example.com/api/v4/projects/1/variables/VARIABLE_1?filter[environment_scope]=production"
```
```
### Enable or disable
It is deployed behind a feature flag that is
**enabled by default**
.
[
GitLab administrators with access to the GitLab Rails console
](
../administration/feature_flags.md
)
can opt to disable it for your instance.
To disable it:
```
ruby
Feature
.
disable
(
:ci_variables_api_filter_environment_scope
)
```
To enable it:
```
ruby
Feature
.
enable
(
:ci_variables_api_filter_environment_scope
)
```
lib/api/variables.rb
View file @
33b368da
...
@@ -17,7 +17,6 @@ module API
...
@@ -17,7 +17,6 @@ module API
def
find_variable
(
params
)
def
find_variable
(
params
)
variables
=
::
Ci
::
VariablesFinder
.
new
(
user_project
,
params
).
execute
.
to_a
variables
=
::
Ci
::
VariablesFinder
.
new
(
user_project
,
params
).
execute
.
to_a
return
variables
.
first
unless
::
Gitlab
::
Ci
::
Features
.
variables_api_filter_environment_scope?
return
variables
.
first
unless
variables
.
many?
# rubocop: disable CodeReuse/ActiveRecord
return
variables
.
first
unless
variables
.
many?
# rubocop: disable CodeReuse/ActiveRecord
conflict!
(
"There are multiple variables with provided parameters. Please use 'filter[environment_scope]'"
)
conflict!
(
"There are multiple variables with provided parameters. Please use 'filter[environment_scope]'"
)
...
...
lib/gitlab/ci/features.rb
View file @
33b368da
...
@@ -31,11 +31,6 @@ module Gitlab
...
@@ -31,11 +31,6 @@ module Gitlab
::
Feature
.
enabled?
(
:ci_store_pipeline_messages
,
project
,
default_enabled:
true
)
::
Feature
.
enabled?
(
:ci_store_pipeline_messages
,
project
,
default_enabled:
true
)
end
end
# Remove in https://gitlab.com/gitlab-org/gitlab/-/issues/227052
def
self
.
variables_api_filter_environment_scope?
::
Feature
.
enabled?
(
:ci_variables_api_filter_environment_scope
,
default_enabled:
true
)
end
def
self
.
raise_job_rules_without_workflow_rules_warning?
def
self
.
raise_job_rules_without_workflow_rules_warning?
::
Feature
.
enabled?
(
:ci_raise_job_rules_without_workflow_rules_warning
,
default_enabled:
true
)
::
Feature
.
enabled?
(
:ci_raise_job_rules_without_workflow_rules_warning
,
default_enabled:
true
)
end
end
...
...
spec/requests/api/variables_spec.rb
View file @
33b368da
...
@@ -60,25 +60,10 @@ RSpec.describe API::Variables do
...
@@ -60,25 +60,10 @@ RSpec.describe API::Variables do
let!
(
:var2
)
{
create
(
:ci_variable
,
project:
project
,
key:
'key1'
,
environment_scope:
'production'
)
}
let!
(
:var2
)
{
create
(
:ci_variable
,
project:
project
,
key:
'key1'
,
environment_scope:
'production'
)
}
context
'when filter[environment_scope] is not passed'
do
context
'when filter[environment_scope] is not passed'
do
context
'FF ci_variables_api_filter_environment_scope is enabled'
do
it
'returns 409'
do
it
'returns 409'
do
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
end
end
context
'FF ci_variables_api_filter_environment_scope is disabled'
do
before
do
stub_feature_flags
(
ci_variables_api_filter_environment_scope:
false
)
end
it
'returns random one'
do
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'key'
]).
to
eq
(
'key1'
)
end
end
end
end
end
...
@@ -232,25 +217,10 @@ RSpec.describe API::Variables do
...
@@ -232,25 +217,10 @@ RSpec.describe API::Variables do
let!
(
:var2
)
{
create
(
:ci_variable
,
project:
project
,
key:
'key1'
,
environment_scope:
'production'
)
}
let!
(
:var2
)
{
create
(
:ci_variable
,
project:
project
,
key:
'key1'
,
environment_scope:
'production'
)
}
context
'when filter[environment_scope] is not passed'
do
context
'when filter[environment_scope] is not passed'
do
context
'FF ci_variables_api_filter_environment_scope is enabled'
do
it
'returns 409'
do
it
'returns 409'
do
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
end
end
context
'FF ci_variables_api_filter_environment_scope is disabled'
do
before
do
stub_feature_flags
(
ci_variables_api_filter_environment_scope:
false
)
end
it
'updates random one'
do
put
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
),
params:
{
value:
'new_val'
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'value'
]).
to
eq
(
'new_val'
)
end
end
end
end
end
...
@@ -312,26 +282,10 @@ RSpec.describe API::Variables do
...
@@ -312,26 +282,10 @@ RSpec.describe API::Variables do
let!
(
:var2
)
{
create
(
:ci_variable
,
project:
project
,
key:
'key1'
,
environment_scope:
'production'
)
}
let!
(
:var2
)
{
create
(
:ci_variable
,
project:
project
,
key:
'key1'
,
environment_scope:
'production'
)
}
context
'when filter[environment_scope] is not passed'
do
context
'when filter[environment_scope] is not passed'
do
context
'FF ci_variables_api_filter_environment_scope is enabled'
do
it
'returns 409'
do
it
'returns 409'
do
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
end
end
context
'FF ci_variables_api_filter_environment_scope is disabled'
do
before
do
stub_feature_flags
(
ci_variables_api_filter_environment_scope:
false
)
end
it
'deletes random one'
do
expect
(
response
).
to
have_gitlab_http_status
(
:conflict
)
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/variables/key1"
,
user
),
params:
{
'filter[environment_scope]'
:
'production'
}
expect
(
response
).
to
have_gitlab_http_status
(
:no_content
)
end
.
to
change
{
project
.
variables
.
count
}.
by
(
-
1
)
end
end
end
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