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
6192ea53
Commit
6192ea53
authored
Nov 24, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename latest_for to latest, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7333/diffs#note_18819292
parent
3a99e36e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
10 deletions
+6
-10
pipeline.rb
app/models/ci/pipeline.rb
+4
-8
commit.rb
app/models/commit.rb
+1
-1
image_for_build_service.rb
app/services/ci/image_for_build_service.rb
+1
-1
No files found.
app/models/ci/pipeline.rb
View file @
6192ea53
...
...
@@ -89,23 +89,19 @@ module Ci
end
end
scope
:latest
,
->
do
# ref can't be HEAD or SHA, can only be branch/tag name
scope
:latest
,
->
(
ref
=
nil
)
do
max_id
=
unscope
(
:select
).
select
(
"max(
#{
quoted_table_name
}
.id)"
)
where
(
id:
max_id
.
group
(
:ref
,
:sha
))
end
# ref can't be HEAD or SHA, can only be branch/tag name
scope
:latest_for
,
->
(
ref
)
do
if
ref
where
(
ref:
ref
)
else
self
end
.
latest
end
.
where
(
id:
max_id
.
group
(
:ref
,
:sha
))
end
def
self
.
latest_successful_for
(
ref
)
success
.
latest
_for
(
ref
).
first
success
.
latest
(
ref
).
first
end
def
self
.
truncate_sha
(
sha
)
...
...
app/models/commit.rb
View file @
6192ea53
...
...
@@ -234,7 +234,7 @@ class Commit
return
@statuses
[
ref
]
if
@statuses
.
key?
(
ref
)
@statuses
[
ref
]
=
pipelines
.
latest
_for
(
ref
).
status
@statuses
[
ref
]
=
pipelines
.
latest
(
ref
).
status
end
def
revert_branch_name
...
...
app/services/ci/image_for_build_service.rb
View file @
6192ea53
...
...
@@ -5,7 +5,7 @@ module Ci
sha
=
opts
[
:sha
]
||
ref_sha
(
project
,
ref
)
pipelines
=
project
.
pipelines
.
where
(
sha:
sha
)
image_name
=
image_for_status
(
pipelines
.
latest
_for
(
ref
).
status
)
image_name
=
image_for_status
(
pipelines
.
latest
(
ref
).
status
)
image_path
=
Rails
.
root
.
join
(
'public/ci'
,
image_name
)
OpenStruct
.
new
(
path:
image_path
,
name:
image_name
)
...
...
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