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
Léo-Paul Géneau
gitlab-ce
Commits
d84aa560
Commit
d84aa560
authored
Aug 11, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Pipeline.latest_successful_for return the record
parent
2a435e1d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
11 deletions
+7
-11
app/models/ci/pipeline.rb
app/models/ci/pipeline.rb
+2
-6
app/models/project.rb
app/models/project.rb
+1
-1
app/views/projects/branches/_branch.html.haml
app/views/projects/branches/_branch.html.haml
+1
-1
app/views/projects/buttons/_download.html.haml
app/views/projects/buttons/_download.html.haml
+1
-1
app/views/projects/repositories/_download_archive.html.haml
app/views/projects/repositories/_download_archive.html.haml
+1
-1
app/views/projects/tags/_download.html.haml
app/views/projects/tags/_download.html.haml
+1
-1
No files found.
app/models/ci/pipeline.rb
View file @
d84aa560
...
@@ -21,12 +21,8 @@ module Ci
...
@@ -21,12 +21,8 @@ module Ci
after_save
:keep_around_commits
after_save
:keep_around_commits
# ref can't be HEAD or SHA, can only be branch/tag name
# ref can't be HEAD or SHA, can only be branch/tag name
scope
:latest_successful_for
,
->
(
ref
)
do
def
self
.
latest_successful_for
(
ref
)
latest_for
(
ref
).
success
where
(
ref:
ref
).
order
(
id: :desc
).
success
.
first
end
scope
:latest_for
,
->
(
ref
)
do
where
(
ref:
ref
).
order
(
id: :desc
).
limit
(
1
)
end
end
def
self
.
truncate_sha
(
sha
)
def
self
.
truncate_sha
(
sha
)
...
...
app/models/project.rb
View file @
d84aa560
...
@@ -432,7 +432,7 @@ class Project < ActiveRecord::Base
...
@@ -432,7 +432,7 @@ class Project < ActiveRecord::Base
# ref can't be HEAD, can only be branch/tag name or SHA
# ref can't be HEAD, can only be branch/tag name or SHA
def
latest_successful_builds_for
(
ref
=
default_branch
)
def
latest_successful_builds_for
(
ref
=
default_branch
)
latest_pipeline
=
pipelines
.
latest_successful_for
(
ref
)
.
first
latest_pipeline
=
pipelines
.
latest_successful_for
(
ref
)
if
latest_pipeline
if
latest_pipeline
latest_pipeline
.
builds
.
latest
.
with_artifacts
latest_pipeline
.
builds
.
latest
.
with_artifacts
...
...
app/views/projects/branches/_branch.html.haml
View file @
d84aa560
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
branch
.
name
),
class:
'btn btn-default'
,
method: :post
,
title:
"Compare"
do
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
branch
.
name
),
class:
'btn btn-default'
,
method: :post
,
title:
"Compare"
do
Compare
Compare
-
pipeline
=
@project
.
pipelines
.
latest_successful_for
(
branch
.
name
)
.
first
-
pipeline
=
@project
.
pipelines
.
latest_successful_for
(
branch
.
name
)
-
if
pipeline
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
...
...
app/views/projects/buttons/_download.html.haml
View file @
d84aa560
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
%li
%li
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
@ref
,
format:
'tar.gz'
),
rel:
'nofollow'
do
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
@ref
,
format:
'tar.gz'
),
rel:
'nofollow'
do
%span
Download tar.gz
%span
Download tar.gz
-
pipeline
=
@project
.
pipelines
.
latest_successful_for
(
@ref
)
.
first
-
pipeline
=
@project
.
pipelines
.
latest_successful_for
(
@ref
)
-
if
pipeline
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
...
...
app/views/projects/repositories/_download_archive.html.haml
View file @
d84aa560
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
ref
,
format:
'tar'
),
rel:
'nofollow'
do
=
link_to
archive_namespace_project_repository_path
(
@project
.
namespace
,
@project
,
ref:
ref
,
format:
'tar'
),
rel:
'nofollow'
do
%i
.fa.fa-download
%i
.fa.fa-download
%span
Download tar
%span
Download tar
-
pipeline
=
@project
.
pipelines
.
latest_successful_for
(
ref
)
.
first
-
pipeline
=
@project
.
pipelines
.
latest_successful_for
(
ref
)
-
if
pipeline
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
...
...
app/views/projects/tags/_download.html.haml
View file @
d84aa560
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
%li
%li
=
link_to
archive_namespace_project_repository_path
(
project
.
namespace
,
project
,
ref:
ref
,
format:
'tar.gz'
),
rel:
'nofollow'
do
=
link_to
archive_namespace_project_repository_path
(
project
.
namespace
,
project
,
ref:
ref
,
format:
'tar.gz'
),
rel:
'nofollow'
do
%span
Download tar.gz
%span
Download tar.gz
-
pipeline
=
project
.
pipelines
.
latest_successful_for
(
ref
)
.
first
-
pipeline
=
project
.
pipelines
.
latest_successful_for
(
ref
)
-
if
pipeline
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
artifacts
=
pipeline
.
builds
.
latest
.
with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
...
...
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