gl_builds: Access the GitLab CI builds

View source: R/ci.R

gl_pipelinesR Documentation

Access the GitLab CI builds

Description

List the jobs with gl_jobs, the pipelines with gl_pipelines or download the most recent artifacts archive with gl_latest_build_artifact. For every branch and job combination only the most recent artifacts archive is available. gl_builds is the equivalent for GitLab API v3.

Usage

gl_pipelines(project, ...)

gl_jobs(project, ...)

gl_builds(project, api_version = 4, ...)

gl_latest_build_artifact(
  project,
  job,
  ref_name = get_main(),
  save_to_file = tempfile(fileext = ".zip"),
  ...
)

Arguments

project

project name or id, required

...

passed on to gitlab() API call

api_version

Since gl_builds is no longer working for GitLab API v4, this must be set to "3" in order to avoid deprecation warning and HTTP error. It currently default to "4" with deprecation message.´

job

Name of the job to get build artifacts from

ref_name

name of ref (i.e. branch, commit, tag)

save_to_file

either a path where to store .zip file or NULL if raw should be returned

Value

returns the file path if save_to_file is TRUE, or the archive as raw otherwise.

Examples

## Not run: 
# connect as a fixed user to a GitLab instance
set_gitlab_connection(
  gitlab_url = "https://gitlab.com",
  private_token = Sys.getenv("GITLAB_COM_TOKEN"))

# Get pipelines and jobs information
gl_pipelines(project = "<<your-project-id>>")
gl_jobs(project = "<<your-project-id>>")
gl_latest_build_artifact(project = "<<your-project-id>>", job = "build")

## End(Not run)

gitlabr documentation built on Sept. 13, 2022, 5:06 p.m.