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
iv
gitlab-ce
Commits
4f1c6368
Commit
4f1c6368
authored
May 18, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create pipeline objects with parameters
parent
ef60b8e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
11 deletions
+9
-11
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+2
-2
app/services/ci/create_pipeline_service.rb
app/services/ci/create_pipeline_service.rb
+1
-3
app/views/projects/commit/_ci_commit.html.haml
app/views/projects/commit/_ci_commit.html.haml
+2
-2
app/views/projects/pipelines/new.html.haml
app/views/projects/pipelines/new.html.haml
+4
-4
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
4f1c6368
...
@@ -15,7 +15,7 @@ class Projects::PipelinesController < Projects::ApplicationController
...
@@ -15,7 +15,7 @@ class Projects::PipelinesController < Projects::ApplicationController
end
end
def
new
def
new
@pipeline
=
project
.
ci_commits
.
new
@pipeline
=
project
.
ci_commits
.
new
(
ref:
@project
.
default_branch
)
end
end
def
create
def
create
...
@@ -46,7 +46,7 @@ class Projects::PipelinesController < Projects::ApplicationController
...
@@ -46,7 +46,7 @@ class Projects::PipelinesController < Projects::ApplicationController
private
private
def
create_params
def
create_params
params
.
permit
(
:ref
)
params
.
require
(
:pipeline
).
permit
(
:ref
)
end
end
def
pipeline
def
pipeline
...
...
app/services/ci/create_pipeline_service.rb
View file @
4f1c6368
module
Ci
module
Ci
class
CreatePipelineService
<
BaseService
class
CreatePipelineService
<
BaseService
def
execute
def
execute
pipeline
=
project
.
ci_commits
.
new
pipeline
=
project
.
ci_commits
.
new
(
params
)
unless
ref_names
.
include?
(
params
[
:ref
])
unless
ref_names
.
include?
(
params
[
:ref
])
pipeline
.
errors
.
add
(
:base
,
'Reference not found'
)
pipeline
.
errors
.
add
(
:base
,
'Reference not found'
)
...
@@ -21,8 +21,6 @@ module Ci
...
@@ -21,8 +21,6 @@ module Ci
begin
begin
Ci
::
Commit
.
transaction
do
Ci
::
Commit
.
transaction
do
pipeline
.
sha
=
commit
.
id
pipeline
.
sha
=
commit
.
id
pipeline
.
ref
=
params
[
:ref
]
pipeline
.
before_sha
=
Gitlab
::
Git
::
BLANK_SHA
unless
pipeline
.
config_processor
unless
pipeline
.
config_processor
pipeline
.
errors
.
add
(
:base
,
pipeline
.
yaml_errors
||
'Missing .gitlab-ci.yml file'
)
pipeline
.
errors
.
add
(
:base
,
pipeline
.
yaml_errors
||
'Missing .gitlab-ci.yml file'
)
...
...
app/views/projects/commit/_ci_commit.html.haml
View file @
4f1c6368
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
-
if
ci_commit
.
builds
.
running_or_pending
.
any?
-
if
ci_commit
.
builds
.
running_or_pending
.
any?
=
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
=
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
-
if
defined?
(
pipeline_details
)
&&
pipeline_details
.oneline.clearfix
.oneline
-
if
defined?
(
pipeline_details
)
&&
pipeline_details
Pipeline
Pipeline
=
link_to
"#
#{
ci_commit
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
ci_commit
.
id
),
class:
"monospace"
=
link_to
"#
#{
ci_commit
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
ci_commit
.
id
),
class:
"monospace"
with
with
...
...
app/views/projects/pipelines/new.html.haml
View file @
4f1c6368
...
@@ -5,15 +5,15 @@
...
@@ -5,15 +5,15 @@
New Pipeline
New Pipeline
%hr
%hr
=
form_for
@pipeline
,
url:
namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
html:
{
id:
"new-pipeline-form"
,
class:
"form-horizontal js-new-pipeline-form js-requires-input"
}
do
=
form_for
@pipeline
,
as: :pipeline
,
url:
namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
html:
{
id:
"new-pipeline-form"
,
class:
"form-horizontal js-new-pipeline-form js-requires-input"
}
do
|
f
|
=
form_errors
(
@pipeline
)
=
form_errors
(
@pipeline
)
.form-group
.form-group
=
label_tag
:ref
,
'Create for'
,
class:
'control-label'
=
f
.
label
:ref
,
'Create for'
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
text_field_tag
:ref
,
params
[
:ref
]
||
@project
.
default_branch
,
required:
true
,
tabindex:
2
,
class:
'form-control'
=
f
.
text_field
:ref
,
required:
true
,
tabindex:
2
,
class:
'form-control'
.help-block
Existing branch name, tag
.help-block
Existing branch name, tag
.form-actions
.form-actions
=
button_tag
'Create pipeline'
,
class:
'btn btn-create'
,
tabindex:
3
=
f
.
submit
'Create pipeline'
,
class:
'btn btn-create'
,
tabindex:
3
=
link_to
'Cancel'
,
namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
class:
'btn btn-cancel'
=
link_to
'Cancel'
,
namespace_project_pipelines_path
(
@project
.
namespace
,
@project
),
class:
'btn btn-cancel'
:javascript
:javascript
...
...
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