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
Boxiang Sun
gitlab-ce
Commits
3fbfc30f
Commit
3fbfc30f
authored
Sep 16, 2016
by
Grzegorz Bizon
Committed by
Kamil Trzcinski
Sep 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CI job environment configuration entry class
parent
04b56955
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
lib/gitlab/ci/config/node/environment.rb
lib/gitlab/ci/config/node/environment.rb
+11
-8
No files found.
lib/gitlab/ci/config/node/environment.rb
View file @
3fbfc30f
...
...
@@ -11,20 +11,22 @@ module Gitlab
ALLOWED_KEYS
=
%i[name url]
validations
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
,
if: :hash?
validates
:name
,
presence:
true
validates
:url
,
length:
{
maximum:
255
},
allow_nil:
true
,
addressable_url:
true
validate
do
unless
hash
?
||
string?
errors
.
add
(:
config
,
'should be a hash or a string'
)
end
end
with_options
if: :hash?
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:url
,
length:
{
maximum:
255
},
addressable_url:
true
,
allow_nil:
true
end
end
def
hash?
...
...
@@ -44,9 +46,10 @@ module Gitlab
end
def
value
case
@config
.
type
case
@config
when
String
then
{
name:
@config
}
when
Hash
then
@config
else
{}
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