Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f83bccfe
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,发现更多精彩内容 >>
提交
f83bccfe
编写于
7月 20, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add minor readability, style improvements in CI config
上级
795c9f22
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
21 addition
and
20 deletion
+21
-20
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+2
-3
lib/gitlab/ci/config/node/artifacts.rb
lib/gitlab/ci/config/node/artifacts.rb
+4
-3
lib/gitlab/ci/config/node/attributable.rb
lib/gitlab/ci/config/node/attributable.rb
+1
-1
lib/gitlab/ci/config/node/entry.rb
lib/gitlab/ci/config/node/entry.rb
+2
-2
lib/gitlab/ci/config/node/job.rb
lib/gitlab/ci/config/node/job.rb
+5
-4
lib/gitlab/ci/config/node/jobs.rb
lib/gitlab/ci/config/node/jobs.rb
+5
-5
lib/gitlab/ci/config/node/undefined.rb
lib/gitlab/ci/config/node/undefined.rb
+1
-1
spec/lib/gitlab/ci/config/node/artifacts_spec.rb
spec/lib/gitlab/ci/config/node/artifacts_spec.rb
+1
-1
未找到文件。
lib/ci/gitlab_ci_yaml_processor.rb
浏览文件 @
f83bccfe
...
...
@@ -8,7 +8,8 @@ module Ci
def
initialize
(
config
,
path
=
nil
)
@ci_config
=
Gitlab
::
Ci
::
Config
.
new
(
config
)
@config
,
@path
=
@ci_config
.
to_hash
,
path
@config
=
@ci_config
.
to_hash
@path
=
path
unless
@ci_config
.
valid?
raise
ValidationError
,
@ci_config
.
errors
.
first
...
...
@@ -120,8 +121,6 @@ module Ci
end
def
validate_job!
(
name
,
job
)
raise
ValidationError
,
"Unknown parameter:
#{
name
}
"
unless
job
.
is_a?
(
Hash
)
&&
job
.
has_key?
(
:script
)
validate_job_stage!
(
name
,
job
)
if
job
[
:stage
]
validate_job_dependencies!
(
name
,
job
)
if
job
[
:dependencies
]
end
...
...
lib/gitlab/ci/config/node/artifacts.rb
浏览文件 @
f83bccfe
...
...
@@ -9,12 +9,13 @@ module Gitlab
include
Validatable
include
Attributable
attributes
:name
,
:untracked
,
:paths
,
:when
,
:expire_in
ALLOWED_KEYS
=
%i[name untracked paths when expire_in]
attributes
ALLOWED_KEYS
validations
do
validates
:config
,
type:
Hash
validates
:config
,
allowed_keys:
%i[name untracked paths when expire_in]
validates
:config
,
allowed_keys:
ALLOWED_KEYS
with_options
allow_nil:
true
do
validates
:name
,
type:
String
...
...
lib/gitlab/ci/config/node/attributable.rb
浏览文件 @
f83bccfe
...
...
@@ -7,7 +7,7 @@ module Gitlab
class_methods
do
def
attributes
(
*
attributes
)
attributes
.
each
do
|
attribute
|
attributes
.
flatten
.
each
do
|
attribute
|
define_method
(
attribute
)
do
return
unless
config
.
is_a?
(
Hash
)
...
...
lib/gitlab/ci/config/node/entry.rb
浏览文件 @
f83bccfe
...
...
@@ -24,7 +24,7 @@ module Gitlab
return
unless
valid?
compose!
@entries
.
each_value
(
&
:process!
)
descendants
.
each
(
&
:process!
)
end
def
leaf?
...
...
@@ -44,7 +44,7 @@ module Gitlab
end
def
errors
@validator
.
messages
+
@entries
.
value
s
.
flat_map
(
&
:errors
)
@validator
.
messages
+
descendant
s
.
flat_map
(
&
:errors
)
end
def
value
...
...
lib/gitlab/ci/config/node/job.rb
浏览文件 @
f83bccfe
...
...
@@ -9,13 +9,14 @@ module Gitlab
include
Configurable
include
Attributable
ALLOWED_KEYS
=
%i[tags script only except type image services allow_failure
type stage when artifacts cache dependencies before_script
after_script variables environment]
attributes
:tags
,
:allow_failure
,
:when
,
:environment
validations
do
validates
:config
,
allowed_keys:
%i[tags script only except type image services allow_failure
type stage when artifacts cache dependencies before_script
after_script variables environment]
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:config
,
presence:
true
validates
:name
,
presence:
true
...
...
lib/gitlab/ci/config/node/jobs.rb
浏览文件 @
f83bccfe
...
...
@@ -18,10 +18,14 @@ module Gitlab
end
def
has_visible_job?
config
.
any?
{
|
key
,
_
|
!
key
.
to_s
.
start_with?
(
'.'
)
}
config
.
any?
{
|
name
,
_
|
!
hidden?
(
name
)
}
end
end
def
hidden?
(
name
)
name
.
to_s
.
start_with?
(
'.'
)
end
private
def
compose!
...
...
@@ -37,10 +41,6 @@ module Gitlab
@entries
[
name
]
=
factory
.
create!
end
end
def
hidden?
(
name
)
name
.
to_s
.
start_with?
(
'.'
)
end
end
end
end
...
...
lib/gitlab/ci/config/node/undefined.rb
浏览文件 @
f83bccfe
...
...
@@ -5,7 +5,7 @@ module Gitlab
##
# This class represents an undefined and unspecified entry node.
#
# It decorates original entry adding method that idicates it is
# It decorates original entry adding method that i
n
dicates it is
# unspecified.
#
class
Undefined
<
SimpleDelegator
...
...
spec/lib/gitlab/ci/config/node/artifacts_spec.rb
浏览文件 @
f83bccfe
...
...
@@ -31,7 +31,7 @@ describe Gitlab::Ci::Config::Node::Artifacts do
end
end
context
'when there is
uknown key
'
do
context
'when there is
an unknown key present
'
do
let
(
:config
)
{
{
test:
100
}
}
it
'reports error'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录