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
b784a985
Commit
b784a985
authored
May 14, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not raise if variable expression can not be evaluated
parent
8b736c91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
lib/gitlab/ci/pipeline/expression/statement.rb
lib/gitlab/ci/pipeline/expression/statement.rb
+2
-0
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
+14
-2
No files found.
lib/gitlab/ci/pipeline/expression/statement.rb
View file @
b784a985
...
...
@@ -35,6 +35,8 @@ module Gitlab
def
truthful?
evaluate
.
present?
rescue
StatementError
false
end
def
valid?
...
...
spec/lib/gitlab/ci/pipeline/expression/statement_spec.rb
View file @
b784a985
require
'spec_helper'
require
'
fast_
spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Expression
::
Statement
do
subject
do
...
...
@@ -114,7 +114,8 @@ describe Gitlab::Ci::Pipeline::Expression::Statement do
[
'$UNDEFINED_VARIABLE == null'
,
true
],
[
'$PRESENT_VARIABLE'
,
true
],
[
'$UNDEFINED_VARIABLE'
,
false
],
[
'$EMPTY_VARIABLE'
,
false
]
[
'$EMPTY_VARIABLE'
,
false
],
[
'$INVALID = 1'
,
false
]
]
statements
.
each
do
|
expression
,
value
|
...
...
@@ -126,5 +127,16 @@ describe Gitlab::Ci::Pipeline::Expression::Statement do
end
end
end
context
'when evaluating expression raises an error'
do
let
(
:text
)
{
'$PRESENT_VARIABLE'
}
it
'returns false'
do
allow
(
subject
).
to
receive
(
:evaluate
)
.
and_raise
(
described_class
::
StatementError
)
expect
(
subject
.
truthful?
).
to
be_falsey
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