# Quick start

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

Create a Buddy artifact, publish build output as a version with the Publish Artifact Version action, and download it in another pipeline or from the CLI.

An artifact stores build output as versions that another pipeline, a sandbox or the CLI downloads by name. You can also upload files to a version in the UI or with the `bdy artifact publish` command, without a pipeline ([Bucket](https://buddy.works/docs/artifacts/bucket.md)).

## Create an artifact

You create a Bucket artifact in the UI or from the CLI. Before a pipeline can publish anything, it needs access to the artifact in the **Permissions** tab.

### Create an artifact in the UI

In the project sidebar, open **Artifacts**, click **New artifact** and select **Bucket**.

![Artifact types in the New artifact menu](https://buddy.works/docs/artifacts/new-artifact-types.png)

The form has four fields:

- **Name** - the artifact name, which its ID is created from, for example `my-app-build`,
- [**Scope**](https://buddy.works/docs/artifacts/scopes.md) - workspace, project or environment,
- **Initial version name** - the name of the first version, `1.0.0` by default,
- [**Access control**](https://buddy.works/docs/artifacts/access-control.md) - access to the files from outside Buddy: Buddy Auth, HTTP BA or Public.

![New Bucket artifact form](https://buddy.works/docs/artifacts/artifacts-new-bucket-form.png)

When you save the form, an empty `1.0.0` version is created right away.

### Create an artifact using the CLI

```bash
bdy artifact create my-app-build -b -p my-project
```

> **Warning**
>
> The flag you pass to `bdy artifact create` sets access to the artifact files:
>
> - `-b` - enables Buddy Auth, requiring authentication with a Buddy account
> - `-a user:pass` - enables HTTP Basic Authentication with the specified username and password
> - Without `-b` or `-a` - the artifact is public, and its versions are accessible without authentication at `https://<version>-my-app-build-<workspace>.bucket-2.registry.sh`
>
> `bdy artifact publish` with the `-c` flag also creates a public artifact.

### Configure pipeline permissions

Before the first run, open the **Permissions** tab of the artifact and, in the **Pipeline** section, use the **+** button to add the pipelines that will use the artifact. The **All pipelines** row can stay on **Deny**, so the other pipelines have no access to the versions. The minimum level depends on the action:

| Action | Minimum permission level |
|---|---|
| Download Artifact Version | Read-only |
| Publish Artifact Version | Read-write |

![Pipeline entry with its own access level while All pipelines is set to Deny](https://buddy.works/docs/artifacts/artifacts-permissions-pipeline.png)

[Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md) describes the other levels and access for sandboxes. [Troubleshooting](https://buddy.works/docs/artifacts/troubleshooting.md#pipeline-actions) lists the access errors and how to fix them.

## Publish a version from a pipeline

The **Publish Artifact Version** action publishes files from the pipeline filesystem as one or more artifact versions. The following pipeline generates a sample file in the `dist` directory and publishes the directory contents as `build-<run ID>` and `latest`:

```yaml
- pipeline: build-and-publish
  name: Build and publish
  refs:
  - refs/heads/main
  actions:
  - action: Build
    type: BUILD
    docker_image_name: library/ubuntu
    docker_image_tag: "24.04"
    commands: |-
      mkdir -p dist
      echo "build $BUDDY_RUN_ID" > dist/index.html
  - action: Publish artifact version
    type: PUBLISH_ARTIFACT_VERSION
    artifact: my-app-build
    versions:
    - build-$BUDDY_RUN_ID
    - latest
    input_type: BUILD_ARTIFACTS
    local_path: /dist
```

Replace the commands in the Build action with your own build. `input_type: BUILD_ARTIFACTS` means files from the pipeline filesystem, and `local_path` points to the directory to publish.

In the run log, the action has a separate setup step and a separate step for each version in the `versions` list. The next actions have access to the `BUDDY_ARTIFACT_*` variables:

```
BUDDY_ARTIFACT=my-app-build
BUDDY_ARTIFACT_VERSION=build-3
BUDDY_ARTIFACT_VERSION_RAW_URL=https://build-3-my-app-build-my-workspace.bucket-2.registry.sh
BUDDY_ARTIFACT_VERSION_URL=https://app.buddy.works/my-workspace/my-project/artifacts/<id>/versions/<versionId>
```

![Publish artifact version action log with output variables](https://buddy.works/docs/artifacts/artifacts-publish-run-log.png)

## Download the version in another pipeline

The **Download Artifact Version** action copies the files of the selected version to the pipeline filesystem. The second pipeline downloads the `latest` version to the `downloaded` directory and lists the files:

```yaml
- pipeline: use-build
  name: Use build
  refs:
  - refs/heads/main
  actions:
  - action: Download artifact version
    type: DOWNLOAD_ARTIFACT_VERSION
    artifact: my-app-build
    version: latest
    destination_path: /downloaded
    overwrite: true
  - action: List downloaded
    type: BUILD
    docker_image_name: library/ubuntu
    docker_image_tag: "24.04"
    commands: |-
      find downloaded -type f
```

The pipeline filesystem persists between runs. In the second run, the `downloaded` directory already contains the files from the first one, so the download fails without `overwrite: true`.

> **Warning**
>
> `latest` is a literal version name explicitly published by the first pipeline on every run. It does not automatically reference the most recently published version. If the `latest` version is not published, specify an existing version name in the action, e.g. `build-3`.

## Publish and download versions using the CLI

Without a pipeline, you publish and download a directory with the CLI:

```bash
bdy artifact publish my-app-build:1.1.0 ./dist -p my-project
bdy artifact download my-app-build:1.1.0 ./out -p my-project
```

- Without a version number, `publish` saves the files to the `latest` version.
- Publishing the same version again fails with `Artifact version exists. Change version name or use --force flag`. The `-f` flag replaces the whole content of the version, without merging it with the previous files.
- `download` to a non-empty directory requires `-m` (keeps local files) or `-r` (clears the directory before the download).

The [CLI reference](https://buddy.works/docs/cli/artifact.md) describes all flags.

## Browsing artifact versions

The list of versions is in the **Versions** tab. The content of the selected version is in the **Browse** tab, where you can download each file (**Download**) or open it in raw form (**Raw**).

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

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

See also:

- [Introduction](https://buddy.works/docs/artifacts/introduction.md) - what an artifact is and how it differs from the pipeline filesystem
- [Versions](https://buddy.works/docs/artifacts/versions.md) - copying and overwriting versions, runs that used a version
- [Artifacts in pipelines](https://buddy.works/docs/artifacts/pipelines.md) - triggers, the `BUDDY_RUN_ARTIFACT_*` variables and Artifact Cleanup
- [Permissions and access](https://buddy.works/docs/artifacts/permissions-and-access.md) - access levels for pipelines, sandboxes and roles
- [Artifacts API](https://buddy.works/docs/api/artifacts.md) - REST endpoints for creating artifacts and versions


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