Skip to content

Using artifacts

Artifacts allow you to persist data after a workflow has completed.

An artifact is a file or collection of files produced and uploaded as final deliverables. For example, artifacts might include binary or package files, test results, screenshots, or log files. You can download artifacts using various command line tools (curl) or use in a separate pipeline.

Overview

Razorops provides two steps that you can use to upload and download artifacts. For more information, see the artifacts/push and artifacts/pull steps.

Artifacts are uploaded during a workflow run, and you can view an artifact's name and size in the UI. Mostly you will be using artifacts/push step to publish deliverables whereas artifacts/pull is used rarely in pipeline.

Example

A simple example of using the artifacts definition would be the following:

tasks:
  pdf:
    steps:
    - checkout
    - run: make test
    ...
    - artifacts/push:
        name: logs-screenshot
        paths:
        - logs/test.log
        - screenshots
      when: always  ## publish even if the task fails

Publish artifacts

Each workflow gets it's own artifact store. You can define artifacts/push step with following properties:

  • name - an unique identifier in the project. You can refer an artifact by name easily during download.
  • paths - an array of files and directories relative to the current workspace. Globbing in paths is not supported.

Tip

You can use when: always to execute artifacts/push step even if a task fails.

Usage limits

These uploaded artifacts will be kept in Razorops for 1 week.

Listing artifacts

You can fetch the list of artifacts in a pipeline by workflow number (or use latest to infer latest run) using a HTTP call. For example -

# download latest artifact in pipeline {pipeline}
$ curl -sSL https://api.razorops.com/workflows/{pipeline}/artifacts/latest | jq .
[
  {
    "name": "agent-master_amd64-linux.tgz",         ## name of the artifact
    "run": "86",                                    ## workflow run or build identifier
    "size": 3706842,                                ## file size in bytes
    "time": "2022-08-08T06:13:23.068Z"              ## creation time
  },
  ...
]

$ curl -sSL https://api.razorops.com/workflows/{pipeline}/artifacts/86 | jq .
# would provide the same result as previous command (86 is the incremental workflow number shown in the dashboard)

Download artifacts

You can use any command line tool (curl or wget) to download published artifacts by name, pipeline id and workflow number. You use use latest to infer the latest workflow run that produced the artifact.

# download latest artifact with name={name}
curl -sLO https://api.razorops.com/workflows/{pipeline}/artifacts/latest/{name}.tgz

# download latest artifact with name={name} in workflow run=10
curl -sLO https://api.razorops.com/workflows/{pipeline}/artifacts/10/{name}.tgz