Skip to content

Argo Workflows artifacts: CAPA practice questions

An artifact in Argo Workflows is a file or a directory that one step produces and another step, or a person, reads later. Parameters carry small string values; artifacts carry data that belongs in object storage, such as a build output, a dataset or a report.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Argo Workflows artifacts covers in CAPA

An artifact in Argo Workflows is a file or a directory that one step produces and another step, or a person, reads later. Parameters carry small string values; artifacts carry data that belongs in object storage, such as a build output, a dataset or a report. Most artifact features need an artifact repository, for example an S3-compatible bucket such as MinIO, Google Cloud Storage, Azure Blob Storage or Alibaba Cloud OSS.

A template declares an output artifact with a name and the path inside its container where the file will be. When the main container finishes, the wait container uploads that path to the repository. A later step declares an input artifact with a path where the file should appear, and its from field points at the producer, for example {{steps.generate.outputs.artifacts.result}} in a steps template or the tasks prefix inside a DAG. The init container of the consuming Pod downloads the file before the main container starts. Artifacts can also be hardwired from a Git repository, an HTTP URL or a bucket key without any earlier step, and an artifact marked optional does not fail the step when the file is missing.

The workflow controller chooses which repository to use in a fixed order. An artifactRepositoryRef on the workflow wins; otherwise the artifact-repositories ConfigMap in the workflow's namespace is used when it carries the default-artifact-repository annotation; otherwise the repository configured in the controller ConfigMap applies. When a repository is configured that way, a key-only artifact only needs a key, and the bucket and credentials come from the configuration. The documentation recommends this as the normal style because it keeps storage settings out of every workflow.

By default an artifact is packed as a tarball and gzipped. An archive block changes that: none: {} stores the file as it is, and tar with a compression level tunes the gzip step. Uploaded artifacts are not removed automatically unless artifact garbage collection is set. The artifactGC strategy can be OnWorkflowCompletion or OnWorkflowDeletion at the workflow level, and a single artifact can override it, for example with Never to keep it. The garbage collection Pods need their own permissions to delete objects in the bucket.

Key points

  • Output artifacts are uploaded by the wait container; input artifacts are downloaded before the main container starts.
  • Artifacts are tar and gzip archived by default; archive none stores the raw file.
  • artifactRepositoryRef beats the namespace artifact-repositories ConfigMap, which beats the controller default.
  • artifactGC deletes stored artifacts on workflow completion or deletion, and Never keeps a single artifact.

Three sample questions

12 CAPA questions on Argo Workflows artifacts, 12 with explanations. How practice works

Question 1

Which of the following correctly defines an artifact input in a workflow template?
inputs:
  artifacts:
  - name: data
    path: /tmp/data
    s3:
      bucket: my-bucket
      key: data.csv
  1. A.The configuration is correct
  2. B.The path should be relative
  3. C.The s3 configuration needs credentials
  4. D.The name field is unnecessary

Correct answer: A

The snippet follows the documented input-artifact shape: a named artifact with a path inside the container and an S3 location given by bucket and key. The artifacts walk-through uses the same name and absolute path fields, and S3 settings can also come from the configured artifact repository. Why the other options are wrong. "The path should be relative": the docs' artifact examples use absolute container paths such as /tmp/message, and /tmp/data here is absolute as well. "The s3 configuration needs credentials": S3Artifact credentials (accessKeySecret, useSDKCreds) are optional selectors, and the walk-through example gives only a key because the rest comes from the repository configuration. "The name field is unnecessary": name identifies the artifact and is used in every documented example, so it is not unnecessary.

Sources: Argo Workflows docs: Artifacts, Argo Workflows docs: Fields

Question 2

What is the purpose of the archiveLogs field in a workflow spec?
  1. A.To save logs to a persistent volume
  2. B.To enable log aggregation
  3. C.To save logs as an artifact
  4. D.To compress log files

Correct answer: C

archiveLogs is a boolean that tells Argo to archive container logs, and the log-archiving page says the logs are stored as artifacts in the configured artifact repository. It can be set in the controller config map, the workflow spec or on a template. Why the other options are wrong. "To save logs to a persistent volume": the logs go to the artifact repository (S3-compatible storage and similar), not to a persistent volume. "To enable log aggregation": the docs say Argo's archiving is naive and not built for indexing or searching logs, so it is not a log aggregation feature. "To compress log files": the field only switches archiving on; the docs describe no compression behaviour for it.

Sources: Argo Workflows docs: Configuring Archive Logs, Argo Workflows docs: Fields

Question 3

Which of the following artifact types is NOT supported by Argo Workflows?
  1. A.S3
  2. B.Git
  3. C.Artifactory
  4. D.MongoDB

Correct answer: D

The artifact repository table lists Artifactory, Azure Blob, GCS, Git, HDFS, HTTP, OSS, Plugin, Raw and S3. MongoDB is not among the supported artifact types. Why the other options are wrong. "S3": S3 is a supported type, with input, output and garbage-collection support. "Git": Git is listed as an input-only artifact type, so it is supported. "Artifactory": Artifactory is listed with input and output support.

Sources: Argo Workflows docs: Configuring Your Artifact Repository

Practice this topic

Focus mode keeps every question on Argo Workflows artifacts until you leave it. 10 free guest answers, then a free account; no credit card.

Or open CAPA practice across all topics.

Sources

The explanation above was checked against these official documents.