Skip to content

Commit

Permalink
move to correct struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancurrah committed Feb 16, 2024
1 parent d352072 commit 4a7608b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions eventsources/sources/bitbucketserver/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt
applyWebhooks()

var checkInterval time.Duration
if bitbucketserverEventSource.Webhook.CheckInterval == "" {
if bitbucketserverEventSource.CheckInterval == "" {
checkInterval = 60 * time.Second
} else {
checkInterval, err = time.ParseDuration(bitbucketserverEventSource.Webhook.CheckInterval)
checkInterval, err = time.ParseDuration(bitbucketserverEventSource.CheckInterval)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions eventsources/sources/bitbucketserver/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ func validate(eventSource *v1alpha1.BitbucketServerEventSource) error {
if eventSource.BitbucketServerBaseURL == "" {
return fmt.Errorf("bitbucket server base url can't be empty")
}
if eventSource.Webhook.CheckInterval != "" {
if _, err := time.ParseDuration(eventSource.Webhook.CheckInterval); err != nil {
if eventSource.CheckInterval != "" {
if _, err := time.ParseDuration(eventSource.CheckInterval); err != nil {
return fmt.Errorf("failed to parse webhook check interval duration: %w", err)
}
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/apis/eventsource/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,9 @@ type BitbucketServerEventSource struct {
// TLS configuration for the bitbucketserver client.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,14,opt,name=tls"`
// CheckInterval is a duration in which to wait before checking that the webhooks exist, e.g. 1s, 30m, 2h... (defaults to 1m)
// +optional
CheckInterval string `json:"checkInterval" protobuf:"bytes,15,opt,name=checkInterval"`
}

type BitbucketServerRepository struct {
Expand Down
3 changes: 0 additions & 3 deletions pkg/apis/eventsource/v1alpha1/webhook_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ type WebhookContext struct {
// Default value: 1048576 (1MB).
// +optional
MaxPayloadSize *int64 `json:"maxPayloadSize,omitempty" protobuf:"bytes,9,opt,name=maxPayloadSize"`
// CheckInterval is a duration in which to wait before checking that the webhooks exist, e.g. 1s, 30m, 2h... (defaults to 1m)
// +optional
CheckInterval string `json:"checkInterval" protobuf:"bytes,10,opt,name=checkInterval"`
}

func (wc *WebhookContext) GetMaxPayloadSize() int64 {
Expand Down

0 comments on commit 4a7608b

Please sign in to comment.