BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
cf7da039
Commit
cf7da039
authored
Apr 29, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit status
parent
ff345f8b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
138 additions
and
0 deletions
+138
-0
environments_controller.rb
app/controllers/projects/environments_controller.rb
+17
-0
gitlab_routing_helper.rb
app/helpers/gitlab_routing_helper.rb
+4
-0
pipeline.rb
app/models/ci/pipeline.rb
+4
-0
_environment.html.haml
app/views/projects/environments/_environment.html.haml
+58
-0
_header_title.html.haml
app/views/projects/environments/_header_title.html.haml
+1
-0
index.html.haml
app/views/projects/environments/index.html.haml
+22
-0
show.html.haml
app/views/projects/environments/show.html.haml
+30
-0
routes.rb
config/routes.rb
+2
-0
No files found.
app/controllers/projects/environments_controller.rb
0 → 100644
View file @
cf7da039
class
Projects
::
EnvironmentsController
<
Projects
::
ApplicationController
layout
'project'
def
index
@environments
=
project
.
builds
.
where
.
not
(
environment:
nil
).
pluck
(
:environment
).
uniq
@environments
=
@environments
.
map
{
|
env
|
build_for_env
(
env
)
}.
compact
end
def
show
@environment
=
params
[
:id
].
to_s
@builds
=
project
.
builds
.
where
.
not
(
status:
[
"manual"
]).
where
(
environment:
params
[
:id
].
to_s
).
order
(
id: :desc
).
page
(
params
[
:page
]).
per
(
30
)
end
def
build_for_env
(
environment
)
project
.
builds
.
success
.
order
(
id: :desc
).
find_by
(
environment:
environment
)
end
end
app/helpers/gitlab_routing_helper.rb
View file @
cf7da039
...
@@ -29,6 +29,10 @@ module GitlabRoutingHelper
...
@@ -29,6 +29,10 @@ module GitlabRoutingHelper
namespace_project_pipelines_path
(
project
.
namespace
,
project
,
*
args
)
namespace_project_pipelines_path
(
project
.
namespace
,
project
,
*
args
)
end
end
def
project_environments_path
(
project
,
*
args
)
namespace_project_environments_path
(
project
.
namespace
,
project
,
*
args
)
end
def
project_builds_path
(
project
,
*
args
)
def
project_builds_path
(
project
,
*
args
)
namespace_project_builds_path
(
project
.
namespace
,
project
,
*
args
)
namespace_project_builds_path
(
project
.
namespace
,
project
,
*
args
)
end
end
...
...
app/models/ci/pipeline.rb
View file @
cf7da039
...
@@ -161,6 +161,10 @@ module Ci
...
@@ -161,6 +161,10 @@ module Ci
git_commit_message
=~
/(\[ci skip\])/
if
git_commit_message
git_commit_message
=~
/(\[ci skip\])/
if
git_commit_message
end
end
def
environments
builds
.
where
.
not
(
environment:
nil
).
success
.
pluck
(
:environment
).
uniq
end
private
private
def
update_state
def
update_state
...
...
app/views/projects/environments/_environment.html.haml
0 → 100644
View file @
cf7da039
%tr
.commit
-
commit
=
build
.
commit
-
status
=
build
.
status
%td
%strong
=
link_to
build
.
environment
,
namespace_project_environment_path
(
@project
.
namespace
,
@project
,
build
.
environment
),
class:
"monospace"
%td
.commit-link
=
link_to
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"ci-status ci-
#{
commit
.
status
}
"
do
=
ci_icon_for_status
(
commit
.
status
)
%strong
##{commit.id}
%td
.commit-link
=
link_to
namespace_project_build_path
(
@project
.
namespace
,
@project
,
build
.
id
),
class:
"ci-status ci-
#{
build
.
status
}
"
do
=
ci_icon_for_status
(
build
.
status
)
%strong
##{build.id}
%td
%div
.branch-commit
-
if
commit
.
ref
=
link_to
commit
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
commit
.
ref
),
class:
"monospace"
·
=
link_to
commit
.
short_sha
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit
.
sha
),
class:
"commit-id monospace"
%p
%span
-
if
commit_data
=
commit
.
commit_data
=
link_to_gfm
commit_data
.
title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit_data
.
id
),
class:
"commit-row-message"
-
else
Cant find HEAD commit for this branch
%td
-
if
build
.
started_at
&&
build
.
finished_at
%p
%i
.fa.fa-clock-o
#{
duration_in_words
(
build
.
finished_at
,
build
.
started_at
)
}
-
if
build
.
finished_at
%p
%i
.fa.fa-calendar
#{
time_ago_with_tooltip
(
build
.
finished_at
)
}
%td
.controls.hidden-xs.pull-right
-
manual
=
commit
.
builds
.
latest
.
manual_actions
.
to_a
-
if
manual
.
any?
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
=
icon
(
'play'
)
%b
.caret
%ul
.dropdown-menu.dropdown-menu-align-right
-
manual
.
each
do
|
manual_build
|
%li
=
link_to
'#'
,
rel:
'nofollow'
do
%i
.fa.fa-play
%span
#{
manual_build
.
name
}
app/views/projects/environments/_header_title.html.haml
0 → 100644
View file @
cf7da039
-
header_title
project_title
(
@project
,
"Environments"
,
project_environments_path
(
@project
))
app/views/projects/environments/index.html.haml
0 → 100644
View file @
cf7da039
-
page_title
"Environments"
=
render
"header_title"
.gray-content-block
Environments for this project
%ul
.content-list
-
if
@environments
.
blank?
%li
.nothing-here-block
No environments to show
-
else
.table-holder
%table
.table.builds
%tbody
%th
Environment
%th
Pipeline ID
%th
Build ID
%th
Changes
%th
%th
-
@environments
.
each
do
|
build
|
=
render
"environment"
,
build:
build
app/views/projects/environments/show.html.haml
0 → 100644
View file @
cf7da039
-
page_title
"Environments"
=
render
"header_title"
.gray-content-block
Latest deployments for
%strong
=
@environment
%ul
.content-list
-
if
@builds
.
blank?
%li
.nothing-here-block
No builds to show for specific environment
-
else
.table-holder
%table
.table.builds
%thead
%tr
%th
Status
%th
Build ID
%th
Commit
%th
Ref
%th
Name
%th
Duration
%th
Finished at
%th
=
render
@builds
,
commit_sha:
true
,
ref:
true
,
allow_retry:
true
=
paginate
@builds
,
theme:
'gitlab'
config/routes.rb
View file @
cf7da039
...
@@ -704,6 +704,8 @@ Rails.application.routes.draw do
...
@@ -704,6 +704,8 @@ Rails.application.routes.draw do
end
end
end
end
resources
:environments
,
only:
[
:index
,
:show
]
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
resources
:builds
,
only:
[
:index
,
:show
],
constraints:
{
id:
/\d+/
}
do
collection
do
collection
do
post
:cancel_all
post
:cancel_all
...
...
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