app/services/ci/create_pipeline_service.rb
# Create a new pipeline in the specified project.
#
# @param [Symbol] source                             What event (Ci::Pipeline.sources) triggers the pipeline
#                                                    creation.
# @param [Boolean] ignore_skip_ci                    Whether skipping a pipeline creation when `[skip ci]` comment
#                                                    is present in the commit body
# @param [Boolean] save_on_errors                    Whether persisting an invalid pipeline when it encounters an
#                                                    error during creation (e.g. invalid yaml)
# @param [Ci::TriggerRequest] trigger_request        The pipeline trigger triggers the pipeline creation.
# @param [Ci::PipelineSchedule] schedule             The pipeline schedule triggers the pipeline creation.
# @param [MergeRequest] merge_request                The merge request triggers the pipeline creation.
# @param [ExternalPullRequest] external_pull_request The external pull request triggers the pipeline creation.
# @param [Ci::Bridge] bridge                         The bridge job that triggers the downstream pipeline creation.
# @param [String] content                            The content of .gitlab-ci.yml to override the default config
#                                                    contents (e.g. .gitlab-ci.yml in repostiry). Mainly used for
#                                                    generating a dangling pipeline.
#
# @return [Ci::Pipeline]                             The created Ci::Pipeline object.
# rubocop: disable Metrics/ParameterLists
Create a new pipeline in the specified project.
Create a new pipeline in the specified project .
def execute(source, ignore_skip_ci: false, save_on_errors: true, trigger_request: nil, schedule: nil, merge_request: nil, external_pull_request: nil, bridge: nil, **options, &block)
      @pipeline = Ci::Pipeline.new
      command = Gitlab::Ci::Pipeline::Chain::Command.new(
        source: source,
        origin_ref: params[:ref],
        checkout_sha: params[:checkout_sha],
        after_sha: params[:after],
        before_sha: params[:before],          
        source_sha: params[:source_sha],      
        target_sha: params[:target_sha],      
        trigger_request: trigger_request,
        schedule: schedule,
        merge_request: merge_request,
        external_pull_request: external_pull_request,
        ignore_skip_ci: ignore_skip_ci,
        save_incompleted: save_on_errors,
        seeds_block: block,
        variables_attributes: params[:variables_attributes],
        project: project,
        current_user: current_user,
        push_options: params[:push_options] || {},
        chat_data: params[:chat_data],
        bridge: bridge,
        **extra_options(options))
      sequence = Gitlab::Ci::Pipeline::Chain::Sequence
        .new(pipeline, command, SEQUENCE)
      sequence.build! do |pipeline, sequence|
        schedule_head_pipeline_update
        if sequence.complete?
          cancel_pending_pipelines if project.auto_cancel_pending_pipelines?
          pipeline_created_counter.increment(source: source)
          Ci::ProcessPipelineService
            .new(pipeline)
            .execute(nil, initial_process: true)
        end
      end
      pipeline.reset_project_iid unless pipeline.persisted? ||
          Feature.disabled?(:ci_pipeline_rewind_iid, project, default_enabled: true)
      pipeline
    end
def execute ( source , ignore_skip_ci : false , save_on_errors : true , trigger_request : nil , schedule : nil , merge_request : nil , external_pull_request : nil , bridge : nil , ** options , & block ) @pipeline = Ci :: Pipeline . new command = Gitlab :: Ci :: Pipeline :: Chain :: Command . new ( source : source , origin_ref : params [ :ref ] , checkout_sha : params [ :checkout_sha ] , after_sha : params [ :after ] , before_sha : params [ :before ] , source_sha : params [ :source_sha ] , target_sha : params [ :target_sha ] , trigger_request : trigger_request , schedule : schedule , merge_request : merge_request , external_pull_request : external_pull_request , ignore_skip_ci : ignore_skip_ci , save_incompleted : save_on_errors , seeds_block : block , variables_attributes : params [ :variables_attributes ] , project : project , current_user : current_user , push_options : params [ :push_options ] || { } , chat_data : params [ :chat_data ] , bridge : bridge , ** extra_options ( options ) ) sequence = Gitlab :: Ci :: Pipeline :: Chain :: Sequence . new ( pipeline , command , SEQUENCE ) sequence . build! do | pipeline , sequence | schedule_head_pipeline_update if sequence . complete? cancel_pending_pipelines if project . auto_cancel_pending_pipelines? pipeline_created_counter . increment ( source : source ) Ci :: ProcessPipelineService . new ( pipeline ) . execute ( nil , initial_process : true ) end end pipeline . reset_project_iid unless pipeline . persisted? || Feature . disabled? ( :ci_pipeline_rewind_iid , project , default_enabled : true ) pipeline end
Create a new pipeline in the specified project.
Create a new pipeline in the specified project .
# The base SHA of the source branch (i.e merge_request.diff_base_sha). # The HEAD SHA of the source branch (i.e merge_request.diff_head_sha). # The HEAD SHA of the target branch. # If pipeline is not persisted, try to recover IID
The created Ci::Pipeline object. rubocop: disable Metrics/ParameterLists
The created Ci :: Pipeline object . rubocop : disable Metrics / ParameterLists
Ci::Pipeline
source
<not_specific>
ignore_skip_ci
<not_specific>
save_on_errors
<not_specific>
trigger_request
<not_specific>
schedule
<not_specific>
merge_request
<not_specific>
external_pull_request
<not_specific>
bridge
<not_specific>
options
<not_specific>
block
<not_specific>
<not_specific>
content The content of .gitlab-ci.yml to override the default config contents . Mainly used for generating a dangling pipeline.
content The content of . gitlab - ci . yml to override the default config contents . Mainly used for generating a dangling pipeline .