BigW Consortium Gitlab

Commit 4f1c6368 by Kamil Trzcinski

Create pipeline objects with parameters

parent ef60b8e1
...@@ -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
......
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')
......
...@@ -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
......
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment