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
de22236c
Commit
de22236c
authored
Jun 14, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure _ can't be treated as wildcard
parent
50b5fcae
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
app/models/ee/project.rb
app/models/ee/project.rb
+2
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+15
-0
No files found.
app/models/ee/project.rb
View file @
de22236c
...
...
@@ -86,8 +86,8 @@ module EE
if
environment
# Partial wildcard sits in the middle
variables
.
concat
(
query
.
where
(
"? LIKE REPLACE(
scope
, ?, ?)"
,
environment
.
name
,
'*'
,
'%'
)
query
.
where
(
"? LIKE REPLACE(
REPLACE(scope, ?, ?)
, ?, ?)"
,
environment
.
name
,
'*'
,
'%'
,
'_'
,
'\\_'
)
.
where
.
not
(
scope:
'*'
)
.
where
.
not
(
scope:
environment
.
name
)
)
...
...
spec/models/project_spec.rb
View file @
de22236c
...
...
@@ -2311,6 +2311,21 @@ describe Project, models: true do
end
end
context
'when scope has _'
do
it
'does not treat it as wildcard'
do
secret_variable
.
update
(
scope:
'*_*'
)
is_expected
.
not_to
contain_exactly
(
secret_variable
)
end
it
'matches literally for _'
do
secret_variable
.
update
(
scope:
'foo_bar/*'
)
environment
.
update
(
name:
'foo_bar/test'
)
is_expected
.
to
contain_exactly
(
secret_variable
)
end
end
context
'when variables with the same name have different scopes'
do
let!
(
:partially_matched_variable
)
do
create
(
:ci_variable
,
...
...
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