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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
937630bb
Commit
937630bb
authored
Mar 27, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not raise when validating variables expression
parent
a745eadf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
+10
-6
lib/gitlab/ci/config/entry/policy.rb
lib/gitlab/ci/config/entry/policy.rb
+1
-1
lib/gitlab/ci/pipeline/expression/statement.rb
lib/gitlab/ci/pipeline/expression/statement.rb
+0
-4
spec/lib/gitlab/ci/config/entry/policy_spec.rb
spec/lib/gitlab/ci/config/entry/policy_spec.rb
+9
-1
No files found.
lib/gitlab/ci/config/entry/policy.rb
View file @
937630bb
...
@@ -47,7 +47,7 @@ module Gitlab
...
@@ -47,7 +47,7 @@ module Gitlab
statements
.
each
do
|
statement
|
statements
.
each
do
|
statement
|
unless
statement
.
valid?
unless
statement
.
valid?
errors
.
add
(
:variables
,
"Invalid expression
#{
statement
.
inspect
}
"
)
errors
.
add
(
:variables
,
"Invalid expression
syntax
"
)
end
end
end
end
end
end
...
...
lib/gitlab/ci/pipeline/expression/statement.rb
View file @
937630bb
...
@@ -37,10 +37,6 @@ module Gitlab
...
@@ -37,10 +37,6 @@ module Gitlab
evaluate
.
present?
evaluate
.
present?
end
end
def
inspect
"syntax:
#{
@lexer
.
lexemes
.
join
(
' '
)
}
"
end
def
valid?
def
valid?
parse_tree
.
is_a?
(
Lexeme
::
Base
)
parse_tree
.
is_a?
(
Lexeme
::
Base
)
rescue
StatementError
rescue
StatementError
...
...
spec/lib/gitlab/ci/config/entry/policy_spec.rb
View file @
937630bb
...
@@ -104,7 +104,15 @@ describe Gitlab::Ci::Config::Entry::Policy do
...
@@ -104,7 +104,15 @@ describe Gitlab::Ci::Config::Entry::Policy do
let
(
:config
)
{
{
variables:
[
'$MY_VAR =='
]
}
}
let
(
:config
)
{
{
variables:
[
'$MY_VAR =='
]
}
}
it
'reports an error about invalid statement'
do
it
'reports an error about invalid statement'
do
expect
(
entry
.
errors
).
to
include
/invalid expression syntax: variable equals/
expect
(
entry
.
errors
).
to
include
/invalid expression syntax/
end
end
context
'when specifying invalid variables expressions token'
do
let
(
:config
)
{
{
variables:
[
'$MY_VAR == 123'
]
}
}
it
'reports an error about invalid statement'
do
expect
(
entry
.
errors
).
to
include
/invalid expression syntax/
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