Module: Gitlab::Client::MergeTrains

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/merge_trains.rb

Overview

Defines methods related to merge trains.

Instance Method Summary collapse

Instance Method Details

#add_merge_request_to_merge_train(project, merge_request_iid, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Add a merge request to the merge train targeting the merge request’s target branch.

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • merge_request_iid (Integer)

    The IID of the merge request.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :when_pipeline_succeeds (Boolean)

    Add merge request to merge train when pipeline succeeds.

  • :sha (String)

    If present, the SHA must match the HEAD of the source branch, otherwise the merge fails.

  • :squash (Boolean)

    If true, the commits are squashed into a single commit on merge.

Returns:



51
52
53
# File 'lib/gitlab/client/merge_trains.rb', line 51

def add_merge_request_to_merge_train(project, merge_request_iid, options = {})
  post("/projects/#{url_encode project}/merge_trains/merge_requests/#{merge_request_iid}", query: options)
end

#merge_train_merge_requests(project, target_branch, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Get all merge requests added to a merge train for the requested target branch.

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • target_branch (String)

    The target branch of the merge train.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :scope (String)

    The scope of merge trains to return, one of: :active, :complete

  • :sort (String)

    Sort by created_at either ‘asc’ or ‘desc’

Returns:



29
30
31
# File 'lib/gitlab/client/merge_trains.rb', line 29

def merge_train_merge_requests(project, target_branch, options = {})
  get("/projects/#{url_encode project}/merge_trains/#{target_branch}", query: options)
end

#merge_train_status(project, merge_request_iid) ⇒ Gitlab::ObjectifiedHash

Get merge train information for the requested merge request.

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • merge_request_iid (Integer)

    The IID of the merge request.

Returns:



38
39
40
# File 'lib/gitlab/client/merge_trains.rb', line 38

def merge_train_status(project, merge_request_iid)
  get("/projects/#{url_encode project}/merge_trains/merge_requests/#{merge_request_iid}")
end

#merge_trains(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Get list of merge trains for a project.

Examples:

Gitlab.merge_trains(1, scope: :active, sort: :asc)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :scope (String)

    The scope of merge trains to return, one of: :active, :complete

  • :sort (String)

    Sort by created_at either ‘asc’ or ‘desc’

Returns:



17
18
19
# File 'lib/gitlab/client/merge_trains.rb', line 17

def merge_trains(project, options = {})
  get("/projects/#{url_encode project}/merge_trains", query: options)
end