Skip to content

Commit

Permalink
[server] Use public services endpoint for webhooks ENG-524 (gitpod-io…
Browse files Browse the repository at this point in the history
…#18367)

* [server] Use public services endpoint for webhooks & config

* fix

* fix
  • Loading branch information
easyCZ authored Jul 28, 2023
1 parent 8c6d8e2 commit ecbb418
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/gitpod-protocol/src/util/gitpod-host-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ export class GitpodHostUrl {
return this.with((url) => ({ host: "ide." + url.host }));
}

asPublicServices(): GitpodHostUrl {
const hostSegments = this.url.host.split(".");
if (hostSegments[0] === "services") {
return this;
}
return this.with((url) => ({ host: "services." + url.host }));
}

asIDEMetrics(): GitpodHostUrl {
let newUrl: GitpodHostUrl = this;
const hostSegments = this.url.host.split(".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class BitbucketServerService extends RepositoryService {

protected getHookUrl() {
return this.config.hostUrl
.asPublicServices()
.with({
pathname: BitbucketServerApp.path,
})
Expand Down
1 change: 1 addition & 0 deletions components/server/src/prebuilds/bitbucket-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class BitbucketService extends RepositoryService {

protected getHookUrl() {
return this.config.hostUrl
.asPublicServices()
.with({
pathname: BitbucketApp.path,
})
Expand Down
1 change: 1 addition & 0 deletions components/server/src/prebuilds/github-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export class GitHubService extends RepositoryService {

protected getHookUrl() {
return this.config.hostUrl
.asPublicServices()
.with({
pathname: GitHubEnterpriseApp.path,
})
Expand Down
1 change: 1 addition & 0 deletions components/server/src/prebuilds/gitlab-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class GitlabService extends RepositoryService {

protected getHookUrl() {
return this.config.hostUrl
.asPublicServices()
.with({
pathname: GitLabApp.path,
})
Expand Down

0 comments on commit ecbb418

Please sign in to comment.