- How artifact I/O works in Argo Workflows
- How to wire output artifacts to input artifacts across steps
- How to manage artifact lifecycle with garbage collection strategies
How artifact input/output works
- Producer step: writes a file inside its container (for example,
/tmp/hello.txt), and declares it as an output artifact in the template. - Controller action: Argo Workflows uploads that artifact to the configured artifact repository on step completion.
- Consumer step: declares an input artifact. Before the step runs, Argo downloads the artifact and places it inside the container at the path you specify (for example,
/tmp/message.txt).
Example: a simple two-step workflow (generate → consume)
The following example shows a two-step workflow:generate-filecreates/tmp/hello.txtand exposes it as an output artifact namedMyGeneratedArtifact.consume-filereceives that artifact as an input namedMessageFromProducerand maps it to/tmp/message.txt.- The
maintemplate wires the producer’s output to the consumer’s input usingarguments.artifacts.from.
generate-filewrites/tmp/hello.txtand declares it as an output artifact namedMyGeneratedArtifact.consume-filedeclares an input artifactMessageFromProducermounted at/tmp/message.txt.- The
arguments.artifacts.fromexpression inmainmapsMyGeneratedArtifactfromgenerate-fileintoMessageFromProducerforconsume-file. - Before
consume-filestarts, Argo downloads the artifact and places it at/tmp/message.txt, allowing the container to runcat /tmp/message.txtto print the file contents.
Argo Workflows (controller) handles artifact upload/download. Don’t confuse this with Argo CD, which is a separate tool for GitOps and application delivery.
Artifact garbage collection (GC) — manage storage and retention
Stored artifacts consume space in the artifact repository. Argo provides artifact garbage collection (GC) strategies so you can automatically delete artifacts according to a policy. You can define a workflow-level default GC policy and override it for individual artifacts when you need finer control. Common strategies, use cases, and examples:| Strategy | Use case | Recommended for |
|---|---|---|
| OnWorkflowCompletion | Delete artifacts when the workflow finishes successfully | Temporary or intermediate artifacts |
| OnWorkflowDeletion | Keep artifacts until the Workflow resource is deleted | When you want to inspect artifacts after success |
| Never | Retain artifacts permanently | Critical outputs that must be preserved |
- Use a conservative workflow-level default (for example,
OnWorkflowDeletion) to preserve artifacts unless explicitly discarded. - Override individual artifact GC to
OnWorkflowCompletionfor ephemeral outputs that can be deleted when the workflow completes. - Mark critical artifacts with
Neverto ensure long-term retention.
Best practices and tips
- Always configure an artifact repository before using artifact I/O. For S3-compatible storage, ensure credentials and endpoint configuration are set in the Argo artifact repository config.
- Use descriptive artifact names (for example,
build-log,model-checkpoint) to make tracing outputs easier. - Combine artifact GC policies with a retention and backup plan for production workflows that produce important outputs.
- For large files or many artifacts, consider storage costs and lifecycle rules on the remote repository (e.g., S3 lifecycle policies).
Links and references
- Argo Workflows Documentation
- Kubernetes Documentation: Volumes and Storage
- S3 (Amazon Simple Storage Service)
- Minio
- Google Cloud Storage (GCS)