module Gitlab::Client::Pipelines

def cancel_pipeline(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) - The pipelines changes.

Parameters:
  • id (Integer) -- The ID of a pipeline.
  • project (Integer, String) -- The ID or name of a project.
def cancel_pipeline(project, id)
  post("/projects/#{url_encode project}/pipelines/#{id}/cancel")
end

def create_pipeline(project, ref, variables = {})

Returns:
  • (Gitlab::ObjectifiedHash) - The pipelines changes.

Parameters:
  • variables (Hash) -- Variables passed to pipelines
  • ref (String) -- Reference to commit.
  • project (Integer, String) -- The ID or name of a project.
def create_pipeline(project, ref, variables = {})
  body = {}
  # This mapping is necessary, cause the API expects an array with objects (with `key` and `value` keys)
  # See: https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline
  body[:variables] = variables.map { |(key, value)| { key: key, value: value } } if variables.any?
  post(
    "/projects/#{url_encode project}/pipeline",
    query: { ref: ref },
    body: body
  )
end

def delete_pipeline(project, id)

Returns:
  • (void) - This API call returns an empty response body.

Parameters:
  • id (Integer) -- The ID of a pipeline.
  • project (Integer, String) -- The ID or name of a project.
def delete_pipeline(project, id)
  delete("/projects/#{url_encode project}/pipelines/#{id}")
end

def pipeline(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • id (Integer) -- The ID of a pipeline.
  • project (Integer, String) -- The ID or name of a project.
def pipeline(project, id)
  get("/projects/#{url_encode project}/pipelines/#{id}")
end

def pipelines(project, options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :per_page (Integer) -- The number of results per page.
  • :page (Integer) -- The page number.

Parameters:
  • options (Hash) -- A customizable set of options.
  • project (Integer, String) -- The ID or name of a project.
def pipelines(project, options = {})
  get("/projects/#{url_encode project}/pipelines", query: options)
end

def retry_pipeline(project, id)

Returns:
  • (Array) - The pipelines changes.

Parameters:
  • id (Integer) -- The ID of a pipeline.
  • project (Integer, String) -- The ID or name of a project.
def retry_pipeline(project, id)
  post("/projects/#{url_encode project}/pipelines/#{id}/retry")
end