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