Artifacts


Artifacts

Transfer files between jobs using artifacts

All jobs in subsequent stages will receive the artifacts (by default)

Configuration

Name artifacts

Include and exclude paths

When to create artifacts (jobs success, failure, always)

Expire artifacts

Add untracked files

artifacts can be in default


Dependencies

Jobs can restrict which job artifacts to receive

Add dependencies

job_name:
  dependencies:
  - other_job
  #...

Empty list disables receiving artifacts:

job_name:
  dependencies: []
  #...

Download artifact from another pipeline

See GitLab API


Pro tip: When variables are enough

Passing variables between jobs is possible (since GitLab 12.9)

One job defined a dotenv artifact :

job_name:
  script: echo "FOO=bar" >build.env
  artifacts:
    reports:
      dotenv: build.env

Job in later stages automatically consume them:

job_name2:
  script: echo "${FOO}"

dependencies as well as needs limit from which jobs they are consumed


Hands-On

See chapter Artifacts


Maximum artifact size

By default, artifacts can not be larger tham 100MB

Can be configured…


Conflicting artifact names

When two jobs produce an artifact with the same name…

…the last job to finish wins