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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
a80733e2
Commit
a80733e2
authored
Mar 26, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:gitlabhq/gitlabhq
parents
fe2e1ac3
ff23209a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
19 deletions
+26
-19
app/models/project_services/buildbox_service.rb
app/models/project_services/buildbox_service.rb
+14
-12
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+6
-1
spec/models/project_services/buildbox_service_spec.rb
spec/models/project_services/buildbox_service_spec.rb
+6
-6
No files found.
app/models/project_services/buildbox_service.rb
View file @
a80733e2
...
@@ -20,7 +20,11 @@
...
@@ -20,7 +20,11 @@
require
"addressable/uri"
require
"addressable/uri"
# Buildbox renamed to Buildkite, but for backwards compatability with the STI
# of Services, the class name is kept as "Buildbox"
class
BuildboxService
<
CiService
class
BuildboxService
<
CiService
ENDPOINT
=
"https://buildkite.com"
prop_accessor
:project_url
,
:token
prop_accessor
:project_url
,
:token
validates
:project_url
,
presence:
true
,
if: :activated?
validates
:project_url
,
presence:
true
,
if: :activated?
...
@@ -29,7 +33,7 @@ class BuildboxService < CiService
...
@@ -29,7 +33,7 @@ class BuildboxService < CiService
after_save
:compose_service_hook
,
if: :activated?
after_save
:compose_service_hook
,
if: :activated?
def
webhook_url
def
webhook_url
"
#{
build
box
_endpoint
(
'webhook'
)
}
/deliver/
#{
webhook_token
}
"
"
#{
build
kite
_endpoint
(
'webhook'
)
}
/deliver/
#{
webhook_token
}
"
end
end
def
compose_service_hook
def
compose_service_hook
...
@@ -59,7 +63,7 @@ class BuildboxService < CiService
...
@@ -59,7 +63,7 @@ class BuildboxService < CiService
end
end
def
commit_status_path
(
sha
)
def
commit_status_path
(
sha
)
"
#{
build
box
_endpoint
(
'gitlab'
)
}
/status/
#{
status_token
}
.json?commit=
#{
sha
}
"
"
#{
build
kite
_endpoint
(
'gitlab'
)
}
/status/
#{
status_token
}
.json?commit=
#{
sha
}
"
end
end
def
build_page
(
sha
,
ref
)
def
build_page
(
sha
,
ref
)
...
@@ -71,11 +75,11 @@ class BuildboxService < CiService
...
@@ -71,11 +75,11 @@ class BuildboxService < CiService
end
end
def
status_img_path
def
status_img_path
"
#{
build
box
_endpoint
(
'badge'
)
}
/
#{
status_token
}
.svg"
"
#{
build
kite
_endpoint
(
'badge'
)
}
/
#{
status_token
}
.svg"
end
end
def
title
def
title
'Build
box
'
'Build
kite
'
end
end
def
description
def
description
...
@@ -83,18 +87,18 @@ class BuildboxService < CiService
...
@@ -83,18 +87,18 @@ class BuildboxService < CiService
end
end
def
to_param
def
to_param
'build
box
'
'build
kite
'
end
end
def
fields
def
fields
[
[
{
type:
'text'
,
{
type:
'text'
,
name:
'token'
,
name:
'token'
,
placeholder:
'Build
box
project GitLab token'
},
placeholder:
'Build
kite
project GitLab token'
},
{
type:
'text'
,
{
type:
'text'
,
name:
'project_url'
,
name:
'project_url'
,
placeholder:
'https://buildbox.io/example/project'
}
placeholder:
"
#{
ENDPOINT
}
/example/project"
}
]
]
end
end
...
@@ -116,11 +120,9 @@ class BuildboxService < CiService
...
@@ -116,11 +120,9 @@ class BuildboxService < CiService
end
end
end
end
def
buildbox_endpoint
(
subdomain
=
nil
)
def
buildkite_endpoint
(
subdomain
=
nil
)
endpoint
=
'https://buildbox.io'
if
subdomain
.
present?
if
subdomain
.
present?
uri
=
Addressable
::
URI
.
parse
(
endpoint
)
uri
=
Addressable
::
URI
.
parse
(
ENDPOINT
)
new_endpoint
=
"
#{
uri
.
scheme
||
'http'
}
://
#{
subdomain
}
.
#{
uri
.
host
}
"
new_endpoint
=
"
#{
uri
.
scheme
||
'http'
}
://
#{
subdomain
}
.
#{
uri
.
host
}
"
if
uri
.
port
.
present?
if
uri
.
port
.
present?
...
@@ -129,7 +131,7 @@ class BuildboxService < CiService
...
@@ -129,7 +131,7 @@ class BuildboxService < CiService
new_endpoint
new_endpoint
end
end
else
else
endpoint
ENDPOINT
end
end
end
end
end
end
app/views/admin/projects/show.html.haml
View file @
a80733e2
...
@@ -68,6 +68,11 @@
...
@@ -68,6 +68,11 @@
%strong
.cred
%strong
.cred
does not exist
does not exist
-
if
@project
.
archived?
%li
%span
.light
archived:
%strong
repository is read-only
%li
%li
%span
.light
access:
%span
.light
access:
%strong
%strong
...
@@ -97,7 +102,7 @@
...
@@ -97,7 +102,7 @@
%strong
#{
@group
.
name
}
%strong
#{
@group
.
name
}
group members (
#{
@group
.
group_members
.
count
}
)
group members (
#{
@group
.
group_members
.
count
}
)
.pull-right
.pull-right
=
link_to
admin_group_path
(
@group
),
class:
'btn btn-
sm
'
do
=
link_to
admin_group_path
(
@group
),
class:
'btn btn-
xs
'
do
%i
.fa.fa-pencil-square-o
%i
.fa.fa-pencil-square-o
%ul
.well-list
%ul
.well-list
-
@group_members
.
each
do
|
member
|
-
@group_members
.
each
do
|
member
|
...
...
spec/models/project_services/buildbox_service_spec.rb
View file @
a80733e2
...
@@ -36,7 +36,7 @@ describe BuildboxService do
...
@@ -36,7 +36,7 @@ describe BuildboxService do
@service
.
stub
(
@service
.
stub
(
project:
@project
,
project:
@project
,
service_hook:
true
,
service_hook:
true
,
project_url:
'https://build
box.io
/account-name/example-project'
,
project_url:
'https://build
kite.com
/account-name/example-project'
,
token:
'secret-sauce-webhook-token:secret-sauce-status-token'
token:
'secret-sauce-webhook-token:secret-sauce-status-token'
)
)
end
end
...
@@ -44,7 +44,7 @@ describe BuildboxService do
...
@@ -44,7 +44,7 @@ describe BuildboxService do
describe
:webhook_url
do
describe
:webhook_url
do
it
'returns the webhook url'
do
it
'returns the webhook url'
do
expect
(
@service
.
webhook_url
).
to
eq
(
expect
(
@service
.
webhook_url
).
to
eq
(
'https://webhook.build
box.io
/deliver/secret-sauce-webhook-token'
'https://webhook.build
kite.com
/deliver/secret-sauce-webhook-token'
)
)
end
end
end
end
...
@@ -52,7 +52,7 @@ describe BuildboxService do
...
@@ -52,7 +52,7 @@ describe BuildboxService do
describe
:commit_status_path
do
describe
:commit_status_path
do
it
'returns the correct status page'
do
it
'returns the correct status page'
do
expect
(
@service
.
commit_status_path
(
'2ab7834c'
)).
to
eq
(
expect
(
@service
.
commit_status_path
(
'2ab7834c'
)).
to
eq
(
'https://gitlab.build
box.io
/status/secret-sauce-status-token.json?commit=2ab7834c'
'https://gitlab.build
kite.com
/status/secret-sauce-status-token.json?commit=2ab7834c'
)
)
end
end
end
end
...
@@ -60,7 +60,7 @@ describe BuildboxService do
...
@@ -60,7 +60,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'
,
nil
)).
to
eq
(
expect
(
@service
.
build_page
(
'2ab7834c'
,
nil
)).
to
eq
(
'https://build
box.io
/account-name/example-project/builds?commit=2ab7834c'
'https://build
kite.com
/account-name/example-project/builds?commit=2ab7834c'
)
)
end
end
end
end
...
@@ -68,14 +68,14 @@ describe BuildboxService do
...
@@ -68,14 +68,14 @@ describe BuildboxService do
describe
:builds_page
do
describe
:builds_page
do
it
'returns the correct path to the builds page'
do
it
'returns the correct path to the builds page'
do
expect
(
@service
.
builds_path
).
to
eq
(
expect
(
@service
.
builds_path
).
to
eq
(
'https://build
box.io
/account-name/example-project/builds?branch=default-brancho'
'https://build
kite.com
/account-name/example-project/builds?branch=default-brancho'
)
)
end
end
end
end
describe
:status_img_path
do
describe
:status_img_path
do
it
'returns the correct path to the status image'
do
it
'returns the correct path to the status image'
do
expect
(
@service
.
status_img_path
).
to
eq
(
'https://badge.build
box.io
/secret-sauce-status-token.svg'
)
expect
(
@service
.
status_img_path
).
to
eq
(
'https://badge.build
kite.com
/secret-sauce-status-token.svg'
)
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