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
Jérome Perrin
gitlab-ce
Commits
e5fe14b2
Commit
e5fe14b2
authored
Mar 05, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Link to CI with ref
parent
478f92d2
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
24 deletions
+25
-24
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-2
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+1
-1
app/models/project_services/bamboo_service.rb
app/models/project_services/bamboo_service.rb
+2
-2
app/models/project_services/buildbox_service.rb
app/models/project_services/buildbox_service.rb
+2
-2
app/models/project_services/ci_service.rb
app/models/project_services/ci_service.rb
+2
-2
app/models/project_services/gitlab_ci_service.rb
app/models/project_services/gitlab_ci_service.rb
+10
-10
app/models/project_services/teamcity_service.rb
app/models/project_services/teamcity_service.rb
+2
-2
spec/models/project_services/buildbox_service_spec.rb
spec/models/project_services/buildbox_service_spec.rb
+1
-1
spec/models/project_services/gitlab_ci_service_spec.rb
spec/models/project_services/gitlab_ci_service_spec.rb
+2
-2
No files found.
CHANGELOG
View file @
e5fe14b2
...
@@ -13,6 +13,7 @@ v 7.10.0 (unreleased)
...
@@ -13,6 +13,7 @@ v 7.10.0 (unreleased)
- Identical look of selectboxes in UI
- Identical look of selectboxes in UI
- Move "Import existing repository by URL" option to button.
- Move "Import existing repository by URL" option to button.
- Improve error message when save profile has error.
- Improve error message when save profile has error.
- Passing the name of pushed ref to CI service (requires GitLab CI 7.9+)
v 7.9.0 (unreleased)
v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu)
- Add HipChat integration documentation (Stan Hu)
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
e5fe14b2
...
@@ -160,10 +160,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -160,10 +160,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
ci_status
def
ci_status
ci_service
=
@merge_request
.
source_project
.
ci_service
ci_service
=
@merge_request
.
source_project
.
ci_service
status
=
ci_service
.
commit_status
(
merge_request
.
last_commit
.
sha
)
status
=
ci_service
.
commit_status
(
merge_request
.
last_commit
.
sha
,
merge_request
.
source_branch
)
if
ci_service
.
respond_to?
(
:commit_coverage
)
if
ci_service
.
respond_to?
(
:commit_coverage
)
coverage
=
ci_service
.
commit_coverage
(
merge_request
.
last_commit
.
sha
)
coverage
=
ci_service
.
commit_coverage
(
merge_request
.
last_commit
.
sha
,
merge_request
.
source_branch
)
end
end
response
=
{
response
=
{
...
...
app/helpers/merge_requests_helper.rb
View file @
e5fe14b2
...
@@ -35,7 +35,7 @@ module MergeRequestsHelper
...
@@ -35,7 +35,7 @@ module MergeRequestsHelper
end
end
def
ci_build_details_path
(
merge_request
)
def
ci_build_details_path
(
merge_request
)
merge_request
.
source_project
.
ci_service
.
build_page
(
merge_request
.
last_commit
.
sha
)
merge_request
.
source_project
.
ci_service
.
build_page
(
merge_request
.
last_commit
.
sha
,
merge_request
.
source_branch
)
end
end
def
merge_path_description
(
merge_request
,
separator
)
def
merge_path_description
(
merge_request
,
separator
)
...
...
app/models/project_services/bamboo_service.rb
View file @
e5fe14b2
...
@@ -93,7 +93,7 @@ class BambooService < CiService
...
@@ -93,7 +93,7 @@ class BambooService < CiService
end
end
end
end
def
build_page
(
sha
)
def
build_page
(
sha
,
ref
)
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
if
@response
.
code
!=
200
||
@response
[
'results'
][
'results'
][
'size'
]
==
'0'
if
@response
.
code
!=
200
||
@response
[
'results'
][
'results'
][
'size'
]
==
'0'
...
@@ -106,7 +106,7 @@ class BambooService < CiService
...
@@ -106,7 +106,7 @@ class BambooService < CiService
end
end
end
end
def
commit_status
(
sha
)
def
commit_status
(
sha
,
ref
)
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
return
:error
unless
@response
.
code
==
200
||
@response
.
code
==
404
return
:error
unless
@response
.
code
==
200
||
@response
.
code
==
404
...
...
app/models/project_services/buildbox_service.rb
View file @
e5fe14b2
...
@@ -48,7 +48,7 @@ class BuildboxService < CiService
...
@@ -48,7 +48,7 @@ class BuildboxService < CiService
service_hook
.
execute
(
data
)
service_hook
.
execute
(
data
)
end
end
def
commit_status
(
sha
)
def
commit_status
(
sha
,
ref
)
response
=
HTTParty
.
get
(
commit_status_path
(
sha
),
verify:
false
)
response
=
HTTParty
.
get
(
commit_status_path
(
sha
),
verify:
false
)
if
response
.
code
==
200
&&
response
[
'status'
]
if
response
.
code
==
200
&&
response
[
'status'
]
...
@@ -62,7 +62,7 @@ class BuildboxService < CiService
...
@@ -62,7 +62,7 @@ class BuildboxService < CiService
"
#{
buildbox_endpoint
(
'gitlab'
)
}
/status/
#{
status_token
}
.json?commit=
#{
sha
}
"
"
#{
buildbox_endpoint
(
'gitlab'
)
}
/status/
#{
status_token
}
.json?commit=
#{
sha
}
"
end
end
def
build_page
(
sha
)
def
build_page
(
sha
,
ref
)
"
#{
project_url
}
/builds?commit=
#{
sha
}
"
"
#{
project_url
}
/builds?commit=
#{
sha
}
"
end
end
...
...
app/models/project_services/ci_service.rb
View file @
e5fe14b2
...
@@ -34,7 +34,7 @@ class CiService < Service
...
@@ -34,7 +34,7 @@ class CiService < Service
# Ex.
# Ex.
# http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c
# http://jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c
#
#
def
build_page
(
sha
)
def
build_page
(
sha
,
ref
)
# implement inside child
# implement inside child
end
end
...
@@ -51,7 +51,7 @@ class CiService < Service
...
@@ -51,7 +51,7 @@ class CiService < Service
# # => 'running'
# # => 'running'
#
#
#
#
def
commit_status
(
sha
)
def
commit_status
(
sha
,
ref
)
# implement inside child
# implement inside child
end
end
end
end
app/models/project_services/gitlab_ci_service.rb
View file @
e5fe14b2
...
@@ -40,17 +40,17 @@ class GitlabCiService < CiService
...
@@ -40,17 +40,17 @@ class GitlabCiService < CiService
service_hook
.
execute
(
data
)
service_hook
.
execute
(
data
)
end
end
def
commit_status_path
(
sha
)
def
commit_status_path
(
sha
,
ref
)
project_url
+
"/commits/
#{
sha
}
/status.json?token=
#{
token
}
"
project_url
+
"/
refs/
#{
ref
}
/
commits/
#{
sha
}
/status.json?token=
#{
token
}
"
end
end
def
get_ci_build
(
sha
)
def
get_ci_build
(
sha
,
ref
)
@ci_builds
||=
{}
@ci_builds
||=
{}
@ci_builds
[
sha
]
||=
HTTParty
.
get
(
commit_status_path
(
sha
),
verify:
false
)
@ci_builds
[
sha
]
||=
HTTParty
.
get
(
commit_status_path
(
sha
,
ref
),
verify:
false
)
end
end
def
commit_status
(
sha
)
def
commit_status
(
sha
,
ref
)
response
=
get_ci_build
(
sha
)
response
=
get_ci_build
(
sha
,
ref
)
if
response
.
code
==
200
and
response
[
"status"
]
if
response
.
code
==
200
and
response
[
"status"
]
response
[
"status"
]
response
[
"status"
]
...
@@ -59,16 +59,16 @@ class GitlabCiService < CiService
...
@@ -59,16 +59,16 @@ class GitlabCiService < CiService
end
end
end
end
def
commit_coverage
(
sha
)
def
commit_coverage
(
sha
,
ref
)
response
=
get_ci_build
(
sha
)
response
=
get_ci_build
(
sha
,
ref
)
if
response
.
code
==
200
and
response
[
"coverage"
]
if
response
.
code
==
200
and
response
[
"coverage"
]
response
[
"coverage"
]
response
[
"coverage"
]
end
end
end
end
def
build_page
(
sha
)
def
build_page
(
sha
,
ref
)
project_url
+
"/commits/
#{
sha
}
"
project_url
+
"/
refs/
#{
ref
}
/
commits/
#{
sha
}
"
end
end
def
builds_path
def
builds_path
...
...
app/models/project_services/teamcity_service.rb
View file @
e5fe14b2
...
@@ -88,7 +88,7 @@ class TeamcityService < CiService
...
@@ -88,7 +88,7 @@ class TeamcityService < CiService
@response
=
HTTParty
.
get
(
"
#{
url
}
"
,
verify:
false
,
basic_auth:
auth
)
@response
=
HTTParty
.
get
(
"
#{
url
}
"
,
verify:
false
,
basic_auth:
auth
)
end
end
def
build_page
(
sha
)
def
build_page
(
sha
,
ref
)
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
if
@response
.
code
!=
200
if
@response
.
code
!=
200
...
@@ -103,7 +103,7 @@ class TeamcityService < CiService
...
@@ -103,7 +103,7 @@ class TeamcityService < CiService
end
end
end
end
def
commit_status
(
sha
)
def
commit_status
(
sha
,
ref
)
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
build_info
(
sha
)
if
@response
.
nil?
||
!
@response
.
code
return
:error
unless
@response
.
code
==
200
||
@response
.
code
==
404
return
:error
unless
@response
.
code
==
200
||
@response
.
code
==
404
...
...
spec/models/project_services/buildbox_service_spec.rb
View file @
e5fe14b2
...
@@ -59,7 +59,7 @@ describe BuildboxService do
...
@@ -59,7 +59,7 @@ describe BuildboxService do
describe
:build_page
do
describe
:build_page
do
it
'returns the correct build page'
do
it
'returns the correct build page'
do
expect
(
@service
.
build_page
(
'2ab7834c'
)).
to
eq
(
expect
(
@service
.
build_page
(
'2ab7834c'
,
nil
)).
to
eq
(
'https://buildbox.io/account-name/example-project/builds?commit=2ab7834c'
'https://buildbox.io/account-name/example-project/builds?commit=2ab7834c'
)
)
end
end
...
...
spec/models/project_services/gitlab_ci_service_spec.rb
View file @
e5fe14b2
...
@@ -39,11 +39,11 @@ describe GitlabCiService do
...
@@ -39,11 +39,11 @@ describe GitlabCiService do
end
end
describe
:commit_status_path
do
describe
:commit_status_path
do
it
{
expect
(
@service
.
commit_status_path
(
"2ab7834c"
)).
to
eq
(
"http://ci.gitlab.org/projects/2
/commits/2ab7834c/status.json?token=verySecret"
)}
it
{
expect
(
@service
.
commit_status_path
(
"2ab7834c"
,
'master'
)).
to
eq
(
"http://ci.gitlab.org/projects/2/refs/master
/commits/2ab7834c/status.json?token=verySecret"
)}
end
end
describe
:build_page
do
describe
:build_page
do
it
{
expect
(
@service
.
build_page
(
"2ab7834c"
)).
to
eq
(
"http://ci.gitlab.org/projects/2
/commits/2ab7834c"
)}
it
{
expect
(
@service
.
build_page
(
"2ab7834c"
,
'master'
)).
to
eq
(
"http://ci.gitlab.org/projects/2/refs/master
/commits/2ab7834c"
)}
end
end
end
end
end
end
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