Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
295cecfb
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
295cecfb
编写于
5月 07, 2017
作者:
B
blackst0ne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow numeric values in gitlab-ci.yml
上级
1005389f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
4 deletion
+30
-4
changelogs/unreleased/allow_numeric_values_in_gitlab_ci_yml.yml
...logs/unreleased/allow_numeric_values_in_gitlab_ci_yml.yml
+4
-0
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+5
-1
lib/gitlab/ci/config/entry/legacy_validation_helpers.rb
lib/gitlab/ci/config/entry/legacy_validation_helpers.rb
+7
-1
lib/gitlab/ci/config/entry/variables.rb
lib/gitlab/ci/config/entry/variables.rb
+4
-0
spec/lib/gitlab/ci/config/entry/global_spec.rb
spec/lib/gitlab/ci/config/entry/global_spec.rb
+2
-2
spec/lib/gitlab/ci/config/entry/variables_spec.rb
spec/lib/gitlab/ci/config/entry/variables_spec.rb
+8
-0
未找到文件。
changelogs/unreleased/allow_numeric_values_in_gitlab_ci_yml.yml
0 → 100644
浏览文件 @
295cecfb
---
title
:
Allow numeric values in gitlab-ci.yml
merge_request
:
10607
author
:
blackst0ne
doc/ci/yaml/README.md
浏览文件 @
295cecfb
...
...
@@ -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
...
...
@@ -1147,7 +1151,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
浏览文件 @
295cecfb
...
...
@@ -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
浏览文件 @
295cecfb
...
...
@@ -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
浏览文件 @
295cecfb
...
...
@@ -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
浏览文件 @
295cecfb
...
...
@@ -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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录