module Gitlab::Client::Jobs

def download_branch_artifact_file(project_id, ref_name, artifact_path, job)

Returns:
  • (Gitlab::FileResponse) -

Parameters:
  • job(required) (String) -- The name of the job.
  • artifact_path(required) (String) -- Path to a file inside the artifacts archive.
  • ref_name(required) (String) -- Branch or tag name in repository. HEAD or SHA references are not supported.
  • project_id(required) (Integer, String) -- The ID or name of a project.
def download_branch_artifact_file(project_id, ref_name, artifact_path, job)
  get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/raw/#{artifact_path}",
      query: { job: job },
      format: nil,
      headers: { Accept: 'application/octet-stream' },
      parser: proc { |body, _|
                if body.encoding == Encoding::ASCII_8BIT # binary response
                  ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
                else # error with json response
                  ::Gitlab::Request.parse(body)
                end
              })
end

def download_job_artifact_file(project_id, job_id, artifact_path)

Returns:
  • (Gitlab::FileResponse) -

Parameters:
  • artifact_path(required) (String) -- Path to a file inside the artifacts archive.
  • job_id(required) (String) -- The unique job identifier.
  • project_id(required) (Integer, String) -- The ID or name of a project.
def download_job_artifact_file(project_id, job_id, artifact_path)
  get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/#{artifact_path}",
      format: nil,
      headers: { Accept: 'application/octet-stream' },
      parser: proc { |body, _|
                if body.encoding == Encoding::ASCII_8BIT # binary response
                  ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
                else # error with json response
                  ::Gitlab::Request.parse(body)
                end
              })
end

def job(project_id, job_id)

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

def job_artifacts(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_artifacts(project_id, job_id)
  get("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts",
      format: nil,
      headers: { Accept: 'text/plain' },
      parser: ::Gitlab::Request::Parser)
end

def job_artifacts_delete(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_artifacts_delete(project_id, job_id)
  delete("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts")
end

def job_artifacts_download(project_id, ref_name, job_name)

Returns:
  • (Gitlab::FileResponse) -

Parameters:
  • job (String) -- jobname
  • ref (String) -- Ref Name
  • project_id (Integer, String) -- The ID or name of a project.
def job_artifacts_download(project_id, ref_name, job_name)
  get("/projects/#{url_encode project_id}/jobs/artifacts/#{ref_name}/download",
      query: { job: job_name },
      format: nil,
      headers: { Accept: 'application/octet-stream' },
      parser: proc { |body, _|
                if body.encoding == Encoding::ASCII_8BIT # binary response
                  ::Gitlab::FileResponse.new StringIO.new(body, 'rb+')
                else # error with json response
                  ::Gitlab::Request.parse(body)
                end
              })
end

def job_artifacts_keep(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_artifacts_keep(project_id, job_id)
  post("/projects/#{url_encode project_id}/jobs/#{job_id}/artifacts/keep")
end

def job_cancel(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_cancel(project_id, job_id)
  post("/projects/#{url_encode project_id}/jobs/#{job_id}/cancel")
end

def job_erase(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_erase(project_id, job_id)
  post("/projects/#{url_encode project_id}/jobs/#{job_id}/erase")
end

def job_play(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_play(project_id, job_id)
  post("/projects/#{url_encode project_id}/jobs/#{job_id}/play")
end

def job_retry(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_retry(project_id, job_id)
  post("/projects/#{url_encode project_id}/jobs/#{job_id}/retry")
end

def job_trace(project_id, job_id)

Returns:
  • (Array) -

Parameters:
  • the (Integer) -- id of the job
  • The (Integer, String) -- ID or name of a project.
def job_trace(project_id, job_id)
  get("/projects/#{url_encode project_id}/jobs/#{job_id}/trace",
      format: nil,
      headers: { Accept: 'text/plain' },
      parser: ::Gitlab::Request::Parser)
end

def jobs(project_id, options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :per_page (Integer) -- The number of results per page.
  • :page (Integer) -- The page number.
  • :scope (Array) -- The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided.

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

def pipeline_bridges(project_id, pipeline_id, options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :scope (Array) -- The scope of bridge jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all bridge jobs if none provided.

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

def pipeline_jobs(project_id, pipeline_id, options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :scope (Array) -- The scope of jobs to show, one or array of: created, pending, running, failed, success, canceled, skipped, manual; showing all jobs if none provided.

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