Interface StartBuildPrecondition

  • All Superinterfaces:
    ServerExtension, TeamCityExtension

    public interface StartBuildPrecondition
    extends ServerExtension
    Extension point for the TeamCity build distributor. Build distributor distributes builds among agents according to compatibility settings, agent availability, and so on. With help of this extension point one can add precondition for a build to start.

    Note that build distributor can be called by the estimator to emulate builds starting process and to calculate estimates based on the distribution result. This is called build distribution emulation mode. In emulation mode build distributor operates on copies of objects. These objects may not necessary contain actual information.

    From the other hand build distributor is also called when real builds are assigned to real agents. This is done periodically when server flushes build queue.

    Because of such design this extension point should work with limited interfaces provided to build distributor. It is possible to obtain corresponding real objects from the server model (SBuildType, SQueuedBuild and so on), but this should be done carefully because it may affect estimator precision.

    Since:
    4.5
    See Also:
    StartingBuildAgentsFilter
    • Method Detail

      • canStart

        @Nullable
        WaitReason canStart​(@NotNull
                            QueuedBuildInfo queuedBuild,
                            @NotNull
                            java.util.Map<QueuedBuildInfo,​BuildAgent> canBeStarted,
                            @NotNull
                            BuildDistributorInput buildDistributorInput,
                            boolean emulationMode)
        Returns WaitReason if build cannot be started or null if TeamCity can start build.
        Parameters:
        queuedBuild - snapshot of a queued build
        canBeStarted - contains map of builds already distributed among agents. Values can be null to indicate virtual agents.
        buildDistributorInput - input data for the build distributor
        emulationMode - true if extension is called from the build estimator
        Returns:
        see above