Skip to content

GitLab CI Kotlin DSLopensavvy.gitlab.ciArtifacts

Artifacts

Configures job artifacts that are attached to the job when it succeeds, fails, or always.

Job artifacts are a list of files and directories that are sent to GitLab after the job finishes. They are available for download in the GitLab UI if the size is smaller than the maximum artifact size. By default, jobs in later stages automatically download all the artifacts created by jobs in earlier stages.

Example

val build by job {
    script {
        shell("make build")
    }

    artifacts {
        include("binaries/")
        include(".config")
        expireIn("1 week")
    }
}

External resources

Constructors

Artifacts

constructor()

Functions

accessibility

fun accessibility(path: String)

Collects accessibility test reports using pa11y to report on the accessibility impact of changes.

annotations

fun annotations(path: String)

Collects annotations to attach auxiliary data to a job.

apiFuzzing

fun apiFuzzing(path: String)

Collects API fuzzing security test reports.

browserPerformance

Collects browser performance test reports.

clusterImageScanning

Collects cluster image scanning security reports.

codeQuality

fun codeQuality(path: String)

Collects code quality reports to display code quality information in GitLab.

containerScanning

Collects container scanning security reports.

coverage

fun coverage(format: String, path: String)

Collects code coverage reports in Cobertura or JaCoCo formats.

coverageFuzzing

fun coverageFuzzing(path: String)

Collects coverage fuzzing security test reports.

cyclonedx

fun cyclonedx(vararg path: String)

Collects CycloneDX software bill of materials (SBOM) reports.

dast

fun dast(path: String)

Collects Dynamic Application Security Testing (DAST) reports.

dependencyScanning

Collects dependency scanning security reports.

dotenv

fun dotenv(path: String)

Collects environment variables from a dotenv file to pass to downstream jobs.

exclude

fun exclude(path: String)

Prevents files from being added to the artifacts archive.

expireIn

fun expireIn(time: String)

Specifies how long job artifacts are stored before they expire and are deleted.

exposeAs

fun exposeAs(name: String)

Exposes job artifacts in the merge request UI with a custom display name.

include

fun include(path: String)

Specifies which files to save as job artifacts.

junit

fun junit(path: String)

Collects JUnit test reports to display test results in GitLab's UI.

licenseScanning

fun licenseScanning(path: String)

Collects license scanning reports.

loadPerformance

fun loadPerformance(path: String)

Collects load performance test reports.

metrics

fun metrics(path: String)

Collects metrics reports.

name

fun name(name: String)

Defines the name of the created artifacts archive.

requirements

fun requirements(path: String)

Collects requirements reports.

rule

fun rule(rule: When)

Specifies when to upload artifacts based on job result.

sast

fun sast(path: String)

Collects Static Application Security Testing (SAST) reports.

secretDetection

fun secretDetection(path: String)

Collects secret detection security reports.

terraform

fun terraform(path: String)

Collects Terraform plan reports.

toYaml

open override fun toYaml(): Yaml

Converts this object into a Yaml object.