GitLab File

A GitLab file artifact is a reference to a file stored in GitLab. These artifacts are generally consumed by stages that read configuration from text files, such as a Deploy Manifest stage.

GitLab file artifact in the UI

The pipeline UI exposes the following fields for the GitLab file artifact:

Field Explanation
Account A GitLab artifact account.
File path The path to the artifact file, beginning at the root of the Git repository.
Commit/Branch The commit hash or branch name to use when retrieving the artifact file from GitLab.

In a trigger

When configuring a Git trigger with Type “GitLab”, you can use a GitLab file as an expected artifact.

Configuring GitLab file fields in a pipeline trigger’s expected artifact settings.

In a pipeline stage

When configuring certain stages, such as a “Deploy (Manifest)” or “Deploy” stage, you can use a GitLab file as a manifest or application artifact. You can either use a previously-defined artifact (for example, an artifact defined in a trigger) or define an artifact inline.

GitLab file artifact in a pipeline definition

The following are the fields that make up a GitLab file artifact:

Field Explanation
type Always gitlab/file.
reference The full path (including filename) for retrieval via the GitLab API. Example: https://gitlab.example.com/api/v4/projects/13083/repository/files/manifests%2Fconfig%2Eyaml/raw. For more information, see the GitLab API documentation.
name The path to the artifact file, beginning at the root of the Git repository. Example: path/to/file.yml.
version The commit hash or branch name to use when retrieving the artifact file from GitLab.
location N/A

The following is an example JSON representation of a GitLab file artifact, as it would appear in a pipeline definition:

{
  "type": "gitlab/file",
  "reference": "https://gitlab.example.com/api/v4/projects/13083/repository/files/manifests%2Fconfig%2Eyaml/raw",
  "name": "manifests/config.yaml",
  "version": "master"
}