Artifacts in the CLI

View as Markdown

The bdy artifact command publishes a directory as an artifact version, downloads a version to a local directory, copies versions and logs the docker client in to the Buddy container registry. The full list of flags is in the bdy artifact reference.

The examples assume the my-workspace workspace and the my-project project. You point to the project with the -p flag or the BUDDY_PROJECT variable, and you force the scope with --scope WORKSPACE or --scope PROJECT.

Artifact creation

The bdy artifact create command creates a Bucket artifact by default or a Container Image artifact when the -t CONTAINER flag is specified. An NPM Package artifact is created automatically on the first npm publish. Other artifact types can be created in the UI or through the API.

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

Two flags set external access:

  • -b - Buddy Auth, files are available after logging in to Buddy,
  • -a user:pass - HTTP Basic Auth with the given login and password.
Warning
Artifacts created using the CLI are public by default unless the -b or -a flag is specified. Public Bucket artifact versions are accessible without authentication at https://<version>-my-app-build-my-workspace.bucket-2.registry.sh. See Access control.

Artifact version publishing

bdy artifact publish sends a directory or a file as an artifact version. You give the version after a colon or after @, both forms work the same way:

bash
bdy artifact publish my-app-build:1.2.0 ./dist -p my-project
bdy artifact publish my-app-build@1.2.0 ./dist -p my-project
$$
  • Without a version number, the files go to a version named latest.
  • An existing version ends the command with exit code 1 and the message Artifact version exists. Change version name or use --force flag.
  • The -f flag replaces all content of the version. Files missing from the new directory disappear from the version, because the CLI does not merge anything.
  • If the artifact does not exist, the command fails with the message Artifact not found. Change artifact name or use --create to create one. The -c flag creates the missing artifact with public access enabled by default.

After a successful publish, the CLI suggests the command that serves the version under your own domain:

bash
bdy distro route create <distro> --domain=... --target "artifact=<id>:<ver>"
$

Artifact version download

The bdy artifact download command downloads artifact version files to a local directory. Authentication is based on the CLI token, regardless of the artifact's access control settings.

bash
bdy artifact download my-app-build:1.2.0 ./out -p my-project
$

If the target directory is not empty, the CLI stops with the message Directory ... is not empty. Use --merge or --replace flags:

  • -m adds the version files and keeps local files,
  • -r clears the directory before the download.
Info
Without a version number, download gets the latest version. If the artifact does not have one, it gets the most recently created version, not the one with the highest semver number. In scripts, give the version explicitly.

Version listing and copying

bdy artifact version ls shows the artifact versions, and bdy artifact version create with the --from flag copies an existing version under a new name. The copy does not require another build, so you can use it to promote a release:

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

--wait waits until Buddy copies the files. When copying:

  • if the target version name already exists, the command fails with Artifact version exists
  • if the source version does not exist, the command fails with Artifact version to copy does not exist
  • copying a version generates a version creation event, triggering pipelines with the corresponding artifact trigger

Deleting versions and whole artifacts (bdy artifact version rm, bdy artifact rm) is described in the CLI reference.

Container registry authentication

bdy artifact docker login saves the container.registry.sh credentials in the Docker configuration. After that, docker push and docker pull work without a separate password:

bash
bdy artifact docker login
docker push container.registry.sh/my-workspace/my-images:1.0.0
docker pull container.registry.sh/my-workspace/my-images:1.0.0
$$$

The command ends with the message Login succeeded. Tags, versions and pushing to a new name are described in Container registry.

CLI usage in scripts and pipelines

Every command accepts --format json. An error then has the form {error:{code,message,hint}} and the command ends with exit code 1, so a script can check the cause without parsing text.

The Publish Artifact Version and Download Artifact Version actions provide an alternative to CLI commands in pipelines. These actions require the appropriate artifact permissions for the pipeline and do not require a separate authentication token. See Artifacts in pipelines.

See also:

Last modified on Dec 2, 2026