# Versions

> For AI agents: the complete documentation index is at https://buddy.works/llms.txt

Every Buddy artifact version has a unique name. Create versions in the UI, CLI or a pipeline, copy them without a rebuild and see which runs used each one.

A version is a named state of an artifact's content: a set of files, an image or a package saved under a name that is unique within the artifact. Pipelines, sandboxes and the CLI always work on a specific version, given in the `artifact:version` format, e.g. `my-app-build:1.2.0`.

![Versions tab of an artifact](https://buddy.works/docs/artifacts/artifacts-versions-list.png)

## Artifact version naming

Version names must be unique within an artifact, e.g. `1.0.0`, `build-42`, or `3.2.0-rc`. Naming requirements depend on the artifact type. If no version name is specified, `bdy artifact download` downloads the `latest` version or, if unavailable, the most recently created version, regardless of semantic version ordering.

Creating a second version with the same name through the REST API, MCP or `bdy artifact version create` fails. You can [overwrite](#version-overwriting) the content of an existing version instead.

The CLI accepts both `my-app-build:1.2.0` and `my-app-build@1.2.0`. The version name is also part of the file address of a Bucket artifact, with dots replaced by hyphens ([Bucket](https://buddy.works/docs/artifacts/bucket.md)).

> **Warning**
>
> **`latest` is a literal version name, not an alias for the most recently published version.** The `my-app-build:latest` reference always points to the version named `latest`. Its contents must be explicitly updated to reflect subsequent builds.

## Version creation

You create a new version in the **Versions** tab, from the CLI or with an action in a pipeline. A Bucket created in the UI starts with a first, empty version named after the **Initial version name** field (`1.0.0` by default).

### Version creation in the UI

1. Open the artifact and go to the **Versions** tab.
2. Click **New version** (or **+** below the version table).
3. Enter a name in the **Version name** field and click **Create**.

![Create a new version window](https://buddy.works/docs/artifacts/artifacts-new-version-modal.png)

Buddy opens the **Browse** tab of the new version. The version is empty. You add files by dragging them in or with the **Add file** button.

### Version creation using the CLI

`bdy artifact publish` creates a version and uploads files from a directory to it right away:

```bash
bdy artifact publish my-app-build:1.2.0 ./dist -p my-project
```

### Version creation in a pipeline

The **Publish Artifact Version** action creates a separate version for each name in the `versions` list, e.g. `build-$BUDDY_RUN_ID` and `latest`. [Artifacts in pipelines](https://buddy.works/docs/artifacts/pipelines.md) describes the action fields and output variables, and the [API reference](https://buddy.works/docs/api/artifacts/versions.md) describes the version endpoints.

## Version creation and publication events

Version creation and file publication generate separate artifact events. These events can trigger pipeline execution using the [On artifact event](https://buddy.works/docs/pipelines/introduction/triggering-pipelines/on-artifact-event.md) trigger:

| Operation | Events |
| :--- | :--- |
| Empty version created through the API | **Created** only |
| Files uploaded to an existing version | **Published** for that version |
| `bdy artifact publish` to a new version | **Created** followed by **Published** |
| Version copy | **Created** for the new version |

Set a pipeline that processes files to **Published**. With **Created**, the files may not exist yet.

## Version overwriting

The content of a Bucket artifact version is overwritten by:

- the [**Publish Artifact Version**](https://buddy.works/docs/artifacts/pipelines.md) action, which syncs the version with the `local_path` directory,
- `bdy artifact publish` with the `-f` flag, which replaces the whole content of the version and does not merge it with the previous files,
- the MCP tool `publish-artifact-version`, which replaces the version content with files from a ZIP archive.

```bash
bdy artifact publish my-app-build:1.2.0 ./dist -f -p my-project
```

Without `-f`, the command fails with `Artifact version exists. Change version name or use --force flag`. Files uploaded in the UI with the **Add file** button are added to the existing version.

Version overwriting depends on the artifact type. Existing image tags in the [Container registry](https://buddy.works/docs/artifacts/container-registry.md) can be overwritten using `docker push`. Published package versions in the [npm registry](https://buddy.works/docs/artifacts/npm-registry.md) and [Composer registry](https://buddy.works/docs/artifacts/composer-registry.md) cannot be overwritten.

## Version copying

A copy is a new version with the same files as the source version, with modification dates preserved. This is how you promote a tested build, e.g. from `3.2.0` to `3.2.0-promoted`, without building it again.

In the UI, open the **⋮** menu next to the version, select **Copy**, enter the copy name in the **Version name** field and click **Create**.

![Version menu in the Versions tab](https://buddy.works/docs/artifacts/artifacts-version-menu.png)

From the CLI:

```bash
bdy artifact version create my-app-build:3.2.0-promoted --from 3.2.0 --wait -p my-project
```

- `my-app-build:3.2.0-promoted` - the artifact and the name of the new version,
- `--from` - the source version,
- `--wait` - waits until the files are copied,
- `-p` - the artifact's project.

## Version creation

Artifact versions can be deleted in the UI, using the CLI, or through the **Artifact Cleanup** action. Deleting versions in the UI or using the CLI requires the **Manage** permission level in the **Artifacts** module of the assigned project role. When the CLI authenticates using a personal access token, the token must also have the **Artifacts** scope at the **Manage** level (`ARTIFACT_MANAGE` in the API).

- **UI** - the **⋮** menu next to the version, **Delete**, then confirm with **Yes, delete** in the same menu.
- **CLI** - `bdy artifact version delete my-app-build 3.2.0-rc -p my-project`. The `-f` flag skips the confirmation prompt.
- **Pipeline** - the Artifact Cleanup action removes versions that match a pattern, e.g. `build-*`. The pipeline needs the **Manage** level, described in [Cleanup and retention](https://buddy.works/docs/artifacts/cleanup-and-retention.md).

## Version contents

The **Browse** tab shows the files of the selected version. The file menu has the **Download** and **Raw** options.

![Browse tab with the files of an artifact version](https://buddy.works/docs/artifacts/artifact-browse.png)

The **⋮** menu next to a version in the **Versions** tab contains:

- **Use as pipeline context** - runs a pipeline with this version,
- **Download** and **Open in browser**,
- **Copy** - not available with the Read-only role,
- **Delete** - requires the **Manage** level in the Artifacts module.

The **Read-only** permission level in the **Artifacts** module allows listing versions, browsing their contents, downloading files, opening version URLs, and using versions as pipeline context. Version creation, copying, and deletion are unavailable at this permission level. See [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md).

## Associated pipeline runs

Buddy records the runs related to a version, e.g. the runs that published it, downloaded it or were started with it. A red dot next to the version name means that at least one of these runs failed. Hover over the dot to see a summary of the runs.

![Run status tooltip next to an artifact version](https://buddy.works/docs/artifacts/artifact-version-runs.png)

To run a pipeline with a specific version, select it in the **Artifact version** field in the **Run** window. The field appears in pipelines with an `artifacts` context or an artifact trigger. The version files then reach the pipeline filesystem, and the run has `BUDDY_RUN_ARTIFACT_*` variables, as described in [Run a pipeline with an artifact version](https://buddy.works/docs/artifacts/run-with-version.md).

See also:

- [Bucket](https://buddy.works/docs/artifacts/bucket.md) - the version address, uploading and downloading files
- [Run a pipeline with an artifact version](https://buddy.works/docs/artifacts/run-with-version.md) - a version as the run context
- [Cleanup and retention](https://buddy.works/docs/artifacts/cleanup-and-retention.md) - removing old versions from a pipeline
- [bdy artifact version](https://buddy.works/docs/cli/artifact/version.md) - the full list of flags for version commands


---
Original source: https://buddy.works/docs/artifacts/versions