Buildkite CLI secret command
The bk secret command allows you to manage Buildkite secrets from the command line.
Commands
| Command | Description |
|---|---|
bk secret list |
List secrets for a cluster. |
bk secret get |
View a cluster secret. |
bk secret create |
Create a new cluster secret. |
bk secret update |
Update a cluster secret. |
bk secret delete |
Delete a cluster secret. |
List secrets
List secrets for a cluster.
bk secret list --cluster-id=STRING [flags]
Flags
| Flag | Description |
|---|---|
-o, --output=""
|
Output format. One of: json, yaml, text |
--cluster-id=STRING |
The ID of the cluster to list secrets for |
--debug |
Enable debug output for REST API calls |
--json |
Output as JSON |
--text |
Output as text |
--yaml |
Output as YAML |
Examples
List all secrets in a cluster:
bk secret list --cluster-id my-cluster-id
List secrets in JSON format:
bk secret list --cluster-id my-cluster-id -o json
Get secret
View a cluster secret.
bk secret get --cluster-id=STRING --secret-id=STRING [flags]
Flags
| Flag | Description |
|---|---|
-o, --output=""
|
Output format. One of: json, yaml, text |
--cluster-id=STRING |
The ID of the cluster |
--debug |
Enable debug output for REST API calls |
--json |
Output as JSON |
--secret-id=STRING |
The UUID of the secret to view |
--text |
Output as text |
--yaml |
Output as YAML |
Examples
View a secret:
bk secret get --cluster-id my-cluster-id --secret-id my-secret-id
View a secret in JSON format:
bk secret get --cluster-id my-cluster-id --secret-id my-secret-id -o json
Create a secret
Create a new cluster secret.
bk secret create --cluster-id=STRING --key=STRING [flags]
Flags
| Flag | Description |
|---|---|
-o, --output=""
|
Output format. One of: json, yaml, text |
--cluster-id=STRING |
The ID of the cluster |
--debug |
Enable debug output for REST API calls |
--description=STRING |
A description of the secret |
--json |
Output as JSON |
--key=STRING |
The key name for the secret (e.g. MY_SECRET) |
--policy=STRING |
The access policy for the secret (YAML format) |
--text |
Output as text |
--value=STRING |
The secret value. If not provided, you will be prompted to enter it. |
--yaml |
Output as YAML |
Examples
Create a secret with interactive value input:
bk secret create --cluster-id my-cluster-id --key MY_SECRET
Create a secret with the value provided inline:
bk secret create --cluster-id my-cluster-id --key MY_SECRET --value "s3cr3t"
Create a secret with a description:
bk secret create --cluster-id my-cluster-id --key MY_SECRET --description "My secret description"
Update secret
Update a cluster secret.
bk secret update --cluster-id=STRING --secret-id=STRING [flags]
Flags
| Flag | Description |
|---|---|
-o, --output=""
|
Output format. One of: json, yaml, text |
--cluster-id=STRING |
The ID of the cluster |
--debug |
Enable debug output for REST API calls |
--description=STRING |
Update the description of the secret |
--json |
Output as JSON |
--policy=STRING |
Update the access policy for the secret (YAML format) |
--secret-id=STRING |
The UUID of the secret to update |
--text |
Output as text |
--update-value |
Prompt to update the secret value |
--yaml |
Output as YAML |
Examples
Update a secret's description:
bk secret update --cluster-id my-cluster-id --secret-id my-secret-id --description "New description"
Update a secret's value:
bk secret update --cluster-id my-cluster-id --secret-id my-secret-id --update-value
Update both description and value:
bk secret update --cluster-id my-cluster-id --secret-id my-secret-id --description "New description" --update-value
Delete secret
Delete a cluster secret.
bk secret delete --cluster-id=STRING --secret-id=STRING
Flags
| Flag | Description |
|---|---|
--cluster-id=STRING |
The ID of the cluster |
--debug |
Enable debug output for REST API calls |
--secret-id=STRING |
The UUID of the secret to delete |
Examples
Delete a secret (with confirmation prompt):
bk secret delete --cluster-id my-cluster-id --secret-id my-secret-id
Delete a secret without confirmation:
bk secret delete --cluster-id my-cluster-id --secret-id my-secret-id --yes