@@ -49,6 +49,7 @@ export interface StartPrebuildParams {
4949 commitInfo ?: CommitInfo ;
5050 forcePrebuild ?: boolean ;
5151 trigger ?: keyof ProjectUsage ;
52+ ignoreInactiveProject ?: boolean ;
5253}
5354
5455export interface PrebuildFilter {
@@ -330,7 +331,15 @@ export class PrebuildManager {
330331
331332 async startPrebuild (
332333 ctx : TraceContext ,
333- { context, project, user, commitInfo, forcePrebuild, trigger = "lastWebhookReceived" } : StartPrebuildParams ,
334+ {
335+ context,
336+ project,
337+ user,
338+ commitInfo,
339+ forcePrebuild,
340+ trigger = "lastWebhookReceived" ,
341+ ignoreInactiveProject,
342+ } : StartPrebuildParams ,
334343 ) : Promise < StartPrebuildResult > {
335344 const span = TraceContext . startSpan ( "startPrebuild" , ctx ) ;
336345 const cloneURL = context . repository . cloneUrl ;
@@ -461,7 +470,10 @@ export class PrebuildManager {
461470 "Prebuild is rate limited. Please contact Gitpod if you believe this happened in error." ;
462471 await this . workspaceDB . trace ( { span } ) . storePrebuiltWorkspace ( prebuild ) ;
463472 span . setTag ( "ratelimited" , true ) ;
464- } else if ( await this . projectService . isProjectConsideredInactive ( user . id , project . id ) ) {
473+ } else if (
474+ ! ignoreInactiveProject &&
475+ ( await this . projectService . isProjectConsideredInactive ( user . id , project . id ) )
476+ ) {
465477 prebuild . state = "aborted" ;
466478 prebuild . error =
467479 "Project is inactive. Please start a new workspace for this project to re-enable prebuilds." ;
@@ -661,7 +673,7 @@ export class PrebuildManager {
661673 if ( ! prebuild || ! organizationId ) {
662674 throw new ApplicationError ( ErrorCodes . PRECONDITION_FAILED , "prebuild workspace not found" ) ;
663675 }
664- await this . auth . checkPermissionOnOrganization ( userId , "read_prebuild" , organizationId ) ;
676+ await this . auth . checkPermissionOnProject ( userId , "read_prebuild" , organizationId ) ;
665677
666678 const instance = await this . workspaceService . getCurrentInstance ( userId , prebuild . workspace . id , {
667679 skipPermissionCheck : true ,
0 commit comments