Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
513d551c
Commit
513d551c
authored
Dec 11, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix after column rename
parent
73b04beb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
21 additions
and
30 deletions
+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
No files found.
app/controllers/projects_controller.rb
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment