Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
83df6384
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
83df6384
编写于
5月 05, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disallow runner to pick untagged build if configured
上级
2aa57071
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
11 deletion
+31
-11
app/models/ci/build.rb
app/models/ci/build.rb
+4
-0
spec/models/build_spec.rb
spec/models/build_spec.rb
+27
-11
未找到文件。
app/models/ci/build.rb
浏览文件 @
83df6384
...
...
@@ -290,6 +290,10 @@ module Ci
end
def
can_be_served?
(
runner
)
if
tag_list
.
empty?
&&
!
runner
.
run_untagged?
return
false
end
(
tag_list
-
runner
.
tag_list
).
empty?
end
...
...
spec/models/build_spec.rb
浏览文件 @
83df6384
...
...
@@ -259,11 +259,11 @@ describe Ci::Build, models: true do
end
describe
'#can_be_served?'
do
let
(
:runner
)
{
FactoryGirl
.
create
:ci_runner
}
let
(
:runner
)
{
create
(
:ci_runner
)
}
before
{
build
.
project
.
runners
<<
runner
}
context
'
runner without
tags'
do
context
'
when runner does not have
tags'
do
it
'can handle builds without tags'
do
expect
(
build
.
can_be_served?
(
runner
)).
to
be_truthy
end
...
...
@@ -274,21 +274,37 @@ describe Ci::Build, models: true do
end
end
context
'
runner with
tags'
do
context
'
when runner has
tags'
do
before
{
runner
.
tag_list
=
[
'bb'
,
'cc'
]
}
it
'can handle builds without tags'
do
expect
(
build
.
can_be_served?
(
runner
)).
to
be_truthy
shared_examples
'tagged build picker'
do
it
'can handle build with matching tags'
do
build
.
tag_list
=
[
'bb'
]
expect
(
build
.
can_be_served?
(
runner
)).
to
be_truthy
end
it
'cannot handle build without matching tags'
do
build
.
tag_list
=
[
'aa'
]
expect
(
build
.
can_be_served?
(
runner
)).
to
be_falsey
end
end
it
'can handle build with matching tags'
do
build
.
tag_list
=
[
'bb'
]
expect
(
build
.
can_be_served?
(
runner
)).
to
be_truthy
context
'when runner can pick untagged jobs'
do
it
'can handle builds without tags'
do
expect
(
build
.
can_be_served?
(
runner
)).
to
be_truthy
end
it_behaves_like
'tagged build picker'
end
it
'cannot handle build with not matching tags'
do
build
.
tag_list
=
[
'aa'
]
expect
(
build
.
can_be_served?
(
runner
)).
to
be_falsey
context
'when runner can not pick untagged jobs'
do
before
{
runner
.
run_untagged
=
false
}
it
'can not handle builds without tags'
do
expect
(
build
.
can_be_served?
(
runner
)).
to
be_falsey
end
it_behaves_like
'tagged build picker'
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录