Skip to content

Commit b7d39c0

Browse files
authored
[papi] add prebuild log url to prebuild message (#19353)
* [papi] GetPrebuildLogUrl proto implement * Remove seperated API * fix incorrect URL module
1 parent d0b5b87 commit b7d39c0

File tree

16 files changed

+598
-124
lines changed

16 files changed

+598
-124
lines changed

components/dashboard/src/service/json-rpc-prebuild-client.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export class JsonRpcPrebuildClient implements PromiseClient<typeof PrebuildServi
5050
return new CancelPrebuildResponse();
5151
}
5252

53+
get gitpodHost(): string {
54+
return window.location.protocol + "//" + window.location.host;
55+
}
56+
5357
async getPrebuild(
5458
request: PartialMessage<GetPrebuildRequest>,
5559
options?: CallOptions,
@@ -62,7 +66,7 @@ export class JsonRpcPrebuildClient implements PromiseClient<typeof PrebuildServi
6266
throw new ApplicationError(ErrorCodes.NOT_FOUND, `prebuild ${request.prebuildId} not found`);
6367
}
6468
return new GetPrebuildResponse({
65-
prebuild: converter.toPrebuild(result),
69+
prebuild: converter.toPrebuild(this.gitpodHost, result),
6670
});
6771
}
6872

@@ -76,7 +80,7 @@ export class JsonRpcPrebuildClient implements PromiseClient<typeof PrebuildServi
7680
const prebuild = await getGitpodService().server.getPrebuild(pbws.id);
7781
if (prebuild) {
7882
return new ListPrebuildsResponse({
79-
prebuilds: [converter.toPrebuild(prebuild)],
83+
prebuilds: [converter.toPrebuild(this.gitpodHost, prebuild)],
8084
});
8185
}
8286
}
@@ -93,7 +97,7 @@ export class JsonRpcPrebuildClient implements PromiseClient<typeof PrebuildServi
9397
limit: request.pagination?.pageSize || undefined,
9498
});
9599
return new ListPrebuildsResponse({
96-
prebuilds: converter.toPrebuilds(result),
100+
prebuilds: converter.toPrebuilds(this.gitpodHost, result),
97101
});
98102
}
99103

@@ -138,7 +142,7 @@ export class JsonRpcPrebuildClient implements PromiseClient<typeof PrebuildServi
138142
} else if (pb.info.projectId !== request.scope.value) {
139143
continue;
140144
}
141-
const prebuild = converter.toPrebuild(pb);
145+
const prebuild = converter.toPrebuild(this.gitpodHost, pb);
142146
if (prebuild) {
143147
yield new WatchPrebuildResponse({ prebuild });
144148
}

components/proxy/conf/Caddyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ https://{$GITPOD_DOMAIN} {
305305
}
306306
}
307307

308-
@backend path /api/* /headless-logs/*
308+
@backend path /api/* /headless-logs/* /prebuild-logs/*
309309
handle @backend {
310310
gitpod.cors_origin {
311311
base_domain {$GITPOD_DOMAIN}

components/public-api/gitpod/v1/prebuild.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ message PrebuildStatus {
107107
google.protobuf.Timestamp start_time = 2;
108108
// message is an optional human-readable message detailing the current phase
109109
string message = 3;
110+
string log_url = 4;
110111
}
111112

112113
message PrebuildPhase {

components/public-api/go/v1/prebuild.pb.go

Lines changed: 65 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/public-api/typescript-common/fixtures/toPrebuild_1.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"name": "PHASE_BUILDING"
2121
},
2222
"startTime": "2023-11-17T10:42:00Z",
23-
"message": ""
23+
"message": "",
24+
"logUrl": "https://gitpod-test.preview.gitpod-dev.com/prebuild-logs/5fba7d7c-e740-4339-b928-0e3c5975eb37"
2425
}
2526
},
2627
"err": ""

0 commit comments

Comments
 (0)