Buildkite CLI cache command

The bk cache command allows you to manage Buildkite cache resources from the command line.

Commands

Command Description
bk cache registry list List cluster cache registries.
bk cache registry view View a cluster cache registry.
bk cache registry create Create a new cluster cache registry.
bk cache registry update Update a cluster cache registry.
bk cache registry delete Delete a cluster cache registry.

List cache registries

List cluster cache registries.

bk cache registry list <cluster-uuid> [flags]

Arguments

Argument Description
<cluster-uuid> Cluster UUID to list cache registries for

Flags

Flag Description
-o, --output="" Output format. One of: json, yaml, text
--debug Log HTTP API traffic to stderr; bodies may contain sensitive data
--json Output as JSON
--limit=100 Maximum number of cache registries to return
--org=STRING Organization slug for this invocation (overrides environment and configuration)
--per-page=30 Number of cache registries per page
--text Output as text
--yaml Output as YAML

Examples

bk cache registry list my-cluster-uuid
bk cache registry list my-cluster-uuid --limit 200
bk cache registry list my-cluster-uuid --output json

View a cache registry

View a cluster cache registry.

bk cache registry view <cluster-uuid> <registry-uuid> [flags]

Arguments

Argument Description
<cluster-uuid> Cluster UUID the cache registry belongs to
<registry-uuid> Cache registry UUID to view

Flags

Flag Description
-o, --output="" Output format. One of: json, yaml, text
--debug Log HTTP API traffic to stderr; bodies may contain sensitive data
--json Output as JSON
--org=STRING Organization slug for this invocation (overrides environment and configuration)
--text Output as text
--yaml Output as YAML

Create a cache registry

Create a new cluster cache registry.

The policy file may contain YAML or JSON and must have an object at its root. Use --policy-file - to read from stdin. Policies are normalized by the API, so YAML comments and formatting are not preserved.

Omitting --policy-file creates the registry with the default unrestricted policy. Only use an unrestricted registry with builds you trust.

bk cache registry create --name=STRING <cluster-uuid> [flags]

Arguments

Argument Description
<cluster-uuid> Cluster UUID to create the cache registry in

Flags

Flag Description
-o, --output="" Output format. One of: json, yaml, text
--color=COLOR Color for the cache registry
--debug Log HTTP API traffic to stderr; bodies may contain sensitive data
--description=DESCRIPTION Description for the cache registry
--emoji=EMOJI Emoji for the cache registry
--json Output as JSON
--name=STRING Name for the cache registry
--org=STRING Organization slug for this invocation (overrides environment and configuration)
--policy-file=STRING Read the policy from a YAML or JSON file, or from stdin with -
--text Output as text
--yaml Output as YAML

Examples

Create with the default unrestricted policy (trusted builds only):

bk cache registry create my-cluster-uuid --name "Ruby gems"

Create with an explicit policy:

bk cache registry create my-cluster-uuid --name "Ruby gems" --policy-file policy.yml
cat policy.json | bk cache registry create my-cluster-uuid --name "Ruby gems" --policy-file -

Update a cache registry

Update a cluster cache registry.

At least one setter or clear flag must be provided. A metadata setter cannot be combined with its corresponding clear flag. The policy file may contain YAML or JSON and must have an object at its root. Policies are normalized by the API, so YAML comments and formatting are not preserved.

Clearing the policy sets it to null, which denies all cache saves and restores; it does not reset the registry to the unrestricted default policy.

Changing the name regenerates the registry slug. Jobs that explicitly select the old slug must be updated to use the new one.

bk cache registry update <cluster-uuid> <registry-uuid> [flags]

Arguments

Argument Description
<cluster-uuid> Cluster UUID the cache registry belongs to
<registry-uuid> Cache registry UUID to update

Flags

Flag Description
-o, --output="" Output format. One of: json, yaml, text
--clear-color Clear the cache registry color
--clear-description Clear the cache registry description
--clear-emoji Clear the cache registry emoji
--clear-policy Clear the policy, denying all cache saves and restores
--color=COLOR New color for the cache registry
--debug Log HTTP API traffic to stderr; bodies may contain sensitive data
--description=DESCRIPTION New description for the cache registry
--emoji=EMOJI New emoji for the cache registry
--json Output as JSON
--name=NAME New name for the cache registry (regenerates its slug)
--org=STRING Organization slug for this invocation (overrides environment and configuration)
--policy-file=STRING Read the new policy from a YAML or JSON file, or from stdin with -
--text Output as text
--yaml Output as YAML

Examples

bk cache registry update my-cluster-uuid my-registry-uuid --name "Ruby gems"
bk cache registry update my-cluster-uuid my-registry-uuid --policy-file policy.yml
bk cache registry update my-cluster-uuid my-registry-uuid --clear-description

Delete a cache registry

Delete a cluster cache registry.

You will be prompted to confirm deletion unless --yes is set.

bk cache registry delete <cluster-uuid> <registry-uuid>

Arguments

Argument Description
<cluster-uuid> Cluster UUID the cache registry belongs to
<registry-uuid> Cache registry UUID to delete

Flags

Flag Description
--debug Log HTTP API traffic to stderr; bodies may contain sensitive data
--org=STRING Organization slug for this invocation (overrides environment and configuration)

Examples

bk cache registry delete my-cluster-uuid my-registry-uuid
bk cache registry delete my-cluster-uuid my-registry-uuid --yes