Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
4cc77c3b
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 搜索 >>
提交
4cc77c3b
编写于
5月 19, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor runner-related code refactorings
上级
c3c503d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
21 deletion
+22
-21
app/controllers/admin/runners_controller.rb
app/controllers/admin/runners_controller.rb
+10
-9
app/views/projects/runners/_form.html.haml
app/views/projects/runners/_form.html.haml
+1
-1
spec/features/runners_spec.rb
spec/features/runners_spec.rb
+1
-1
spec/requests/ci/api/runners_spec.rb
spec/requests/ci/api/runners_spec.rb
+10
-10
未找到文件。
app/controllers/admin/runners_controller.rb
浏览文件 @
4cc77c3b
...
...
@@ -9,17 +9,18 @@ class Admin::RunnersController < Admin::ApplicationController
end
def
show
set
_builds_and_projects
assign
_builds_and_projects
end
def
update
unless
@runner
.
update_attributes
(
runner_params
)
set_builds_and_projects
and
return
render
'show'
end
respond_to
do
|
format
|
format
.
js
format
.
html
{
redirect_to
admin_runner_path
(
@runner
)
}
if
@runner
.
update_attributes
(
runner_params
)
respond_to
do
|
format
|
format
.
js
format
.
html
{
redirect_to
admin_runner_path
(
@runner
)
}
end
else
assign_builds_and_projects
render
'show'
end
end
...
...
@@ -55,7 +56,7 @@ class Admin::RunnersController < Admin::ApplicationController
params
.
require
(
:runner
).
permit
(
Ci
::
Runner
::
FORM_EDITABLE
)
end
def
set
_builds_and_projects
def
assign
_builds_and_projects
@builds
=
runner
.
builds
.
order
(
'id DESC'
).
first
(
30
)
@projects
=
if
params
[
:search
].
present?
...
...
app/views/projects/runners/_form.html.haml
浏览文件 @
4cc77c3b
...
...
@@ -11,7 +11,7 @@
.col-sm-10
.checkbox
=
f
.
check_box
:run_untagged
%span
.light
Indicates whether runner can pick jobs without tags
%span
.light
Indicates whether
this
runner can pick jobs without tags
.form-group
=
label_tag
:token
,
class:
'control-label'
do
Token
...
...
spec/features/runners_spec.rb
浏览文件 @
4cc77c3b
...
...
@@ -129,7 +129,7 @@ describe "Runners" do
context
'when runner has tags'
do
before
{
runner
.
update_attribute
(
:tag_list
,
[
'tag'
])
}
scenario
'user want to prevent runner from running untagged job'
do
scenario
'user want
s
to prevent runner from running untagged job'
do
visit
runners_path
(
project
)
page
.
within
(
'.activated-specific-runners'
)
do
first
(
'small > a'
).
click
...
...
spec/requests/ci/api/runners_spec.rb
浏览文件 @
4cc77c3b
...
...
@@ -16,7 +16,7 @@ describe Ci::API::API do
before
{
post
ci_api
(
"/runners/register"
),
token:
registration_token
}
it
'creates runner with default values'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
true
end
end
...
...
@@ -28,7 +28,7 @@ describe Ci::API::API do
end
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
description
).
to
eq
(
"server.hostname"
)
end
end
...
...
@@ -40,7 +40,7 @@ describe Ci::API::API do
end
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
tag_list
.
sort
).
to
eq
([
"tag1"
,
"tag2"
])
end
end
...
...
@@ -52,7 +52,7 @@ describe Ci::API::API do
run_untagged:
false
,
tag_list:
[
'tag'
]
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
Ci
::
Runner
.
first
.
run_untagged
).
to
be
false
end
end
...
...
@@ -62,7 +62,7 @@ describe Ci::API::API do
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
run_untagged:
false
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
).
to
have_http_status
404
end
end
end
...
...
@@ -72,7 +72,7 @@ describe Ci::API::API do
before
{
post
ci_api
(
"/runners/register"
),
token:
project
.
runners_token
}
it
'creates runner'
do
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
end
end
...
...
@@ -81,7 +81,7 @@ describe Ci::API::API do
it
'returns 403 error'
do
post
ci_api
(
"/runners/register"
),
token:
'invalid'
expect
(
response
.
status
).
to
eq
(
403
)
expect
(
response
).
to
have_http_status
403
end
end
...
...
@@ -89,7 +89,7 @@ describe Ci::API::API do
it
'returns 400 error'
do
post
ci_api
(
"/runners/register"
)
expect
(
response
.
status
).
to
eq
(
400
)
expect
(
response
).
to
have_http_status
400
end
end
...
...
@@ -101,7 +101,7 @@ describe Ci::API::API do
it
do
post
ci_api
(
"/runners/register"
),
token:
registration_token
,
info:
{
param
=>
value
}
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_http_status
201
is_expected
.
to
eq
(
value
)
end
end
...
...
@@ -112,7 +112,7 @@ describe Ci::API::API do
let!
(
:runner
)
{
FactoryGirl
.
create
(
:ci_runner
)
}
before
{
delete
ci_api
(
"/runners/delete"
),
token:
runner
.
token
}
it
{
expect
(
response
.
status
).
to
eq
(
200
)
}
it
{
expect
(
response
).
to
have_http_status
200
}
it
{
expect
(
Ci
::
Runner
.
count
).
to
eq
(
0
)
}
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录