Skip to content

Commit ecbb418

Browse files
authored
[server] Use public services endpoint for webhooks ENG-524 (#18367)
* [server] Use public services endpoint for webhooks & config * fix * fix
1 parent 8c6d8e2 commit ecbb418

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

components/gitpod-protocol/src/util/gitpod-host-url.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ export class GitpodHostUrl {
198198
return this.with((url) => ({ host: "ide." + url.host }));
199199
}
200200

201+
asPublicServices(): GitpodHostUrl {
202+
const hostSegments = this.url.host.split(".");
203+
if (hostSegments[0] === "services") {
204+
return this;
205+
}
206+
return this.with((url) => ({ host: "services." + url.host }));
207+
}
208+
201209
asIDEMetrics(): GitpodHostUrl {
202210
let newUrl: GitpodHostUrl = this;
203211
const hostSegments = this.url.host.split(".");

components/server/src/prebuilds/bitbucket-server-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export class BitbucketServerService extends RepositoryService {
124124

125125
protected getHookUrl() {
126126
return this.config.hostUrl
127+
.asPublicServices()
127128
.with({
128129
pathname: BitbucketServerApp.path,
129130
})

components/server/src/prebuilds/bitbucket-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export class BitbucketService extends RepositoryService {
8181

8282
protected getHookUrl() {
8383
return this.config.hostUrl
84+
.asPublicServices()
8485
.with({
8586
pathname: BitbucketApp.path,
8687
})

components/server/src/prebuilds/github-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export class GitHubService extends RepositoryService {
101101

102102
protected getHookUrl() {
103103
return this.config.hostUrl
104+
.asPublicServices()
104105
.with({
105106
pathname: GitHubEnterpriseApp.path,
106107
})

components/server/src/prebuilds/gitlab-service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export class GitlabService extends RepositoryService {
7171

7272
protected getHookUrl() {
7373
return this.config.hostUrl
74+
.asPublicServices()
7475
.with({
7576
pathname: GitLabApp.path,
7677
})

0 commit comments

Comments
 (0)