Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
513d551c
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 搜索 >>
提交
513d551c
编写于
12月 11, 2015
作者:
K
Kamil Trzcinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix after column rename
上级
73b04beb
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
21 addition
and
30 deletion
+21
-30
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+2
-2
lib/ci/api/entities.rb
lib/ci/api/entities.rb
+0
-9
spec/lib/gitlab/backend/grack_auth_spec.rb
spec/lib/gitlab/backend/grack_auth_spec.rb
+2
-2
spec/models/build_spec.rb
spec/models/build_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+4
-4
spec/requests/ci/api/builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+8
-8
spec/requests/ci/api/runners_spec.rb
spec/requests/ci/api/runners_spec.rb
+1
-1
未找到文件。
app/controllers/projects_controller.rb
浏览文件 @
513d551c
...
@@ -210,7 +210,7 @@ class ProjectsController < ApplicationController
...
@@ -210,7 +210,7 @@ class ProjectsController < ApplicationController
def
project_params
def
project_params
params
.
require
(
:project
).
permit
(
params
.
require
(
:project
).
permit
(
:name
,
:path
,
:description
,
:issues_tracker
,
:tag_list
,
:token
,
:name
,
:path
,
:description
,
:issues_tracker
,
:tag_list
,
:
runners_
token
,
:issues_enabled
,
:merge_requests_enabled
,
:snippets_enabled
,
:issues_tracker_id
,
:default_branch
,
:issues_enabled
,
:merge_requests_enabled
,
:snippets_enabled
,
:issues_tracker_id
,
:default_branch
,
:wiki_enabled
,
:visibility_level
,
:import_url
,
:last_activity_at
,
:namespace_id
,
:avatar
,
:wiki_enabled
,
:visibility_level
,
:import_url
,
:last_activity_at
,
:namespace_id
,
:avatar
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
...
...
app/models/ci/build.rb
浏览文件 @
513d551c
...
@@ -194,7 +194,7 @@ module Ci
...
@@ -194,7 +194,7 @@ module Ci
def
trace
def
trace
trace
=
raw_trace
trace
=
raw_trace
if
project
&&
trace
.
present?
if
project
&&
trace
.
present?
trace
.
gsub
(
project
.
token
,
'xxxxxx'
)
trace
.
gsub
(
project
.
runners_
token
,
'xxxxxx'
)
else
else
trace
trace
end
end
...
@@ -221,7 +221,7 @@ module Ci
...
@@ -221,7 +221,7 @@ module Ci
end
end
def
token
def
token
project
.
token
project
.
runners_
token
end
end
def
valid_token?
token
def
valid_token?
token
...
...
app/views/projects/edit.html.haml
浏览文件 @
513d551c
...
@@ -163,9 +163,9 @@
...
@@ -163,9 +163,9 @@
%legend
%legend
Advanced settings
Advanced settings
.form-group
.form-group
=
f
.
label
:token
,
"CI token"
,
class:
'control-label'
=
f
.
label
:
runners_
token
,
"CI token"
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
f
.
text_field
:token
,
class:
"form-control"
,
placeholder:
'xEeFCaDAB89'
=
f
.
text_field
:
runners_
token
,
class:
"form-control"
,
placeholder:
'xEeFCaDAB89'
%p
.help-block
The secure token used to checkout project.
%p
.help-block
The secure token used to checkout project.
.form-actions
.form-actions
...
...
lib/ci/api/entities.rb
浏览文件 @
513d551c
...
@@ -37,15 +37,6 @@ module Ci
...
@@ -37,15 +37,6 @@ module Ci
expose
:id
,
:token
expose
:id
,
:token
end
end
class
Project
<
Grape
::
Entity
expose
:id
,
:name
,
:token
,
:default_ref
,
:gitlab_url
,
:path
,
:always_build
,
:polling_interval
,
:public
,
:ssh_url_to_repo
,
:gitlab_id
expose
:timeout
do
|
model
|
model
.
timeout
end
end
class
RunnerProject
<
Grape
::
Entity
class
RunnerProject
<
Grape
::
Entity
expose
:id
,
:project_id
,
:runner_id
expose
:id
,
:project_id
,
:runner_id
end
end
...
...
spec/lib/gitlab/backend/grack_auth_spec.rb
浏览文件 @
513d551c
...
@@ -191,10 +191,10 @@ describe Grack::Auth, lib: true do
...
@@ -191,10 +191,10 @@ describe Grack::Auth, lib: true do
context
"when a gitlab ci token is provided"
do
context
"when a gitlab ci token is provided"
do
let
(
:token
)
{
"123"
}
let
(
:token
)
{
"123"
}
let
(
:project
)
{
FactoryGirl
.
create
:empty_project
,
token:
token
}
let
(
:project
)
{
FactoryGirl
.
create
:empty_project
}
before
do
before
do
project
.
update_attributes
(
token:
token
,
builds_enabled:
true
)
project
.
update_attributes
(
runners_
token:
token
,
builds_enabled:
true
)
env
[
"HTTP_AUTHORIZATION"
]
=
ActionController
::
HttpAuthentication
::
Basic
.
encode_credentials
(
"gitlab-ci-token"
,
token
)
env
[
"HTTP_AUTHORIZATION"
]
=
ActionController
::
HttpAuthentication
::
Basic
.
encode_credentials
(
"gitlab-ci-token"
,
token
)
end
end
...
...
spec/models/build_spec.rb
浏览文件 @
513d551c
...
@@ -111,7 +111,7 @@ describe Ci::Build, models: true do
...
@@ -111,7 +111,7 @@ describe Ci::Build, models: true do
let
(
:token
)
{
'my_secret_token'
}
let
(
:token
)
{
'my_secret_token'
}
before
do
before
do
build
.
project
.
update_attributes
(
token:
token
)
build
.
project
.
update_attributes
(
runners_
token:
token
)
build
.
update_attributes
(
trace:
token
)
build
.
update_attributes
(
trace:
token
)
end
end
...
...
spec/models/project_spec.rb
浏览文件 @
513d551c
...
@@ -98,13 +98,13 @@ describe Project, models: true do
...
@@ -98,13 +98,13 @@ describe Project, models: true do
describe
'project token'
do
describe
'project token'
do
it
'should set an random token if none provided'
do
it
'should set an random token if none provided'
do
project
=
FactoryGirl
.
create
:empty_project
,
token:
''
project
=
FactoryGirl
.
create
:empty_project
,
runners_
token:
''
expect
(
project
.
token
).
not_to
eq
(
''
)
expect
(
project
.
runners_
token
).
not_to
eq
(
''
)
end
end
it
'should not set an random toke if one provided'
do
it
'should not set an random toke if one provided'
do
project
=
FactoryGirl
.
create
:empty_project
,
token:
'my-token'
project
=
FactoryGirl
.
create
:empty_project
,
runners_
token:
'my-token'
expect
(
project
.
token
).
to
eq
(
'my-token'
)
expect
(
project
.
runners_
token
).
to
eq
(
'my-token'
)
end
end
end
end
...
...
spec/requests/ci/api/builds_spec.rb
浏览文件 @
513d551c
...
@@ -131,7 +131,7 @@ describe Ci::API::API do
...
@@ -131,7 +131,7 @@ describe Ci::API::API do
let
(
:delete_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:delete_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:get_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:get_url
)
{
ci_api
(
"/builds/
#{
build
.
id
}
/artifacts"
)
}
let
(
:headers
)
{
{
"GitLab-Workhorse"
=>
"1.0"
}
}
let
(
:headers
)
{
{
"GitLab-Workhorse"
=>
"1.0"
}
}
let
(
:headers_with_token
)
{
headers
.
merge
(
Ci
::
API
::
Helpers
::
BUILD_TOKEN_HEADER
=>
build
.
project
.
token
)
}
let
(
:headers_with_token
)
{
headers
.
merge
(
Ci
::
API
::
Helpers
::
BUILD_TOKEN_HEADER
=>
build
.
token
)
}
describe
"POST /builds/:id/artifacts/authorize"
do
describe
"POST /builds/:id/artifacts/authorize"
do
context
"should authorize posting artifact to running build"
do
context
"should authorize posting artifact to running build"
do
...
@@ -140,7 +140,7 @@ describe Ci::API::API do
...
@@ -140,7 +140,7 @@ describe Ci::API::API do
end
end
it
"using token as parameter"
do
it
"using token as parameter"
do
post
authorize_url
,
{
token:
build
.
project
.
token
},
headers
post
authorize_url
,
{
token:
build
.
token
},
headers
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
"TempPath"
]).
to_not
be_nil
expect
(
json_response
[
"TempPath"
]).
to_not
be_nil
end
end
...
@@ -159,7 +159,7 @@ describe Ci::API::API do
...
@@ -159,7 +159,7 @@ describe Ci::API::API do
it
"using token as parameter"
do
it
"using token as parameter"
do
stub_application_setting
(
max_artifacts_size:
0
)
stub_application_setting
(
max_artifacts_size:
0
)
post
authorize_url
,
{
token:
build
.
project
.
token
,
filesize:
100
},
headers
post
authorize_url
,
{
token:
build
.
token
,
filesize:
100
},
headers
expect
(
response
.
status
).
to
eq
(
413
)
expect
(
response
.
status
).
to
eq
(
413
)
end
end
...
@@ -239,7 +239,7 @@ describe Ci::API::API do
...
@@ -239,7 +239,7 @@ describe Ci::API::API do
end
end
it
do
it
do
post
post_url
,
{
token:
build
.
project
.
token
},
{}
post
post_url
,
{
token:
build
.
token
},
{}
expect
(
response
.
status
).
to
eq
(
403
)
expect
(
response
.
status
).
to
eq
(
403
)
end
end
end
end
...
@@ -279,12 +279,12 @@ describe Ci::API::API do
...
@@ -279,12 +279,12 @@ describe Ci::API::API do
describe
"DELETE /builds/:id/artifacts"
do
describe
"DELETE /builds/:id/artifacts"
do
before
do
before
do
build
.
run!
build
.
run!
post
delete_url
,
token:
build
.
project
.
token
,
file:
file_upload
post
delete_url
,
token:
build
.
token
,
file:
file_upload
end
end
it
"should delete artifact build"
do
it
"should delete artifact build"
do
build
.
success
build
.
success
delete
delete_url
,
token:
build
.
project
.
token
delete
delete_url
,
token:
build
.
token
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
end
end
...
@@ -296,12 +296,12 @@ describe Ci::API::API do
...
@@ -296,12 +296,12 @@ describe Ci::API::API do
it
"should download artifact"
do
it
"should download artifact"
do
build
.
update_attributes
(
artifacts_file:
file_upload
)
build
.
update_attributes
(
artifacts_file:
file_upload
)
get
get_url
,
token:
build
.
project
.
token
get
get_url
,
token:
build
.
token
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
end
end
it
"should fail to download if no artifact uploaded"
do
it
"should fail to download if no artifact uploaded"
do
get
get_url
,
token:
build
.
project
.
token
get
get_url
,
token:
build
.
token
expect
(
response
.
status
).
to
eq
(
404
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
end
end
...
...
spec/requests/ci/api/runners_spec.rb
浏览文件 @
513d551c
...
@@ -31,7 +31,7 @@ describe Ci::API::API do
...
@@ -31,7 +31,7 @@ describe Ci::API::API do
describe
"should create a runner if project token provided"
do
describe
"should create a runner if project token provided"
do
let
(
:project
)
{
FactoryGirl
.
create
(
:empty_project
)
}
let
(
:project
)
{
FactoryGirl
.
create
(
:empty_project
)
}
before
{
post
ci_api
(
"/runners/register"
),
token:
project
.
token
}
before
{
post
ci_api
(
"/runners/register"
),
token:
project
.
runners_
token
}
it
{
expect
(
response
.
status
).
to
eq
(
201
)
}
it
{
expect
(
response
.
status
).
to
eq
(
201
)
}
it
{
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
}
it
{
expect
(
project
.
runners
.
size
).
to
eq
(
1
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录