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
f5d24e60
Commit
f5d24e60
authored
Apr 13, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pipeline view
parent
406a796f
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
100 deletions
+79
-100
app/assets/stylesheets/framework/tables.scss
app/assets/stylesheets/framework/tables.scss
+0
-3
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+21
-35
app/models/ci/commit.rb
app/models/ci/commit.rb
+7
-0
app/views/projects/ci/builds/_build.html.haml
app/views/projects/ci/builds/_build.html.haml
+3
-1
app/views/projects/ci/commits/_commit.html.haml
app/views/projects/ci/commits/_commit.html.haml
+22
-19
app/views/projects/commit/_ci_commit.html.haml
app/views/projects/commit/_ci_commit.html.haml
+7
-23
app/views/projects/pipelines/index.html.haml
app/views/projects/pipelines/index.html.haml
+15
-18
app/views/projects/pipelines/show.html.haml
app/views/projects/pipelines/show.html.haml
+3
-0
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/assets/stylesheets/framework/tables.scss
View file @
f5d24e60
...
...
@@ -38,9 +38,6 @@ table {
.rotate
{
height
:
140px
;
white-space
:
nowrap
;
}
.rotate
>
div
{
transform
:
/*
Magic
Numbers
*/
translate
(
25px
,
51px
)
...
...
app/controllers/projects/pipelines_controller.rb
View file @
f5d24e60
class
Projects::PipelinesController
<
Projects
::
ApplicationController
before_action
:
ci_commit
,
except:
[
:index
,
:new
,
:create
]
before_action
:
pipeline
,
except:
[
:index
,
:new
,
:create
]
before_action
:authorize_read_pipeline!
before_action
:authorize_create_pipeline!
,
only:
[
:new
,
:create
]
before_action
:authorize_update_pipeline!
,
only:
[
:retry
,
:cancel
]
...
...
@@ -7,26 +7,24 @@ class Projects::PipelinesController < Projects::ApplicationController
def
index
@scope
=
params
[
:scope
]
@all_
commit
s
=
project
.
ci_commits
@
commits
=
@all_commit
s
.
order
(
id: :desc
)
@
commit
s
=
@all_
pipeline
s
=
project
.
ci_commits
@
pipelines
=
@all_pipeline
s
.
order
(
id: :desc
)
@
pipeline
s
=
case
@scope
when
'latest'
@commits
when
'running'
@
commit
s
.
running_or_pending
@
pipeline
s
.
running_or_pending
when
'branches'
ref
s
=
project
.
repository
.
branches
.
map
(
&
:name
)
ids
=
@all_commits
.
where
(
ref:
ref
s
).
group
(
:ref
).
select
(
'max(id)'
)
@
commits
.
where
(
id:
ids
)
@branche
s
=
project
.
repository
.
branches
.
map
(
&
:name
)
@branches_ids
=
@all_pipelines
.
where
(
ref:
@branche
s
).
group
(
:ref
).
select
(
'max(id)'
)
@
pipelines
.
where
(
id:
@branches_
ids
)
when
'tags'
ref
s
=
project
.
repository
.
tags
.
map
(
&
:name
)
ids
=
@all_commits
.
where
(
ref:
ref
s
).
group
(
:ref
).
select
(
'max(id)'
)
@
commits
.
where
(
id:
ids
)
@tag
s
=
project
.
repository
.
tags
.
map
(
&
:name
)
@tags_ids
=
@all_pipelines
.
where
(
ref:
@tag
s
).
group
(
:ref
).
select
(
'max(id)'
)
@
pipelines
.
where
(
id:
@tags_
ids
)
else
@
commit
s
@
pipeline
s
end
@
commits
=
@commit
s
.
page
(
params
[
:page
]).
per
(
30
)
@
pipelines
=
@pipeline
s
.
page
(
params
[
:page
]).
per
(
30
)
end
def
new
...
...
@@ -47,56 +45,44 @@ class Projects::PipelinesController < Projects::ApplicationController
return
end
ci_commit
=
project
.
ci_commit
(
commit
.
id
,
params
[
:ref
])
if
ci_commit
@error
=
'Pipeline already created'
render
action:
'new'
return
end
pipeline
=
project
.
ci_commits
.
new
(
sha:
commit
.
id
,
ref:
params
[
:ref
],
before_sha:
Gitlab
::
Git
::
BLANK_SHA
)
# Skip creating ci_commit when no gitlab-ci.yml is found
commit
=
project
.
ci_commits
.
new
(
sha:
commit
.
id
,
ref:
params
[
:ref
],
before_sha:
Gitlab
::
Git
::
BLANK_SHA
)
unless
commit
.
config_processor
@error
=
commit
.
yaml_errors
||
'Missing .gitlab-ci.yml file'
unless
pipeline
.
config_processor
@error
=
pipeline
.
yaml_errors
||
'Missing .gitlab-ci.yml file'
render
action:
'new'
return
end
Ci
::
Commit
.
transaction
do
commit
.
save!
commit
.
create_builds
(
params
[
:ref
],
false
,
current_user
)
commit
.
create_builds
(
current_user
)
end
redirect_to
builds_namespace_project_commit_path
(
project
.
namespace
,
project
,
commit
.
id
)
end
def
show
@commit
=
@ci_commit
.
commit
@builds
=
@ci_commit
.
builds
@statuses
=
@ci_commit
.
statuses
respond_to
do
|
format
|
format
.
html
end
end
def
retry
ci_commit
.
builds
.
latest
.
failed
.
select
(
&
:retryable?
).
each
(
&
:retry
)
pipeline
.
builds
.
latest
.
failed
.
select
(
&
:retryable?
).
each
(
&
:retry
)
redirect_back_or_default
default:
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
end
def
cancel
ci_commit
.
builds
.
running_or_pending
.
each
(
&
:cancel
)
pipeline
.
builds
.
running_or_pending
.
each
(
&
:cancel
)
redirect_back_or_default
default:
namespace_project_pipelines_path
(
project
.
namespace
,
project
)
end
def
retry_builds
end
private
def
ci_commit
@
ci_commit
||=
project
.
ci_commits
.
find_by!
(
id:
params
[
:id
])
def
pipeline
@
pipeline
||=
project
.
ci_commits
.
find_by!
(
id:
params
[
:id
])
end
end
app/models/ci/commit.rb
View file @
f5d24e60
...
...
@@ -94,6 +94,13 @@ module Ci
end
end
def
latest?
return
false
unless
ref
commit
=
project
.
commit
(
ref
)
return
false
unless
commit
commit
.
sha
==
sha
end
def
triggered?
trigger_requests
.
any?
end
...
...
app/views/projects/ci/builds/_build.html.haml
View file @
f5d24e60
...
...
@@ -13,7 +13,9 @@
%strong
##{build.id}
-
if
build
.
stuck?
%i
.fa.fa-warning.text-warning
%i
.fa.fa-warning.text-warning.has-tooltip
(
title=
"Build is stuck. Check runners."
)
-
if
defined?
(
retried
)
&&
retried
%i
.fa.fa-warning.has-tooltip
(
title=
"Build was retried"
)
-
if
defined?
(
commit_sha
)
&&
commit_sha
%td
...
...
app/views/projects/ci/commits/_commit.html.haml
View file @
f5d24e60
-
status
=
commit
.
status
%tr
.commit
%td
.commit-link
=
link_to
namespace_project_
commit_path
(
@project
.
namespace
,
@project
,
commit
.
sha
),
class:
"ci-status ci-
#{
status
}
"
do
=
link_to
namespace_project_
pipeline_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
"ci-status ci-
#{
status
}
"
do
=
ci_icon_for_status
(
status
)
%strong
##{commit.id}
%td
%div
%div
.branch-commit
-
if
commit
.
ref
=
link_to
commit
.
ref
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
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"
-
if
commit
.
latest?
%span
.label.label-success
latest
-
if
commit
.
tag?
%span
.label.label-primary
tag
-
if
commit
.
branch?
%span
.label.label-primary
branch
-
if
commit
.
triggered?
%span
.label.label-primary
triggered
-
if
commit
.
yaml_errors
.
present?
...
...
@@ -21,32 +23,36 @@
-
if
commit
.
builds
.
any?
(
&
:stuck?
)
%span
.label.label-warning
stuck
%p
%span
-
if
commit_data
=
commit
.
commit_data
=
render
'projects/branches/commit'
,
commit:
commit_data
,
project:
@project
=
link_to_gfm
commit_data
.
title
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit_data
.
id
),
class:
"commit-row-message"
-
else
%p
Cant find HEAD commit for this branch
-
stages_status
=
commit
.
statuses
.
stages_status
-
stages
.
each
do
|
stage
|
%td
-
if
status
=
stages_status
[
stage
]
%span
.has-tooltip
(
title=
"#{status}"
)
{
class:
"ci-status-icon-#{status}"
}
%span
.has-tooltip
(
title=
"#{sta
ge.titleize}: #{sta
tus}"
)
{
class:
"ci-status-icon-#{status}"
}
=
ci_icon_for_status
(
status
)
%td
-
if
commit
.
started_at
&&
commit
.
finished_at
%p
%i
.fa.fa-late-o
%i
.fa.fa-clock-o
#{
duration_in_words
(
commit
.
finished_at
,
commit
.
started_at
)
}
-
if
commit
.
finished_at
%p
%i
.fa.fa-date-o
%i
.fa.fa-calendar
#{
time_ago_with_tooltip
(
commit
.
finished_at
)
}
%td
.content
%td
.controls.hidden-xs.pull-right
-
artifacts
=
commit
.
builds
.
latest
.
select
{
|
status
|
status
.
artifacts?
}
-
artifacts
=
commit
.
builds
.
latest
-
if
artifacts
.
present?
.dropdown.inline
%button
.dropdown-toggle.btn
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
...
...
@@ -58,15 +64,12 @@
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
build
),
rel:
'nofollow'
do
%i
.fa.fa-download
%span
#{
build
.
name
}
-
if
can?
(
current_user
,
:update_pipeline
,
@project
)
-
if
commit
.
retryable?
-
if
commit
.
retryable?
&&
commit
.
builds
.
failed
.
any?
=
link_to
retry_namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
'btn has-tooltip'
,
title:
"Retry"
,
method: :post
do
=
icon
(
"repeat"
)
-
if
commit
.
active?
=
link_to
cancel_namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
commit
.
id
),
class:
'btn btn-remove has-tooltip'
,
title:
"Cancel"
,
method: :post
do
=
icon
(
"remove cred"
)
app/views/projects/commit/_ci_commit.html.haml
View file @
f5d24e60
...
...
@@ -2,12 +2,15 @@
.pull-right
-
if
can?
(
current_user
,
:update_build
,
@project
)
-
if
ci_commit
.
builds
.
latest
.
failed
.
any?
(
&
:retryable?
)
=
link_to
"Retry failed"
,
retry_
builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@
commit
.
id
),
class:
'btn btn-grouped btn-primary'
,
method: :post
=
link_to
"Retry failed"
,
retry_
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
ci_
commit
.
id
),
class:
'btn btn-grouped btn-primary'
,
method: :post
-
if
ci_commit
.
builds
.
running_or_pending
.
any?
=
link_to
"Cancel running"
,
cancel_
builds_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@
commit
.
id
),
data:
{
confirm:
'Are you sure?'
},
class:
'btn btn-grouped btn-danger'
,
method: :post
=
link_to
"Cancel running"
,
cancel_
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
ci_
commit
.
id
),
data:
{
confirm:
'Are you sure?'
},
class:
'btn btn-grouped btn-danger'
,
method: :post
.oneline
Pipeline
=
link_to
"#
#{
ci_commit
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
ci_commit
.
id
),
class:
"monospace"
with
=
pluralize
ci_commit
.
statuses
.
count
(
:id
),
"build"
-
if
ci_commit
.
ref
for
...
...
@@ -17,7 +20,7 @@
for commit
=
link_to
@commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
),
class:
"monospace"
-
if
ci_commit
.
duration
>
0
in
took
=
time_interval_in_words
ci_commit
.
duration
-
if
ci_commit
.
yaml_errors
.
present?
...
...
@@ -47,23 +50,4 @@
%th
-
builds
=
ci_commit
.
statuses
.
latest
.
ordered
=
render
builds
,
coverage:
@project
.
build_coverage_enabled?
,
stage:
true
,
ref:
false
,
allow_retry:
true
-
if
ci_commit
.
retried
.
any?
.gray-content-block.second-block
Retried builds
.table-holder
%table
.table.builds
%thead
%tr
%th
Status
%th
Build ID
%th
Ref
%th
Stage
%th
Name
%th
Duration
%th
Finished at
-
if
@project
.
build_coverage_enabled?
%th
Coverage
%th
=
render
ci_commit
.
retried
,
coverage:
@project
.
build_coverage_enabled?
,
stage:
true
,
ref:
false
=
render
ci_commit
.
retried
,
coverage:
@project
.
build_coverage_enabled?
,
stage:
true
,
ref:
false
,
retried:
true
app/views/projects/pipelines/index.html.haml
View file @
f5d24e60
...
...
@@ -7,25 +7,21 @@
=
link_to
project_pipelines_path
(
@project
)
do
All
%span
.badge.js-totalbuilds-count
=
number_with_delimiter
(
@all_commits
.
count
(
:id
))
=
number_with_delimiter
(
@all_pipelines
.
count
)
%li
{
class:
(
'active'
if
@scope
==
'running'
)}
=
link_to
project_pipelines_path
(
@project
,
scope: :running
)
do
Running
%span
.badge.js-running-count
=
number_with_delimiter
(
@all_pipelines
.
running_or_pending
.
count
)
%li
{
class:
(
'active'
if
@scope
==
'branches'
)}
=
link_to
project_pipelines_path
(
@project
,
scope: :branches
)
do
Branches
%span
.badge.js-running-count
=
number_with_delimiter
(
@all_commits
.
running_or_pending
.
count
(
:id
))
%li
{
class:
(
'active'
if
@scope
==
'tags'
)}
=
link_to
project_pipelines_path
(
@project
,
scope: :tags
)
do
Tags
%span
.badge.js-running-count
=
number_with_delimiter
(
@all_commits
.
running_or_pending
.
count
(
:id
))
%li
{
class:
(
'active'
if
@scope
==
'running'
)}
=
link_to
project_pipelines_path
(
@project
,
scope: :running
)
do
Failed
%span
.badge.js-running-count
=
number_with_delimiter
(
@all_commits
.
running_or_pending
.
count
(
:id
))
.nav-controls
-
if
can?
current_user
,
:create_pipeline
,
@project
...
...
@@ -45,8 +41,8 @@
Pipelines for
#{
(
@scope
||
'changes'
)
}
on this project
%ul
.content-list
-
stages
=
@
commit
s
.
stages
-
if
@
commit
s
.
blank?
-
stages
=
@
pipeline
s
.
stages
-
if
@
pipeline
s
.
blank?
%li
.nothing-here-block
No pipelines to show
-
else
...
...
@@ -55,11 +51,12 @@
%tbody
%th
Pipeline ID
%th
Commit
-
@commits
.
stages
.
each
do
|
stage
|
%th
.rotate
=
stage
.
titleize
-
@pipelines
.
stages
.
each
do
|
stage
|
%th
%span
.has-tooltip
(
title=
"#{stage.titleize}"
)
=
truncate
(
stage
.
titleize
.
pluralize
,
length:
8
)
%th
%th
=
render
@
commit
s
,
commit_sha:
true
,
stage:
true
,
allow_retry:
true
,
stages:
stages
=
render
@
pipeline
s
,
commit_sha:
true
,
stage:
true
,
allow_retry:
true
,
stages:
stages
=
paginate
@
commit
s
,
theme:
'gitlab'
=
paginate
@
pipeline
s
,
theme:
'gitlab'
app/views/projects/pipelines/show.html.haml
0 → 100644
View file @
f5d24e60
-
page_title
"Pipeline"
=
render
"header_title"
=
render
"projects/commit/ci_commit"
,
ci_commit:
@pipeline
config/routes.rb
View file @
f5d24e60
...
...
@@ -654,7 +654,7 @@ Rails.application.routes.draw do
resource
:variables
,
only:
[
:show
,
:update
]
resources
:triggers
,
only:
[
:index
,
:create
,
:destroy
]
resources
:pipelines
,
only:
[
:index
,
:new
,
:create
]
do
resources
:pipelines
,
only:
[
:index
,
:new
,
:create
,
:show
]
do
member
do
post
:cancel
post
:retry
...
...
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