dr artifact - Artifact management
Build and manage the container artifacts that back your DataRobot workloads. An artifact bundles one or more container images, built from your code or pulled from a registry, into a spec that a workload can later run. The dr artifact group is a thin wrapper over the Workload API: each subcommand maps to a single operation on an artifact, its builds, or its code.
Synopsis
Description
An artifact is a versioned container spec made up of one or more container groups. Every artifact moves through a one-way lifecycle:
createregisters a draft from a JSON or YAML spec.codeandbuildfill in the container images (see below).lockpromotes the draft to locked. A locked artifact gets a version number, its name and spec become immutable, and it can no longer be deleted or unlocked.
Each container in the spec is one of two kinds:
- Prebuilt: set
imageUrito an existing image. There is nothing to build. - Built from source: set
imageBuildConfig, push your code withdr artifact code sync, and produce an image withdr artifact build create. The Dockerfile is either one you provide (./Dockerfile) or one the server generates from a base environment.
The code subcommands keep a local directory in sync with an artifact's source. They store a .wapi/ state directory at the project root, much like .git/: local work happens in the project root while .wapi/ records the remote binding and last-synced state. Once a directory is linked with dr artifact code init, the build and code subcommands read the artifact id from .wapi/config.json, so you can leave it off.
A locked, fully built artifact is what you hand to dr workload create to deploy. See dr workload.
[!NOTE] The
artifactcommand is currently behind a feature gate. Enable it by exportingDATAROBOT_CLI_FEATURE_WORKLOAD=truebefore running anydr artifactsubcommand. See Feature gates for details.First time? If you're new to the CLI, start with the Quick start for step-by-step setup instructions.
Quick start
# Register a draft artifact from a spec file
dr artifact create --spec-file spec.yaml
# Link the current directory to it, then push your code
dr artifact code init <artifact-id>
dr artifact code sync
# Build the container image and wait for it to finish
dr artifact build create --wait
# Lock the artifact once the build succeeds
dr artifact lock <artifact-id>
Command groups
| Command | Endpoint | Purpose |
|---|---|---|
dr artifact create |
POST /api/v2/artifacts/ |
Register a draft artifact from a JSON/YAML spec. |
dr artifact get |
GET /api/v2/artifacts/{id}/ |
Show a single artifact. |
dr artifact list |
GET /api/v2/artifacts/ |
List artifacts, optionally filtered by status. |
dr artifact lock |
PATCH /api/v2/artifacts/{id}/ |
Promote a draft to locked (immutable). |
dr artifact delete |
DELETE /api/v2/artifacts/{id}/ |
Delete an artifact. |
dr artifact build … |
…/artifacts/{id}/builds[/{build-id}] |
Trigger, inspect, and read logs from image builds. |
dr artifact code … |
DataRobot catalog (Files API) | Sync local code with an artifact (init, sync, versions, checkout). |
Subcommands
create
Register a new draft artifact from a JSON or YAML spec file. The spec needs a name and at least one container group with at least one container. JSON is sent to the server byte-for-byte; YAML is converted to JSON first, so quote any value that must stay a string (for example "0644"). On a shape mismatch the server returns a 422 naming the offending JSON path.
Flags:
--spec-file <path>: path to the JSON or YAML spec (required).--output-format <text|json>: output format. Defaults totext.
Example:
# spec.yaml - a single prebuilt container
name: my-agent
spec:
containerGroups:
- containers:
- imageUri: nginx:latest
port: 8080
primary: true
To build from source instead of using a prebuilt image, replace the container's imageUri with an imageBuildConfig:
name: my-agent
spec:
containerGroups:
- containers:
- primary: true
port: 8080
imageBuildConfig:
dockerfile:
source: provided # build from ./Dockerfile in your synced code
get
Show a single artifact: its name, status, code reference, and timestamps.
list
List artifacts, most useful with a status filter.
Flags:
--status <draft|locked>: only show artifacts in this status.--limit <N>: maximum number to return. Defaults to100.--output-format <text|json>: output format. Defaults totext.
lock
Promote a draft artifact to locked. Before locking, the server checks that every container built from source has its code uploaded and an image build completed; otherwise the lock is rejected and the error names what is missing. Locking is one-way.
delete
Delete an artifact by id. Locked artifacts cannot be deleted, and an artifact still referenced by a workload cannot be deleted either (the error names the blocking workloads, so delete those first). You are asked to confirm unless --yes is set.
Flags:
--yes,-y: skip the confirmation prompt. Also honored viaDATAROBOT_CLI_NON_INTERACTIVE=1.
build
Trigger and inspect container image builds for an artifact. Inside a linked directory the <artifact-id> argument can be omitted; it is read from .wapi/config.json.
dr artifact build create [<artifact-id>] [--wait] # trigger a build
dr artifact build list [<artifact-id>] [--limit N] # list builds, newest first
dr artifact build get [<artifact-id>] <build-id> [--wait] # show one build
dr artifact build logs [<artifact-id>] <build-id> [--level debug|info|warn|error]
build create prints the new build id(s) and returns right away. With --wait it polls until each build reaches a terminal status (COMPLETED, FAILED, or CANCELLED), prints a summary with the duration and resulting image, and on failure dumps the tail of the build log. build logs shows one structured record per line and hides anything below info unless you lower --level.
code
Synchronize a local project directory with an artifact's source code. Run init once to link a directory, then sync to push and pull changes.
dr artifact code init [<artifact-id>] [--dir <path>] [--yes]
dr artifact code sync [--dir <path>] [--dry-run | --diff] [--yes]
dr artifact code versions [--dir <path>] [--limit N]
dr artifact code checkout [<ver>] [--dir <path>] [--clean]
initcreates the.wapi/state directory and binds it to an existing draft artifact. The artifact must already exist (dr artifact createor the DataRobot UI); these commands manage an artifact's code, not its lifecycle.synccomputes a three-way diff against the last synced state and applies it in one versioned step. Conflicts resolve to the remote copy, and your version is kept as a*.LOCAL.<timestamp>file. Preview with--dry-run, or use--diffto also see per-file diffs. Both exit before any remote write.versionslists the artifact's catalog versions, marking the one the artifact currently points at (*) and noting the one you last synced.checkoutdownloads a version into.wapi/.checkouts/<version-id>/for read-only inspection; your working directory is left untouched.--cleanremoves checkout directories instead of downloading.
Shared flags
--output-format
Every subcommand that prints a resource accepts --output-format json for machine-parseable output. The default, text, is human-readable.
--yes
Commands that prompt (delete, code init, code sync, code checkout) accept --yes / -y to skip the prompt. Setting DATAROBOT_CLI_NON_INTERACTIVE=1 does the same, and prompts are skipped automatically when stdin is not a terminal.
Global options
All global flags are available, notably --debug for protocol-level tracing.
Examples
Build and lock an artifact from source
dr artifact create --spec-file spec.yaml # prints the new artifact id
dr artifact code init <artifact-id>
dr artifact code sync # upload your code
dr artifact build create --wait # build the image, wait for it
dr artifact lock <artifact-id> # freeze it for deployment
Inspect builds and logs
dr artifact build list <artifact-id>
dr artifact build get <artifact-id> <build-id> --wait
dr artifact build logs <artifact-id> <build-id> --level debug
Error handling
| Status | Cause |
|---|---|
404 |
The artifact, build, or version does not exist. |
409 |
Tried to delete a locked artifact, delete one still referenced by a workload, or lock an already-locked artifact. |
422 |
The spec failed server validation; the response names the offending JSON path. |
See also
dr workload: deploy a locked artifact as a running workload.- Authentication: how
dr auth loginand--skip-authinteract. - Configuration: config file and environment-variable precedence.
- Feature gates: turning
DATAROBOT_CLI_FEATURE_WORKLOADon and off.