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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1927a2d3
Commit
1927a2d3
authored
Jun 03, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename all ci_commit[s] in application code to pipeline[s]
parent
8a4f3193
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
88 additions
and
36 deletions
+88
-36
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+5
-5
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+3
-3
app/services/ci/create_trigger_request_service.rb
app/services/ci/create_trigger_request_service.rb
+3
-3
app/services/ci/image_for_build_service.rb
app/services/ci/image_for_build_service.rb
+3
-3
app/services/create_commit_builds_service.rb
app/services/create_commit_builds_service.rb
+2
-2
app/services/merge_requests/merge_when_build_succeeds_service.rb
...vices/merge_requests/merge_when_build_succeeds_service.rb
+2
-2
app/views/projects/commit/_builds.html.haml
app/views/projects/commit/_builds.html.haml
+2
-2
app/views/projects/commit/_pipeline.html.haml
app/views/projects/commit/_pipeline.html.haml
+52
-0
app/views/projects/merge_requests/_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+2
-2
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-1
app/views/projects/merge_requests/show/_builds.html.haml
app/views/projects/merge_requests/show/_builds.html.haml
+1
-1
app/views/projects/merge_requests/widget/_heading.html.haml
app/views/projects/merge_requests/widget/_heading.html.haml
+3
-3
app/views/projects/merge_requests/widget/open/_accept.html.haml
...ews/projects/merge_requests/widget/open/_accept.html.haml
+2
-2
app/views/projects/pipelines/show.html.haml
app/views/projects/pipelines/show.html.haml
+1
-1
lib/api/commit_statuses.rb
lib/api/commit_statuses.rb
+5
-5
No files found.
app/controllers/projects/commit_controller.rb
View file @
1927a2d3
...
...
@@ -99,12 +99,12 @@ class Projects::CommitController < Projects::ApplicationController
@commit
||=
@project
.
commit
(
params
[
:id
])
end
def
ci_commit
s
@
ci_commit
s
||=
project
.
pipelines
.
where
(
sha:
commit
.
sha
)
def
pipeline
s
@
pipeline
s
||=
project
.
pipelines
.
where
(
sha:
commit
.
sha
)
end
def
ci_builds
@ci_builds
||=
Ci
::
Build
.
where
(
pipeline:
ci_commit
s
)
@ci_builds
||=
Ci
::
Build
.
where
(
pipeline:
pipeline
s
)
end
def
define_show_vars
...
...
@@ -117,8 +117,8 @@ class Projects::CommitController < Projects::ApplicationController
@diff_refs
=
[
commit
.
parent
||
commit
,
commit
]
@notes_count
=
commit
.
notes
.
count
@statuses
=
CommitStatus
.
where
(
pipeline:
ci_commit
s
)
@builds
=
Ci
::
Build
.
where
(
pipeline:
ci_commit
s
)
@statuses
=
CommitStatus
.
where
(
pipeline:
pipeline
s
)
@builds
=
Ci
::
Build
.
where
(
pipeline:
pipeline
s
)
end
def
assign_change_commit_vars
(
mr_source_branch
)
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
1927a2d3
...
...
@@ -316,7 +316,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff
=
@merge_request
.
merge_request_diff
@pipeline
=
@merge_request
.
pipeline
@statuses
=
@
ci_commit
.
statuses
if
@pipeline
@statuses
=
@
pipeline
.
statuses
if
@pipeline
if
@merge_request
.
locked_long_ago?
@merge_request
.
unlock_mr
...
...
app/helpers/ci_status_helper.rb
View file @
1927a2d3
module
CiStatusHelper
def
ci_status_path
(
ci_commit
)
project
=
ci_commit
.
project
builds_namespace_project_commit_path
(
project
.
namespace
,
project
,
ci_commit
.
sha
)
def
ci_status_path
(
pipeline
)
project
=
pipeline
.
project
builds_namespace_project_commit_path
(
project
.
namespace
,
project
,
pipeline
.
sha
)
end
def
ci_status_with_icon
(
status
,
target
=
nil
)
...
...
app/services/ci/create_trigger_request_service.rb
View file @
1927a2d3
...
...
@@ -7,14 +7,14 @@ module Ci
# check if ref is tag
tag
=
project
.
repository
.
find_tag
(
ref
).
present?
ci_commit
=
project
.
pipelines
.
create
(
sha:
commit
.
sha
,
ref:
ref
,
tag:
tag
)
pipeline
=
project
.
pipelines
.
create
(
sha:
commit
.
sha
,
ref:
ref
,
tag:
tag
)
trigger_request
=
trigger
.
trigger_requests
.
create!
(
variables:
variables
,
commit:
ci_commit
,
commit:
pipeline
,
)
if
ci_commit
.
create_builds
(
nil
,
trigger_request
)
if
pipeline
.
create_builds
(
nil
,
trigger_request
)
trigger_request
end
end
...
...
app/services/ci/image_for_build_service.rb
View file @
1927a2d3
...
...
@@ -3,9 +3,9 @@ module Ci
def
execute
(
project
,
opts
)
sha
=
opts
[
:sha
]
||
ref_sha
(
project
,
opts
[
:ref
])
ci_commit
s
=
project
.
pipelines
.
where
(
sha:
sha
)
ci_commits
=
ci_commit
s
.
where
(
ref:
opts
[
:ref
])
if
opts
[
:ref
]
image_name
=
image_for_status
(
ci_commit
s
.
status
)
pipeline
s
=
project
.
pipelines
.
where
(
sha:
sha
)
pipelines
=
pipeline
s
.
where
(
ref:
opts
[
:ref
])
if
opts
[
:ref
]
image_name
=
image_for_status
(
pipeline
s
.
status
)
image_path
=
Rails
.
root
.
join
(
'public/ci'
,
image_name
)
OpenStruct
.
new
(
path:
image_path
,
name:
image_name
)
...
...
app/services/create_commit_builds_service.rb
View file @
1927a2d3
...
...
@@ -20,12 +20,12 @@ class CreateCommitBuildsService
pipeline
=
Ci
::
Pipeline
.
new
(
project:
project
,
sha:
sha
,
ref:
ref
,
before_sha:
before_sha
,
tag:
tag
)
# Skip creating
ci_commit
when no gitlab-ci.yml is found
# Skip creating
pipeline
when no gitlab-ci.yml is found
unless
pipeline
.
ci_yaml_file
return
false
end
# Create a new
ci_commit
# Create a new
pipeline
pipeline
.
save!
# Skip creating builds for commits that have [ci skip]
...
...
app/services/merge_requests/merge_when_build_succeeds_service.rb
View file @
1927a2d3
...
...
@@ -20,10 +20,10 @@ module MergeRequests
# Triggers the automatic merge of merge_request once the build succeeds
def
trigger
(
commit_status
)
each_merge_request
(
commit_status
)
do
|
merge_request
,
ci_commit
|
each_merge_request
(
commit_status
)
do
|
merge_request
,
pipeline
|
next
unless
merge_request
.
merge_when_build_succeeds?
next
unless
merge_request
.
mergeable?
next
unless
ci_commit
.
success?
next
unless
pipeline
.
success?
MergeWorker
.
perform_async
(
merge_request
.
id
,
merge_request
.
merge_user_id
,
merge_request
.
merge_params
)
end
...
...
app/views/projects/commit/_builds.html.haml
View file @
1927a2d3
-
@
ci_commits
.
each
do
|
ci_commit
|
=
render
"
ci_commit"
,
ci_commit:
ci_commit
,
pipeline_details:
true
-
@
pipelines
.
each
do
|
pipeline
|
=
render
"
pipeline"
,
pipeline:
pipeline
,
pipeline_details:
true
app/views/projects/commit/_
ci_commit
.html.haml
→
app/views/projects/commit/_
pipeline
.html.haml
View file @
1927a2d3
.row-content-block.build-content.middle-block
.pull-right
-
if
can?
(
current_user
,
:update_pipeline
,
ci_commit
.
project
)
-
if
ci_commit
.
builds
.
latest
.
failed
.
any?
(
&
:retryable?
)
=
link_to
"Retry failed"
,
retry_namespace_project_pipeline_path
(
ci_commit
.
project
.
namespace
,
ci_commit
.
project
,
ci_commit
.
id
),
class:
'btn btn-grouped btn-primary'
,
method: :post
-
if
can?
(
current_user
,
:update_pipeline
,
pipeline
.
project
)
-
if
pipeline
.
builds
.
latest
.
failed
.
any?
(
&
:retryable?
)
=
link_to
"Retry failed"
,
retry_namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
),
class:
'btn btn-grouped btn-primary'
,
method: :post
-
if
ci_commit
.
builds
.
running_or_pending
.
any?
=
link_to
"Cancel running"
,
cancel_namespace_project_pipeline_path
(
ci_commit
.
project
.
namespace
,
ci_commit
.
project
,
ci_commit
.
id
),
data:
{
confirm:
'Are you sure?'
},
class:
'btn btn-grouped btn-danger'
,
method: :post
-
if
pipeline
.
builds
.
running_or_pending
.
any?
=
link_to
"Cancel running"
,
cancel_namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
),
data:
{
confirm:
'Are you sure?'
},
class:
'btn btn-grouped btn-danger'
,
method: :post
.oneline.clearfix
-
if
defined?
(
pipeline_details
)
&&
pipeline_details
Pipeline
=
link_to
"#
#{
ci_commit
.
id
}
"
,
namespace_project_pipeline_path
(
ci_commit
.
project
.
namespace
,
ci_commit
.
project
,
ci_commit
.
id
),
class:
"monospace"
=
link_to
"#
#{
pipeline
.
id
}
"
,
namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
),
class:
"monospace"
with
=
pluralize
ci_commit
.
statuses
.
count
(
:id
),
"build"
-
if
ci_commit
.
ref
=
pluralize
pipeline
.
statuses
.
count
(
:id
),
"build"
-
if
pipeline
.
ref
for
=
link_to
ci_commit
.
ref
,
namespace_project_commits_path
(
ci_commit
.
project
.
namespace
,
ci_commit
.
project
,
ci_commit
.
ref
),
class:
"monospace"
=
link_to
pipeline
.
ref
,
namespace_project_commits_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
ref
),
class:
"monospace"
-
if
defined?
(
link_to_commit
)
&&
link_to_commit
for commit
=
link_to
ci_commit
.
short_sha
,
namespace_project_commit_path
(
ci_commit
.
project
.
namespace
,
ci_commit
.
project
,
ci_commit
.
sha
),
class:
"monospace"
-
if
ci_commit
.
duration
=
link_to
pipeline
.
short_sha
,
namespace_project_commit_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
sha
),
class:
"monospace"
-
if
pipeline
.
duration
in
=
time_interval_in_words
ci_commit
.
duration
=
time_interval_in_words
pipeline
.
duration
-
if
ci_commit
.
yaml_errors
.
present?
-
if
pipeline
.
yaml_errors
.
present?
.bs-callout.bs-callout-danger
%h4
Found errors in your .gitlab-ci.yml:
%ul
-
ci_commit
.
yaml_errors
.
split
(
","
).
each
do
|
error
|
-
pipeline
.
yaml_errors
.
split
(
","
).
each
do
|
error
|
%li
=
error
You can also test your .gitlab-ci.yml in the
#{
link_to
"Lint"
,
ci_lint_path
}
-
if
ci_commit
.
project
.
builds_enabled?
&&
!
ci_commit
.
ci_yaml_file
-
if
pipeline
.
project
.
builds_enabled?
&&
!
pipeline
.
ci_yaml_file
.bs-callout.bs-callout-warning
\.gitlab-ci.yml not found in this commit
...
...
@@ -45,8 +45,8 @@
%th
Tags
%th
Duration
%th
Finished at
-
if
ci_commit
.
project
.
build_coverage_enabled?
-
if
pipeline
.
project
.
build_coverage_enabled?
%th
Coverage
%th
-
ci_commit
.
statuses
.
stages
.
each
do
|
stage
|
=
render
'projects/commit/ci_stage'
,
stage:
stage
,
statuses:
ci_commit
.
statuses
.
where
(
stage:
stage
)
-
pipeline
.
statuses
.
stages
.
each
do
|
stage
|
=
render
'projects/commit/ci_stage'
,
stage:
stage
,
statuses:
pipeline
.
statuses
.
where
(
stage:
stage
)
app/views/projects/merge_requests/_new_submit.html.haml
View file @
1927a2d3
...
...
@@ -23,7 +23,7 @@
=
link_to
url_for
(
params
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
Commits
%span
.badge
=
@commits
.
size
-
if
@
ci_commit
-
if
@
pipeline
%li
.builds-tab.active
=
link_to
url_for
(
params
),
data:
{
target:
'div#builds'
,
action:
'builds'
,
toggle:
'tab'
}
do
Builds
...
...
@@ -43,7 +43,7 @@
%p
To preserve performance the line changes are not shown.
-
else
=
render
"projects/diffs/diffs"
,
diffs:
@diffs
,
project:
@project
,
diff_refs:
@merge_request
.
diff_refs
,
show_whitespace_toggle:
false
-
if
@
ci_commit
-
if
@
pipeline
#builds
.builds.tab-pane
=
render
"projects/merge_requests/show/builds"
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
1927a2d3
...
...
@@ -54,7 +54,7 @@
=
link_to
commits_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'div#commits'
,
action:
'commits'
,
toggle:
'tab'
}
do
Commits
%span
.badge
=
@commits
.
size
-
if
@
ci_commit
-
if
@
pipeline
%li
.builds-tab
=
link_to
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
data:
{
target:
'#builds'
,
action:
'builds'
,
toggle:
'tab'
}
do
Builds
...
...
app/views/projects/merge_requests/show/_builds.html.haml
View file @
1927a2d3
=
render
"projects/commit/
ci_commit"
,
ci_commit:
@ci_commit
,
link_to_commit:
true
=
render
"projects/commit/
pipeline"
,
pipeline:
@pipeline
,
link_to_commit:
true
app/views/projects/merge_requests/widget/_heading.html.haml
View file @
1927a2d3
-
if
@
ci_commit
-
if
@
pipeline
.mr-widget-heading
-
%w[success skipped canceled failed running pending]
.
each
do
|
status
|
.ci_widget
{
class:
"ci-#{status}"
,
style:
(
"display:none"
unless
@
ci_commit
.
status
==
status
)
}
.ci_widget
{
class:
"ci-#{status}"
,
style:
(
"display:none"
unless
@
pipeline
.
status
==
status
)
}
=
ci_icon_for_status
(
status
)
%span
CI build
...
...
@@ -9,7 +9,7 @@
for
-
commit
=
@merge_request
.
last_commit
=
succeed
"."
do
=
link_to
@
ci_commit
.
short_sha
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@ci_commit
.
sha
),
class:
"monospace"
=
link_to
@
pipeline
.
short_sha
,
namespace_project_commit_path
(
@merge_request
.
source_project
.
namespace
,
@merge_request
.
source_project
,
@pipeline
.
sha
),
class:
"monospace"
%span
.ci-coverage
=
link_to
"View details"
,
builds_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
class:
"js-show-tab"
,
data:
{
action:
'builds'
}
...
...
app/views/projects/merge_requests/widget/open/_accept.html.haml
View file @
1927a2d3
-
status_class
=
@
ci_commit
?
" ci-
#{
@ci_commit
.
status
}
"
:
nil
-
status_class
=
@
pipeline
?
" ci-
#{
@pipeline
.
status
}
"
:
nil
=
form_for
[
:merge
,
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@merge_request
],
remote:
true
,
method: :post
,
html:
{
class:
'accept-mr-form js-quick-submit js-requires-input'
}
do
|
f
|
=
hidden_field_tag
:authenticity_token
,
form_authenticity_token
...
...
@@ -6,7 +6,7 @@
.accept-merge-holder.clearfix.js-toggle-container
.clearfix
.accept-action
-
if
@
ci_commit
&&
@ci_commit
.
active?
-
if
@
pipeline
&&
@pipeline
.
active?
%span
.btn-group
=
button_tag
class:
"btn btn-create js-merge-button merge_when_build_succeeds"
do
Merge When Build Succeeds
...
...
app/views/projects/pipelines/show.html.haml
View file @
1927a2d3
...
...
@@ -5,4 +5,4 @@
=
render
"projects/pipelines/info"
%div
.block-connector
=
render
"projects/commit/
ci_commit"
,
ci_commit
:
@pipeline
=
render
"projects/commit/
pipeline"
,
pipeline
:
@pipeline
lib/api/commit_statuses.rb
View file @
1927a2d3
...
...
@@ -22,8 +22,8 @@ module API
not_found!
(
'Commit'
)
unless
user_project
.
commit
(
params
[
:sha
])
ci_commit
s
=
user_project
.
pipelines
.
where
(
sha:
params
[
:sha
])
statuses
=
::
CommitStatus
.
where
(
pipeline:
ci_commit
s
)
pipeline
s
=
user_project
.
pipelines
.
where
(
sha:
params
[
:sha
])
statuses
=
::
CommitStatus
.
where
(
pipeline:
pipeline
s
)
statuses
=
statuses
.
latest
unless
parse_boolean
(
params
[
:all
])
statuses
=
statuses
.
where
(
ref:
params
[
:ref
])
if
params
[
:ref
].
present?
statuses
=
statuses
.
where
(
stage:
params
[
:stage
])
if
params
[
:stage
].
present?
...
...
@@ -64,11 +64,11 @@ module API
ref
=
branches
.
first
end
ci_commit
=
@project
.
ensure_pipeline
(
commit
.
sha
,
ref
)
pipeline
=
@project
.
ensure_pipeline
(
commit
.
sha
,
ref
)
name
=
params
[
:name
]
||
params
[
:context
]
status
=
GenericCommitStatus
.
running_or_pending
.
find_by
(
pipeline:
ci_commit
,
name:
name
,
ref:
params
[
:ref
])
status
||=
GenericCommitStatus
.
new
(
project:
@project
,
pipeline:
ci_commit
,
user:
current_user
)
status
=
GenericCommitStatus
.
running_or_pending
.
find_by
(
pipeline:
pipeline
,
name:
name
,
ref:
params
[
:ref
])
status
||=
GenericCommitStatus
.
new
(
project:
@project
,
pipeline:
pipeline
,
user:
current_user
)
status
.
update
(
attrs
)
case
params
[
:state
].
to_s
...
...
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