From d1ab4959fe77e706faa7d296f666864f73f31eb6 Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Mon, 10 May 2021 16:19:08 +0000 Subject: [PATCH] Implement a '#/incremental-prebuild/' manual prefix --- .../dashboard/src/start/StartWorkspace.tsx | 2 +- components/server/ee/src/container-module.ts | 2 + ...art-incremental-prebuild-context-parser.ts | 42 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 components/server/ee/src/prebuilds/start-incremental-prebuild-context-parser.ts diff --git a/components/dashboard/src/start/StartWorkspace.tsx b/components/dashboard/src/start/StartWorkspace.tsx index 3397d789558c3c..889d0dceb0a710 100644 --- a/components/dashboard/src/start/StartWorkspace.tsx +++ b/components/dashboard/src/start/StartWorkspace.tsx @@ -149,7 +149,7 @@ export default class StartWorkspace extends React.Component { + if (!CommitContext.is(context)) { + throw new Error("can only start incremental prebuilds on a commit context") + } + + const host = new URL(context.repository.cloneUrl).hostname; + const hostContext = this.hostContextProvider.get(host); + const maxDepth = this.env.incrementalPrebuildsCommitHistory; + const result: StartPrebuildContext = { + title: `Prebuild of "${context.title}"`, + actual: context, + commitHistory: await (hostContext?.contextParser?.fetchCommitHistory({}, user, context.repository.cloneUrl, context.revision, maxDepth) || []) + }; + return result; + } + +} \ No newline at end of file