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
fa1127c6
Commit
fa1127c6
authored
Nov 27, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip leading & trailing whitespaces in CI/CD secret variable's environment scope
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
1bdeed0e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletion
+28
-1
app/models/ci/variable.rb
app/models/ci/variable.rb
+0
-1
changelogs/unreleased-ee/ee-40561-environment-scope-value-is-not-trimmed.yml
...ed-ee/ee-40561-environment-scope-value-is-not-trimmed.yml
+6
-0
ee/app/models/ee/ci/variable.rb
ee/app/models/ee/ci/variable.rb
+4
-0
spec/ee/spec/models/ee/ci/variable_spec.rb
spec/ee/spec/models/ee/ci/variable_spec.rb
+18
-0
No files found.
app/models/ci/variable.rb
View file @
fa1127c6
...
...
@@ -4,7 +4,6 @@ module Ci
include
HasVariable
include
Presentable
prepend
EE
::
Ci
::
Variable
include
Presentable
belongs_to
:project
...
...
changelogs/unreleased-ee/ee-40561-environment-scope-value-is-not-trimmed.yml
0 → 100644
View file @
fa1127c6
---
title
:
Strip leading & trailing whitespaces in CI/CD secret variable's environment
scope
merge_request
:
3563
author
:
type
:
fixed
ee/app/models/ee/ci/variable.rb
View file @
fa1127c6
...
...
@@ -11,6 +11,10 @@ module EE
message:
::
Gitlab
::
Regex
.
environment_scope_regex_message
}
)
end
def
environment_scope
=
(
new_environment_scope
)
super
(
new_environment_scope
.
to_s
.
strip
)
end
end
end
end
spec/ee/spec/models/ee/ci/variable_spec.rb
View file @
fa1127c6
...
...
@@ -11,4 +11,22 @@ describe Ci::Variable do
is_expected
.
to
validate_uniqueness_of
(
:key
)
.
scoped_to
(
:project_id
,
:environment_scope
)
end
describe
'#environment_scope='
do
context
'when the new environment_scope is nil'
do
it
'strips leading and trailing whitespaces'
do
subject
.
environment_scope
=
nil
expect
(
subject
.
environment_scope
).
to
eq
(
''
)
end
end
context
'when the new environment_scope has leadind and trailing whitespaces'
do
it
'strips leading and trailing whitespaces'
do
subject
.
environment_scope
=
' * '
expect
(
subject
.
environment_scope
).
to
eq
(
'*'
)
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