public boolean deleteTemporaryBuild ( Integer buildRecordId , String authToken , Consumer < Result > onComplete ) throws ValidationException { BuildRecord buildRecord = buildRecordRepository . findByIdFetchAllProperties ( buildRecordId ) ; if ( buildRecord == null ) { return false ; } if ( ! buildRecord . isTemporaryBuild ( ) ) { throw new ValidationException ( "Only deletion of the temporary builds is allowed" ) ; } executorService . submit ( ( ) -> { try { Result result = temporaryBuildsCleaner . deleteTemporaryBuild ( buildRecordId , authToken ) ; onComplete . accept ( result ) ; } catch ( ValidationException e ) { logger . error ( "Failed to delete temporary buildRecord.id: " + buildRecordId + "." , e ) ; onComplete . accept ( new Result ( buildRecordId . toString ( ) , Result . Status . FAILED , "Failed to delete temporary buildRecord." ) ) ; } } ) ; return true ; }
Deletes a single temporary build .