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
57a78c37
Commit
57a78c37
authored
Jul 18, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show notice if builds are not from latest pipeline
parent
72699d97
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
6 deletions
+27
-6
build.rb
app/models/ci/build.rb
+3
-0
project.rb
app/models/project.rb
+9
-3
_branch.html.haml
app/views/projects/branches/_branch.html.haml
+5
-1
_download.html.haml
app/views/projects/buttons/_download.html.haml
+5
-1
_download.html.haml
app/views/projects/tags/_download.html.haml
+5
-1
No files found.
app/models/ci/build.rb
View file @
57a78c37
...
@@ -15,6 +15,9 @@ module Ci
...
@@ -15,6 +15,9 @@ module Ci
scope
:with_artifacts
,
->
()
{
where
.
not
(
artifacts_file:
nil
)
}
scope
:with_artifacts
,
->
()
{
where
.
not
(
artifacts_file:
nil
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:with_expired_artifacts
,
->
()
{
with_artifacts
.
where
(
'artifacts_expire_at < ?'
,
Time
.
now
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:last_month
,
->
()
{
where
(
'created_at > ?'
,
Date
.
today
-
1
.
month
)
}
scope
:latest_success_with_artifacts
,
->
()
do
with_artifacts
.
success
.
latest
end
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_file
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
mount_uploader
:artifacts_metadata
,
ArtifactUploader
...
...
app/models/project.rb
View file @
57a78c37
...
@@ -429,10 +429,16 @@ class Project < ActiveRecord::Base
...
@@ -429,10 +429,16 @@ class Project < ActiveRecord::Base
repository
.
commit
(
ref
)
repository
.
commit
(
ref
)
end
end
def
latest_success_builds_for
(
ref
=
'HEAD'
)
# ref can't be HEAD or SHA, can only be branch/tag name
def
latest_success_pipeline_for
(
ref
=
'master'
)
pipelines
.
where
(
ref:
ref
).
success
.
latest
end
# ref can't be HEAD or SHA, can only be branch/tag name
def
latest_success_builds_for
(
ref
=
'master'
)
Ci
::
Build
.
joins
(
:pipeline
).
Ci
::
Build
.
joins
(
:pipeline
).
merge
(
pipelines
.
where
(
ref:
ref
).
success
.
latest
).
merge
(
latest_success_pipeline_for
(
ref
)
).
with_artifacts
.
success
.
latest
latest_success_with_artifacts
end
end
def
merge_base_commit
(
first_commit_id
,
second_commit_id
)
def
merge_base_commit
(
first_commit_id
,
second_commit_id
)
...
...
app/views/projects/branches/_branch.html.haml
View file @
57a78c37
...
@@ -27,7 +27,9 @@
...
@@ -27,7 +27,9 @@
=
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
-
artifacts
=
@project
.
latest_success_builds_for
(
branch
.
name
)
-
pipeline
=
@project
.
latest_success_pipeline_for
(
branch
.
name
).
first
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest_success_with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
.dropdown.inline.artifacts-btn
.dropdown.inline.artifacts-btn
%a
.btn.dropdown-toggle
{
'data-toggle'
=>
'dropdown'
}
%a
.btn.dropdown-toggle
{
'data-toggle'
=>
'dropdown'
}
...
@@ -37,6 +39,8 @@
...
@@ -37,6 +39,8 @@
Select Archive Format
Select Archive Format
%ul
.dropdown-menu.dropdown-menu-align-right
{
role:
'menu'
}
%ul
.dropdown-menu.dropdown-menu-align-right
{
role:
'menu'
}
%li
.dropdown-header
Artifacts
%li
.dropdown-header
Artifacts
-
unless
pipeline
.
latest?
=
" (not latest, but
#{
link_to
(
pipeline
.
short_sha
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
pipeline
.
sha
))
}
)"
-
artifacts
.
each
do
|
job
|
-
artifacts
.
each
do
|
job
|
%li
%li
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
job
),
rel:
'nofollow'
do
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
job
),
rel:
'nofollow'
do
...
...
app/views/projects/buttons/_download.html.haml
View file @
57a78c37
...
@@ -14,9 +14,13 @@
...
@@ -14,9 +14,13 @@
%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
-
artifacts
=
@project
.
latest_success_builds_for
(
@ref
)
-
pipeline
=
@project
.
latest_success_pipeline_for
(
@ref
).
first
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest_success_with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
%li
.dropdown-header
Artifacts
%li
.dropdown-header
Artifacts
-
unless
pipeline
.
latest?
=
" (not latest, but
#{
link_to
(
pipeline
.
short_sha
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
pipeline
.
sha
))
}
)"
-
artifacts
.
each
do
|
job
|
-
artifacts
.
each
do
|
job
|
%li
%li
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
job
),
rel:
'nofollow'
do
=
link_to
download_namespace_project_build_artifacts_path
(
@project
.
namespace
,
@project
,
job
),
rel:
'nofollow'
do
...
...
app/views/projects/tags/_download.html.haml
View file @
57a78c37
...
@@ -12,9 +12,13 @@
...
@@ -12,9 +12,13 @@
%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
-
artifacts
=
project
.
latest_success_builds_for
(
ref
)
-
pipeline
=
project
.
latest_success_pipeline_for
(
ref
).
first
-
if
pipeline
-
artifacts
=
pipeline
.
builds
.
latest_success_with_artifacts
-
if
artifacts
.
any?
-
if
artifacts
.
any?
%li
.dropdown-header
Artifacts
%li
.dropdown-header
Artifacts
-
unless
pipeline
.
latest?
=
" (not latest, but
#{
link_to
(
pipeline
.
short_sha
,
namespace_project_commits_path
(
project
.
namespace
,
project
,
pipeline
.
sha
))
}
)"
-
artifacts
.
each
do
|
job
|
-
artifacts
.
each
do
|
job
|
%li
%li
=
link_to
download_namespace_project_build_artifacts_path
(
project
.
namespace
,
project
,
job
),
rel:
'nofollow'
do
=
link_to
download_namespace_project_build_artifacts_path
(
project
.
namespace
,
project
,
job
),
rel:
'nofollow'
do
...
...
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