Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
42102b43
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,发现更多精彩内容 >>
提交
42102b43
编写于
4月 18, 2016
作者:
K
Kamil Trzcinski
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'after-script' into make-before-after-overridable
上级
38b15e35
63bd1f92
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
29 deletion
+38
-29
doc/ci/yaml/README.md
doc/ci/yaml/README.md
+3
-0
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+33
-27
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+2
-2
未找到文件。
doc/ci/yaml/README.md
浏览文件 @
42102b43
...
...
@@ -126,6 +126,9 @@ builds, including deploy builds. This can be an array or a multi-line string.
### after_script
>**Note:**
Introduced in GitLab 8.7 and GitLab Runner v1.2.
`after_script`
is used to define the command that will be run after for all
builds. This has to be an array or a multi-line string.
...
...
lib/ci/gitlab_ci_yaml_processor.rb
浏览文件 @
42102b43
...
...
@@ -92,6 +92,29 @@ module Ci
end
def
validate!
validate_global!
@jobs
.
each
do
|
name
,
job
|
validate_job!
(
name
,
job
)
end
true
end
def
validate_job!
(
name
,
job
)
validate_job_name!
(
name
)
validate_job_keys!
(
name
,
job
)
validate_job_types!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
if
job
[
:stage
]
validate_job_cache!
(
name
,
job
)
if
job
[
:cache
]
validate_job_artifacts!
(
name
,
job
)
if
job
[
:artifacts
]
validate_job_dependencies!
(
name
,
job
)
if
job
[
:dependencies
]
end
private
def
validate_global!
unless
validate_array_of_strings
(
@before_script
)
raise
ValidationError
,
"before_script should be an array of strings"
end
...
...
@@ -116,40 +139,23 @@ module Ci
raise
ValidationError
,
"variables should be a map of key-valued strings"
end
if
@cache
if
@cache
[
:key
]
&&
!
validate_string
(
@cache
[
:key
])
raise
ValidationError
,
"cache:key parameter should be a string"
end
if
@cache
[
:untracked
]
&&
!
validate_boolean
(
@cache
[
:untracked
])
raise
ValidationError
,
"cache:untracked parameter should be an boolean"
end
validate_global_cache!
if
@cache
end
if
@cache
[
:paths
]
&&
!
validate_array_of_strings
(
@cache
[
:paths
])
raise
ValidationError
,
"cache:paths parameter should be an array of strings"
end
def
validate_global_cache!
if
@cache
[
:key
]
&&
!
validate_string
(
@cache
[
:key
])
raise
ValidationError
,
"cache:key parameter should be a string"
end
@jobs
.
each
do
|
name
,
job
|
validate_job!
(
name
,
job
)
if
@cache
[
:untracked
]
&&
!
validate_boolean
(
@cache
[
:untracked
])
raise
ValidationError
,
"cache:untracked parameter should be an boolean"
end
true
end
def
validate_job!
(
name
,
job
)
validate_job_name!
(
name
)
validate_job_keys!
(
name
,
job
)
validate_job_types!
(
name
,
job
)
validate_job_stage!
(
name
,
job
)
if
job
[
:stage
]
validate_job_cache!
(
name
,
job
)
if
job
[
:cache
]
validate_job_artifacts!
(
name
,
job
)
if
job
[
:artifacts
]
validate_job_dependencies!
(
name
,
job
)
if
job
[
:dependencies
]
if
@cache
[
:paths
]
&&
!
validate_array_of_strings
(
@cache
[
:paths
])
raise
ValidationError
,
"cache:paths parameter should be an array of strings"
end
end
private
def
validate_job_name!
(
name
)
if
name
.
blank?
||
!
validate_string
(
name
)
raise
ValidationError
,
"job name should be non-empty string"
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
浏览文件 @
42102b43
...
...
@@ -335,12 +335,12 @@ module Ci
describe
"after_script"
do
context
"in global context"
do
let
(
:config
)
{
let
(
:config
)
do
{
after_script:
[
"after_script"
],
test:
{
script:
[
"script"
]
}
}
}
end
it
"return after_script in options"
do
expect
(
subject
[
:options
][
:after_script
]).
to
eq
([
"after_script"
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录