File tree 3 files changed +28
-1
lines changed 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,9 @@ export default class CreateWorkspace extends React.Component<CreateWorkspaceProp
269
269
return (
270
270
< RunningPrebuildView
271
271
runningPrebuild = { result . runningWorkspacePrebuild }
272
+ onUseLastSuccessfulPrebuild = { ( ) =>
273
+ this . createWorkspace ( CreateWorkspaceMode . UseLastSuccessfulPrebuild )
274
+ }
272
275
onIgnorePrebuild = { ( ) => this . createWorkspace ( CreateWorkspaceMode . ForceNew ) }
273
276
onPrebuildSucceeded = { ( ) => this . createWorkspace ( CreateWorkspaceMode . UsePrebuild ) }
274
277
/>
@@ -531,6 +534,7 @@ interface RunningPrebuildViewProps {
531
534
starting : RunningWorkspacePrebuildStarting ;
532
535
sameCluster : boolean ;
533
536
} ;
537
+ onUseLastSuccessfulPrebuild : ( ) => void ;
534
538
onIgnorePrebuild : ( ) => void ;
535
539
onPrebuildSucceeded : ( ) => void ;
536
540
}
@@ -565,8 +569,14 @@ function RunningPrebuildView(props: RunningPrebuildViewProps) {
565
569
{ /* TODO(gpl) Copied around in Start-/CreateWorkspace. This should properly go somewhere central. */ }
566
570
< div className = "h-full mt-6 w-11/12 lg:w-3/5" >
567
571
< PrebuildLogs workspaceId = { workspaceId } onIgnorePrebuild = { props . onIgnorePrebuild } >
572
+ < button
573
+ className = "secondary"
574
+ onClick = { ( ) => props . onUseLastSuccessfulPrebuild && props . onUseLastSuccessfulPrebuild ( ) }
575
+ >
576
+ Use Last Successful Prebuild
577
+ </ button >
568
578
< button className = "secondary" onClick = { ( ) => props . onIgnorePrebuild && props . onIgnorePrebuild ( ) } >
569
- Skip Prebuild
579
+ Don't Wait For Prebuild
570
580
</ button >
571
581
</ PrebuildLogs >
572
582
</ div >
Original file line number Diff line number Diff line change @@ -1372,6 +1372,8 @@ export enum CreateWorkspaceMode {
1372
1372
UsePrebuild = "use-prebuild" ,
1373
1373
// SelectIfRunning returns a list of currently running workspaces for the context URL if there are any, otherwise falls back to Default mode
1374
1374
SelectIfRunning = "select-if-running" ,
1375
+ // UseLastSuccessfulPrebuild returns ...
1376
+ UseLastSuccessfulPrebuild = "use-last-successful-prebuild" ,
1375
1377
}
1376
1378
1377
1379
export namespace WorkspaceCreationResult {
Original file line number Diff line number Diff line change @@ -963,6 +963,21 @@ export class GitpodServerEEImpl extends GitpodServerImpl {
963
963
964
964
const logCtx : LogContext = { userId : user . id } ;
965
965
const cloneUrl = context . repository . cloneUrl ;
966
+ if ( mode === CreateWorkspaceMode . UseLastSuccessfulPrebuild ) {
967
+ const maxDepth = this . config . incrementalPrebuilds . commitHistory ;
968
+ const hostContext = this . hostContextProvider . get ( context . repository . host ) ;
969
+ const repoProvider = hostContext ?. services ?. repositoryProvider ;
970
+ if ( repoProvider ) {
971
+ const commitHistory = await repoProvider . getCommitHistory (
972
+ user ,
973
+ context . repository . owner ,
974
+ context . repository . name ,
975
+ context . revision ,
976
+ maxDepth ,
977
+ ) ;
978
+ log . info ( "findPrebuiltWorkspace: incremental workspace" , { commitHistory } ) ;
979
+ }
980
+ }
966
981
const prebuiltWorkspace = await this . workspaceDb
967
982
. trace ( ctx )
968
983
. findPrebuiltWorkspaceByCommit ( cloneUrl , commitSHAs ) ;
You can’t perform that action at this time.
0 commit comments