Skip to content

Commit

Permalink
feat(eventsource): add tls configuration for bitbucketserver (#2674)
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Deusser <rdeusser@users.noreply.github.com>
  • Loading branch information
rdeusser authored Jun 23, 2023
1 parent 2877cf6 commit 1b25b50
Show file tree
Hide file tree
Showing 10 changed files with 555 additions and 425 deletions.
12 changes: 12 additions & 0 deletions api/event-source.html

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

12 changes: 12 additions & 0 deletions api/event-source.md

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

4 changes: 4 additions & 0 deletions api/jsonschema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,10 @@
"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"
},
"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"
Expand Down
4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json

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

26 changes: 26 additions & 0 deletions eventsources/sources/bitbucketserver/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ func (router *Router) PostInactivate() error {
bitbucketConfig.AddDefaultHeader("x-atlassian-token", "no-check")
bitbucketConfig.AddDefaultHeader("x-requested-with", "XMLHttpRequest")

if bitbucketserverEventSource.TLS != nil {
tlsConfig, err := common.GetTLSConfig(router.bitbucketserverEventSource.TLS)
if err != nil {
return fmt.Errorf("failed to get the tls configuration, %w", err)
}

bitbucketConfig.HTTPClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
},
}
}

for _, repo := range bitbucketserverEventSource.GetBitbucketServerRepositories() {
id, ok := router.hookIDs[repo.ProjectKey+","+repo.RepositorySlug]
if !ok {
Expand Down Expand Up @@ -211,6 +224,19 @@ func (el *EventListener) StartListening(ctx context.Context, dispatch func([]byt
bitbucketConfig.AddDefaultHeader("x-atlassian-token", "no-check")
bitbucketConfig.AddDefaultHeader("x-requested-with", "XMLHttpRequest")

if bitbucketserverEventSource.TLS != nil {
tlsConfig, err := common.GetTLSConfig(router.bitbucketserverEventSource.TLS)
if err != nil {
return fmt.Errorf("failed to get the tls configuration, %w", err)
}

bitbucketConfig.HTTPClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
},
}
}

ctx, cancel := context.WithCancel(ctx)
defer cancel()

Expand Down
902 changes: 478 additions & 424 deletions pkg/apis/eventsource/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/apis/eventsource/v1alpha1/generated.proto

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

8 changes: 7 additions & 1 deletion pkg/apis/eventsource/v1alpha1/openapi_generated.go

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

3 changes: 3 additions & 0 deletions pkg/apis/eventsource/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@ type BitbucketServerEventSource struct {
// Filter
// +optional
Filter *EventSourceFilter `json:"filter,omitempty" protobuf:"bytes,11,opt,name=filter"`
// TLS configuration for the bitbucketserver client.
// +optional
TLS *apicommon.TLSConfig `json:"tls,omitempty" protobuf:"bytes,12,opt,name=tls"`
}

type BitbucketServerRepository struct {
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/eventsource/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit 1b25b50

Please sign in to comment.