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
dabbee65
Commit
dabbee65
authored
Sep 22, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Slack notification URL and remove the usage of Ci::RoutesHelper
parent
0ce5fb71
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
37 deletions
+12
-37
app/helpers/ci/routes_helper.rb
app/helpers/ci/routes_helper.rb
+0
-29
app/models/project_services/ci/hip_chat_message.rb
app/models/project_services/ci/hip_chat_message.rb
+5
-3
app/models/project_services/ci/slack_message.rb
app/models/project_services/ci/slack_message.rb
+6
-4
app/models/project_services/gitlab_ci_service.rb
app/models/project_services/gitlab_ci_service.rb
+1
-1
No files found.
app/helpers/ci/routes_helper.rb
deleted
100644 → 0
View file @
0ce5fb71
module
Ci
module
RoutesHelper
class
Base
include
Gitlab
::
Application
.
routes
.
url_helpers
def
default_url_options
{
host:
Settings
.
gitlab
[
'host'
],
protocol:
Settings
.
gitlab
[
'https'
]
?
"https"
:
"http"
,
port:
Settings
.
gitlab
[
'port'
]
}
end
end
def
url_helpers
@url_helpers
||=
Base
.
new
end
def
self
.
method_missing
(
method
,
*
args
,
&
block
)
@url_helpers
||=
Base
.
new
if
@url_helpers
.
respond_to?
(
method
)
@url_helpers
.
send
(
method
,
*
args
,
&
block
)
else
super
method
,
*
args
,
&
block
end
end
end
end
app/models/project_services/ci/hip_chat_message.rb
View file @
dabbee65
module
Ci
module
Ci
class
HipChatMessage
class
HipChatMessage
include
Gitlab
::
Application
.
routes
.
url_helpers
attr_reader
:build
attr_reader
:build
def
initialize
(
build
)
def
initialize
(
build
)
...
@@ -8,13 +10,13 @@ module Ci
...
@@ -8,13 +10,13 @@ module Ci
def
to_s
def
to_s
lines
=
Array
.
new
lines
=
Array
.
new
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_url
(
project
)
}
\"
>
#{
project
.
name
}
</a> - "
)
lines
.
push
(
"<a href=
\"
#{
ci_project_url
(
project
)
}
\"
>
#{
project
.
name
}
</a> - "
)
if
commit
.
matrix?
if
commit
.
matrix?
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_ref_commits_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
\"
>Commit #
#{
commit
.
id
}
</a></br>"
)
lines
.
push
(
"<a href=
\"
#{
ci_project_ref_commits_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
\"
>Commit #
#{
commit
.
id
}
</a></br>"
)
else
else
first_build
=
commit
.
builds_without_retry
.
first
first_build
=
commit
.
builds_without_retry
.
first
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_build_url
(
project
,
first_build
)
}
\"
>Build '
#{
first_build
.
name
}
' #
#{
first_build
.
id
}
</a></br>"
)
lines
.
push
(
"<a href=
\"
#{
ci_project_build_url
(
project
,
first_build
)
}
\"
>Build '
#{
first_build
.
name
}
' #
#{
first_build
.
id
}
</a></br>"
)
end
end
lines
.
push
(
"
#{
commit
.
short_sha
}
#{
commit
.
git_author_name
}
-
#{
commit
.
git_commit_message
}
</br>"
)
lines
.
push
(
"
#{
commit
.
short_sha
}
#{
commit
.
git_author_name
}
-
#{
commit
.
git_commit_message
}
</br>"
)
...
...
app/models/project_services/ci/slack_message.rb
View file @
dabbee65
...
@@ -2,6 +2,8 @@ require 'slack-notifier'
...
@@ -2,6 +2,8 @@ require 'slack-notifier'
module
Ci
module
Ci
class
SlackMessage
class
SlackMessage
include
Gitlab
::
Application
.
routes
.
url_helpers
def
initialize
(
commit
)
def
initialize
(
commit
)
@commit
=
commit
@commit
=
commit
end
end
...
@@ -27,7 +29,7 @@ module Ci
...
@@ -27,7 +29,7 @@ module Ci
next
unless
build
.
failed?
next
unless
build
.
failed?
fields
<<
{
fields
<<
{
title:
build
.
name
,
title:
build
.
name
,
value:
"Build <
#{
Ci
::
RoutesHelper
.
ci_project_build_url
(
project
,
build
)
}
|
\#
#{
build
.
id
}
> failed in
#{
build
.
duration
.
to_i
}
second(s)."
value:
"Build <
#{
ci_project_build_url
(
project
,
build
)
}
|
\#
#{
build
.
id
}
> failed in
#{
build
.
duration
.
to_i
}
second(s)."
}
}
end
end
end
end
...
@@ -44,12 +46,12 @@ module Ci
...
@@ -44,12 +46,12 @@ module Ci
attr_reader
:commit
attr_reader
:commit
def
attachment_message
def
attachment_message
out
=
"<
#{
Ci
::
RoutesHelper
.
ci_project_url
(
project
)
}
|
#{
project_name
}
>: "
out
=
"<
#{
ci_project_url
(
project
)
}
|
#{
project_name
}
>: "
if
commit
.
matrix?
if
commit
.
matrix?
out
<<
"Commit <
#{
Ci
::
RoutesHelper
.
ci_project_ref_commits_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
|
\#
#{
commit
.
id
}
> "
out
<<
"Commit <
#{
ci_project_ref_commits_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
|
\#
#{
commit
.
id
}
> "
else
else
build
=
commit
.
builds_without_retry
.
first
build
=
commit
.
builds_without_retry
.
first
out
<<
"Build <
#{
Ci
::
RoutesHelper
.
ci_project_build_path
(
project
,
build
)
}
|
\#
#{
build
.
id
}
> "
out
<<
"Build <
#{
ci_project_build_url
(
project
,
build
)
}
|
\#
#{
build
.
id
}
> "
end
end
out
<<
"(<
#{
commit_sha_link
}
|
#{
commit
.
short_sha
}
>) "
out
<<
"(<
#{
commit_sha_link
}
|
#{
commit
.
short_sha
}
>) "
out
<<
"of <
#{
commit_ref_link
}
|
#{
commit
.
ref
}
> "
out
<<
"of <
#{
commit_ref_link
}
|
#{
commit
.
ref
}
> "
...
...
app/models/project_services/gitlab_ci_service.rb
View file @
dabbee65
...
@@ -88,7 +88,7 @@ class GitlabCiService < CiService
...
@@ -88,7 +88,7 @@ class GitlabCiService < CiService
def
build_page
(
sha
,
ref
)
def
build_page
(
sha
,
ref
)
if
project
.
gitlab_ci_project
.
present?
if
project
.
gitlab_ci_project
.
present?
Ci
::
RoutesHelper
.
ci_project_ref_commits_path
(
project
.
gitlab_ci_project
,
ref
,
sha
)
ci_project_ref_commits_url
(
project
.
gitlab_ci_project
,
ref
,
sha
)
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