Skip to content

Commit

Permalink
feat(bitbucketserver): multiple improvements to bitbucket server even…
Browse files Browse the repository at this point in the history
…t source

This Pull Request contains 3 improvements to the Bitbucket Server Event source.

1. Customizable Apply Webhook Check Interval

Currently the apply webhook check runs every 60 seconds which could be to often. This is now configurable.

2. Manage Webhooks for Entire Projects

When a list of Bitbucket Server Projects are provided the event source will ensure a webhook exists in all repositories in the provided project.

3. Ability to Skip Refs Changed when a Pull Request is Open

A new option has been added that adds a check when a wehook is received, when a repo:refs_changed event is received a check will be ran to skip publishing the event if a Pull Request is opened. This is to get around the issue that Bitbucket will send this event even when a Pull Request is opened and there is already a pr:from_ref_updated event that would launch multiple workflow. This allows us to have a branch, pull request and tag workflows.

Signed-off-by: Ryan Currah <[email protected]>
  • Loading branch information
ryancurrah committed Jan 20, 2024
1 parent 242520a commit 5843a9c
Show file tree
Hide file tree
Showing 15 changed files with 1,118 additions and 643 deletions.
60 changes: 49 additions & 11 deletions api/event-source.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 51 additions & 11 deletions api/event-source.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 28 additions & 10 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1149,10 +1149,10 @@
"properties": {
"accessToken": {
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector",
"description": "AccessToken is reference to K8s secret which holds the bitbucket api access information"
"description": "AccessToken is reference to K8s secret which holds the bitbucket api access information."
},
"bitbucketserverBaseURL": {
"description": "BitbucketServerBaseURL is the base URL for API requests to a custom endpoint",
"description": "BitbucketServerBaseURL is the base URL for API requests to a custom endpoint.",
"type": "string"
},
"deleteHookOnFinish": {
Expand All @@ -1178,47 +1178,57 @@
"type": "object"
},
"projectKey": {
"description": "DeprecatedProjectKey is the key of project for which integration needs to set up Deprecated: use Repositories instead. Will be unsupported in v1.8",
"description": "DeprecatedProjectKey is the key of project for which integration needs to set up. Deprecated: use Repositories instead. Will be unsupported in v1.8.",
"type": "string"
},
"projects": {
"description": "Projects holds a list of projects for which integration needs to set up, this will add the webhook to all repositories in the project.",
"items": {
"type": "string"
},
"type": "array"
},
"repositories": {
"description": "Repositories holds a list of repositories for which integration needs to set up",
"description": "Repositories holds a list of repositories for which integration needs to set up.",
"items": {
"$ref": "#/definitions/io.argoproj.eventsource.v1alpha1.BitbucketServerRepository"
},
"type": "array"
},
"repositorySlug": {
"description": "DeprecatedRepositorySlug is the slug of the repository for which integration needs to set up Deprecated: use Repositories instead. Will be unsupported in v1.8",
"description": "DeprecatedRepositorySlug is the slug of the repository for which integration needs to set up. Deprecated: use Repositories instead. Will be unsupported in v1.8.",
"type": "string"
},
"skipBranchRefsChangedOnOpenPR": {
"description": "SkipBranchRefsChangedOnOpenPR bypasses the event repo:refs_changed for branches whenever there's an associated open pull request. This helps in optimizing the event handling process by avoiding unnecessary triggers for branch reference changes that are already part of a pull request under review.",
"type": "boolean"
},
"tls": {
"$ref": "#/definitions/io.argoproj.common.TLSConfig",
"description": "TLS configuration for the bitbucketserver client."
},
"webhook": {
"$ref": "#/definitions/io.argoproj.eventsource.v1alpha1.WebhookContext",
"description": "Webhook holds configuration to run a http server"
"description": "Webhook holds configuration to run a http server."
},
"webhookSecret": {
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector",
"description": "WebhookSecret is reference to K8s secret which holds the bitbucket webhook secret (for HMAC validation)"
"description": "WebhookSecret is reference to K8s secret which holds the bitbucket webhook secret (for HMAC validation)."
}
},
"required": [
"events",
"bitbucketserverBaseURL"
],
"type": "object"
},
"io.argoproj.eventsource.v1alpha1.BitbucketServerRepository": {
"properties": {
"projectKey": {
"description": "ProjectKey is the key of project for which integration needs to set up",
"description": "ProjectKey is the key of project for which integration needs to set up.",
"type": "string"
},
"repositorySlug": {
"description": "RepositorySlug is the slug of the repository for which integration needs to set up",
"description": "RepositorySlug is the slug of the repository for which integration needs to set up.",
"type": "string"
}
},
Expand Down Expand Up @@ -3099,6 +3109,10 @@
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector",
"description": "AuthSecret holds a secret selector that contains a bearer token for authentication"
},
"checkInterval": {
"description": "CheckInterval is a duration in which to wait before checking that the webhooks exist, e.g. 1s, 30m, 2h... (defaults to 1m)",
"type": "string"
},
"endpoint": {
"description": "REST API endpoint",
"type": "string"
Expand Down Expand Up @@ -3151,6 +3165,10 @@
"$ref": "#/definitions/io.k8s.api.core.v1.SecretKeySelector",
"description": "AuthSecret holds a secret selector that contains a bearer token for authentication"
},
"checkInterval": {
"description": "CheckInterval is a duration in which to wait before checking that the webhooks exist, e.g. 1s, 30m, 2h... (defaults to 1m)",
"type": "string"
},
"endpoint": {
"description": "REST API endpoint",
"type": "string"
Expand Down
Loading

0 comments on commit 5843a9c

Please sign in to comment.