BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e261b4b8
Commit
e261b4b8
authored
May 15, 2017
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'allow_numeric_values_in_gitlab_ci_yml' into 'master'
Allow numeric values in gitlab-ci.yml Closes #30017 See merge request !10607
parents
ae8511df
295cecfb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
4 deletions
+30
-4
allow_numeric_values_in_gitlab_ci_yml.yml
...logs/unreleased/allow_numeric_values_in_gitlab_ci_yml.yml
+4
-0
README.md
doc/ci/yaml/README.md
+5
-1
legacy_validation_helpers.rb
lib/gitlab/ci/config/entry/legacy_validation_helpers.rb
+7
-1
variables.rb
lib/gitlab/ci/config/entry/variables.rb
+4
-0
global_spec.rb
spec/lib/gitlab/ci/config/entry/global_spec.rb
+2
-2
variables_spec.rb
spec/lib/gitlab/ci/config/entry/variables_spec.rb
+8
-0
No files found.
changelogs/unreleased/allow_numeric_values_in_gitlab_ci_yml.yml
0 → 100644
View file @
e261b4b8
---
title
:
Allow numeric values in gitlab-ci.yml
merge_request
:
10607
author
:
blackst0ne
doc/ci/yaml/README.md
View file @
e261b4b8
...
...
@@ -147,6 +147,10 @@ variables:
DATABASE_URL
:
"
postgres://postgres@postgres/my_database"
```
>**Note:**
Integers (as well as strings) are legal both for variable's name and value.
Floats are not legal and cannot be used.
These variables can be later used in all executed commands and scripts.
The YAML-defined variables are also set to all created service containers,
thus allowing to fine tune them. Variables can be also defined on a
...
...
@@ -1152,7 +1156,7 @@ Example:
```
yaml
variables
:
GET_SOURCES_ATTEMPTS
:
"
3"
GET_SOURCES_ATTEMPTS
:
3
```
You can set them in the global
[
`variables`
](
#variables
)
section or the
...
...
lib/gitlab/ci/config/entry/legacy_validation_helpers.rb
View file @
e261b4b8
...
...
@@ -21,7 +21,13 @@ module Gitlab
def
validate_variables
(
variables
)
variables
.
is_a?
(
Hash
)
&&
variables
.
all?
{
|
key
,
value
|
validate_string
(
key
)
&&
validate_string
(
value
)
}
variables
.
flatten
.
all?
do
|
value
|
validate_string
(
value
)
||
validate_integer
(
value
)
end
end
def
validate_integer
(
value
)
value
.
is_a?
(
Integer
)
end
def
validate_string
(
value
)
...
...
lib/gitlab/ci/config/entry/variables.rb
View file @
e261b4b8
...
...
@@ -15,6 +15,10 @@ module Gitlab
def
self
.
default
{}
end
def
value
Hash
[
@config
.
map
{
|
key
,
value
|
[
key
.
to_s
,
value
.
to_s
]
}]
end
end
end
end
...
...
spec/lib/gitlab/ci/config/entry/global_spec.rb
View file @
e261b4b8
...
...
@@ -113,7 +113,7 @@ describe Gitlab::Ci::Config::Entry::Global do
describe
'#variables_value'
do
it
'returns variables'
do
expect
(
global
.
variables_value
).
to
eq
(
VAR
:
'value'
)
expect
(
global
.
variables_value
).
to
eq
(
'VAR'
=>
'value'
)
end
end
...
...
@@ -154,7 +154,7 @@ describe Gitlab::Ci::Config::Entry::Global do
services:
[
'postgres:9.1'
,
'mysql:5.5'
],
stage:
'test'
,
cache:
{
key:
'k'
,
untracked:
true
,
paths:
[
'public/'
]
},
variables:
{
VAR
:
'value'
},
variables:
{
'VAR'
=>
'value'
},
ignore:
false
,
after_script:
[
'make clean'
]
},
spinach:
{
name: :spinach
,
...
...
spec/lib/gitlab/ci/config/entry/variables_spec.rb
View file @
e261b4b8
...
...
@@ -13,6 +13,14 @@ describe Gitlab::Ci::Config::Entry::Variables do
it
'returns hash with key value strings'
do
expect
(
entry
.
value
).
to
eq
config
end
context
'with numeric keys and values in the config'
do
let
(
:config
)
{
{
10
=>
20
}
}
it
'converts numeric key and numeric value into strings'
do
expect
(
entry
.
value
).
to
eq
(
'10'
=>
'20'
)
end
end
end
describe
'#errors'
do
...
...
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