bb webhook¶
Create, list, test and change a repository's webhooks
7 commands.
bb webhook create- Create a repository webhook
bb webhook delete- Delete a repository webhook
bb webhook get- Get a repository webhook by ID
bb webhook list- List repository webhooks
bb webhook stats- Get repository webhook statistics
bb webhook test- Test connection to repository webhook URL by sending a ping event
bb webhook update- Update a repository webhook
bb webhook create¶
Create a repository webhook
bb webhook create <name> <url> [flags]
# Call an endpoint when anything is pushed to the repository
bb webhook create ci https://ci.example.com/hooks/bitbucket --repo PROJ/repo
# On pull request events, signed with a shared secret read from stdin
printf '%s' "$WEBHOOK_SECRET" | bb webhook create reviews \
https://ci.example.com/hooks/reviews --repo PROJ/repo \
--event pr:opened --event pr:merged --secret-stdin
--active- Whether the new webhook is active (default true)
--credentials-password-stdin- Read the endpoint password from stdin (or set BB_WEBHOOK_PASSWORD)
--credentials-username string- Username Bitbucket authenticates to the endpoint with
--event strings- Webhook event(s) to subscribe to (default [repo:refs_changed])
--secret-stdin- Read the shared secret from stdin (or set BB_WEBHOOK_SECRET)
--ssl-verification string- Whether Bitbucket verifies the endpoint's TLS certificate, left as the server has it when omitted (one of: true, false)
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)
Output with --json, where ? marks a field that can be absent
data
status string Outcome of the command.
repository object
projectKey string Project key the repository belongs to.
slug string Repository slug.
webhook object
id? integer Webhook identifier, which get, update and delete address.
name? string Webhook name.
url? string Endpoint Bitbucket posts to.
active boolean Whether the webhook currently fires.
events? list of string Event keys the webhook subscribes to, for example repo:refs_changed.
sslVerificationRequired? boolean Whether Bitbucket verifies the endpoint's TLS certificate.
scopeType? string Where the webhook is configured: repository or project.
secretConfigured boolean Whether a shared secret is configured.
credentialsUsername? string Username Bitbucket authenticates to the endpoint with.
secret? string The shared secret in plaintext.
created boolean Whether a webhook was created.
bb webhook delete¶
Delete a repository webhook
bb webhook delete <webhook-id> [flags]
# By the id bb webhook list prints
bb webhook delete 12 --repo PROJ/repo
-y, --yes- Confirm without being asked; applies only when the target is named with --repo PROJECT/slug
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)
Output with --json, where ? marks a field that can be absent
data
status string Outcome of the command.
repository object
projectKey string Project key the repository belongs to.
slug string Repository slug.
webhookId string Identifier of the webhook that was deleted.
bb webhook get¶
Get a repository webhook by ID
bb webhook get <webhook-id> [flags]
# One webhook, with its secret redacted
bb webhook get 12 --repo PROJ/repo
--reveal-secret- Print the webhook's shared secret instead of redacting it
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back
Output with --json, where ? marks a field that can be absent
data
webhook object
id? integer Webhook identifier, which get, update and delete address.
name? string Webhook name.
url? string Endpoint Bitbucket posts to.
active boolean Whether the webhook currently fires.
events? list of string Event keys the webhook subscribes to, for example repo:refs_changed.
sslVerificationRequired? boolean Whether Bitbucket verifies the endpoint's TLS certificate.
scopeType? string Where the webhook is configured: repository or project.
secretConfigured boolean Whether a shared secret is configured.
credentialsUsername? string Username Bitbucket authenticates to the endpoint with.
secret? string The shared secret in plaintext.
bb webhook list¶
List repository webhooks
bb webhook list [flags]
# A repository's webhooks
bb webhook list --repo PROJ/repo
--all- Return every result rather than the first --limit
--limit int- Maximum number of results to return (default 25)
--start int- Start offset for list operations
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back
Output with --json, where ? marks a field that can be absent
data
webhooks list of object or null Webhooks configured on the repository.
id? integer Webhook identifier, which get, update and delete address.
name? string Webhook name.
url? string Endpoint Bitbucket posts to.
active boolean Whether the webhook currently fires.
events? list of string Event keys the webhook subscribes to, for example
repo:refs_changed.
sslVerificationRequired? boolean Whether Bitbucket verifies the endpoint's TLS certificate.
scopeType? string Where the webhook is configured: repository or project.
secretConfigured boolean Whether a shared secret is configured.
credentialsUsername? string Username Bitbucket authenticates to the endpoint with.
secret? string The shared secret in plaintext.
bb webhook stats¶
Get repository webhook statistics
bb webhook stats <webhook-id> [flags]
# The delivery statistics of a webhook
bb webhook stats 12 --repo PROJ/repo
# The summary only
bb webhook stats 12 --repo PROJ/repo --summary
--summary- Get statistics summary instead of detailed stats
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back
Output with --json: its data has no shape bb can promise: returns whatever the statistics endpoint answered, untyped, and prints it without reading a field
bb webhook test¶
Test connection to repository webhook URL by sending a ping event
bb webhook test <webhook-id> [flags]
# Send a test ping to a webhook's endpoint
bb webhook test 12 --repo PROJ/repo
# To another URL, before pointing the webhook at it
bb webhook test 12 --repo PROJ/repo --url https://ci.example.com/hooks/new
--reveal-secret- Print the endpoint credentials Bitbucket sent instead of redacting it
--url string- Test this URL instead of the webhook's configured one
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Predicts the outcome from what it can read, without changing anything (predicted)
Output with --json: its data has no shape bb can promise: returns whatever the webhook endpoint answered, untyped, and prints it without reading a field
bb webhook update¶
Update a repository webhook
bb webhook update <webhook-id> [flags]
# Point a webhook at a new endpoint
bb webhook update 12 --repo PROJ/repo --url https://ci.example.com/hooks/new
# Replace the events it fires on
bb webhook update 12 --repo PROJ/repo --event pr:opened --event pr:merged
# Switch it off without deleting it
bb webhook update 12 --repo PROJ/repo --active false
# Have Bitbucket sign in to the endpoint, with the password read from stdin
printf '%s' "$ENDPOINT_PASSWORD" | bb webhook update 12 --repo PROJ/repo \
--credentials-username bitbucket --credentials-password-stdin
--active string- Active status, unchanged when omitted (one of: true, false)
--credentials-password-stdin- Read the endpoint password from stdin (or set BB_WEBHOOK_PASSWORD)
--credentials-username string- Username Bitbucket authenticates to the endpoint with
--event strings- New list of webhook events to subscribe to
--name string- New name of the webhook
--no-credentials- Remove the endpoint credentials from the webhook
--no-secret- Remove the shared secret from the webhook
--secret-stdin- Read the shared secret from stdin (or set BB_WEBHOOK_SECRET)
--ssl-verification string- Whether Bitbucket verifies the endpoint's TLS certificate, left as the server has it when omitted (one of: true, false)
--url string- New URL of the webhook
Inherited from bb webhook:
--repo string- Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)
Also takes the global flags.
Dry run: Predicts the outcome from what it can read, without changing anything (predicted)
Output with --json, where ? marks a field that can be absent
data
status string Outcome of the command.
repository object
projectKey string Project key the repository belongs to.
slug string Repository slug.
webhook object
id? integer Webhook identifier, which get, update and delete address.
name? string Webhook name.
url? string Endpoint Bitbucket posts to.
active boolean Whether the webhook currently fires.
events? list of string Event keys the webhook subscribes to, for example repo:refs_changed.
sslVerificationRequired? boolean Whether Bitbucket verifies the endpoint's TLS certificate.
scopeType? string Where the webhook is configured: repository or project.
secretConfigured boolean Whether a shared secret is configured.
credentialsUsername? string Username Bitbucket authenticates to the endpoint with.
secret? string The shared secret in plaintext.