Interface BuildsCleanupExtension
-
- All Superinterfaces:
ServerExtension
,TeamCityExtension
- All Known Subinterfaces:
CleanupExtension
- All Known Implementing Classes:
BuildArtifactsCleaner
,BuildDataStorageImpl
,BuildTablesCleanerImpl
,CleanupExtensionAdapter
,DependencyParametersProvider
,ExternalBuildArtifactsCacheImpl
,PipelineParametersProvider
public interface BuildsCleanupExtension extends ServerExtension
Invoked for each build package which is to be cleaned up. An extension might not be called for every cleanup run as the cleanup process can be interrupted earlier. Also, some builds may be skipped if they were cleaned up by the extension during previous cleanup runs. Extensions must check the cleanup process state and if it is interrupted, complete their operations and return as quick as possible. Builds' data may be partially deleted, but history entry and test info still exists.- Since:
- 2022.1
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
cleanupBuildsData(BuildCleanupContext cleanupContext)
Invoked afterprepareBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
is called for all extensions.default int
getCleanupBuildsDataConcurrencyLevel()
This method is called beforecleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
to calculate the number of threads that will be used for processing build package.default String
getDisplayName()
Returns the extension name to display in the UI.default void
prepareBuildsData(BuildCleanupContext cleanupContext)
Invoked for all cleanup extensions beforecleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
.
-
-
-
Method Detail
-
prepareBuildsData
default void prepareBuildsData(@NotNull BuildCleanupContext cleanupContext) throws CleanupInterruptedException, Exception
Invoked for all cleanup extensions beforecleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
. All builds' data that can be cleaned by other extension incleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
(e.g. build artifacts), should be processed by this method and stored in thecleanupContext
usingBuildCleanupContext.setExtensionData(String, Object)
method so that it can later be acces bycleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
usingBuildCleanupContext.getExtensionData(String)
. The method itself should not clean any data.- Parameters:
cleanupContext
- cleanup context- Throws:
CleanupInterruptedException
- if the cleanup process was interruptedException
- on any other error
-
cleanupBuildsData
default void cleanupBuildsData(@NotNull BuildCleanupContext cleanupContext) throws CleanupInterruptedException, Exception
Invoked afterprepareBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
is called for all extensions. There is no guarantee about ordering of the method execution for different extensions, they may be called simultaneously etc. It should perform db operations in current thread otherwise deadlock can occur.- Parameters:
cleanupContext
- cleanup context- Throws:
CleanupInterruptedException
- if the cleanup process was interruptedException
- on any other error
-
getCleanupBuildsDataConcurrencyLevel
default int getCleanupBuildsDataConcurrencyLevel()
This method is called beforecleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
to calculate the number of threads that will be used for processing build package. Once the number is calculated, build package will be evenly splitted among these threads andcleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
will be called for each of them.- Returns:
- Maximum bumber of threads that will be invoking
cleanupBuildsData(jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext)
method for build package. - Since:
- 2023.11
-
getDisplayName
@NotNull default String getDisplayName()
Returns the extension name to display in the UI.
-
-