Interface BuildTypeEx

    • Method Detail

      • getSourceBuildType

        @NotNull
        SBuildType getSourceBuildType()
        If current instance is an instance of RemoteBuildType - returns base configuration for remote build type, otherwise - returns this.
        Specified by:
        getSourceBuildType in interface LVcsRootInstanceHolderEx
        Returns:
        see below.
        Since:
        6.0
      • getBuildSettings

        @NotNull
        BuildSettings getBuildSettings()
        Returns build settings: settings for build (where excluded disabled options and features).
        Returns:
        build settings.
        Since:
        7.0
      • newRunningBuild

        @NotNull
        RunningBuildEx newRunningBuild​(@NotNull
                                       QueuedBuildEx queuedBuild,
                                       @Nullable
                                       SBuildAgent buildAgent,
                                       @NotNull
                                       Date removeFromQueueTime)
        Creates new SRunningBuild instance.
        Parameters:
        queuedBuild - source queued build
        buildAgent - agent the build will be running on or null if build is agent less
        removeFromQueueTime - time when build was removed from the queue
        Returns:
        the new running build
      • newAgentLessBuild

        @NotNull
        RunningBuildEx newAgentLessBuild​(@NotNull
                                         QueuedBuildEx queuedBuild,
                                         @Nullable
                                         SBuildAgent buildAgent,
                                         @NotNull
                                         Date removeFromQueueTime)
        Creates new SRunningBuild instance and sets executor name as a build promotion attribute for the purposes of Executor mode builds.
        Parameters:
        queuedBuild - source queued build
        buildAgent - agent the build will be running on or null if build is agent less
        removeFromQueueTime - time when build was removed from the queue
        Returns:
        the new running build
      • attachedToModel

        void attachedToModel​(@NotNull
                             ProjectDataModel projectDataModel)
      • createBuildPromotion

        @NotNull
        BuildPromotionEx createBuildPromotion()
        Creates new build promotion which then can be used when build is added to a queue. Build promotion holds necessary information to reproduce a build. If build configuration has source dependencies on other build configurations, the whole graph is constructed and the top node of this graph (corresponding to this build configuration) is returned.
        Returns:
        newly created build promotion.
      • createBuildPromotion

        @NotNull
        BuildPromotionEx createBuildPromotion​(@NotNull
                                              String branchName)
        Creates build promotion graph and sets specified branch name to all its nodes.
        Parameters:
        branchName - name of the branch
        Returns:
        newly created build promotion.
        Since:
        7.1
      • createBuildPromotion

        BuildPromotionEx createBuildPromotion​(@Nullable
                                              String branchName,
                                              @Nullable
                                              BuildPromotionInitializer initializer,
                                              @Nullable
                                              DependenciesSupplier dependenciesSupplier)
        Same as createBuildPromotion(String) but accepts initializer and dependencies supplier. Initializer is called for every new build promotion in the created build chain, while dependencies supplier is used to fetch dependencies of the current node while the build chain is constructed.
        Parameters:
        branchName -
        initializer -
        dependenciesSupplier -
        Returns:
      • createBuildCustomizer

        @NotNull
        BuildCustomizer createBuildCustomizer​(@Nullable
                                              SUser user)
        Creates BuildCustomizer that can be used to create custom promotions for this build type
        Since:
        2021.1
      • createPersonalBuildType

        @NotNull
        RemoteBuildTypeEx createPersonalBuildType​(@NotNull
                                                  User user,
                                                  @Nullable
                                                  String comment)
        Creates personal build type, i.e. build type which is used to start personal builds.
        Parameters:
        user - personal build type owner
        comment - personal comment
        Returns:
        new personal build type
      • createPersonalBuildType

        @NotNull
        RemoteBuildTypeEx createPersonalBuildType​(@NotNull
                                                  User user,
                                                  long changeListId)
        Creates personal build type, i.e. build type which is used to start personal builds.
        Parameters:
        user - personal build type owner
        changeListId - id of the personal change list (must be published separately)
        Returns:
        new personal build type
      • createPersonalBuildType

        @NotNull
        RemoteBuildTypeEx createPersonalBuildType​(@NotNull
                                                  User user,
                                                  @Nullable
                                                  String comment,
                                                  @NotNull
                                                  Map<VcsRootInstance,​VcsRootInstance> overridenRoots)
        Create personal build type that starts build with overriden roots. If there are snapshot dependencies, personal builds will be created for those nodes where overridden roots are applicable.
        Parameters:
        user - personal build type owner
        comment - personal comment
        overridenRoots - overriden roots map (original root -> substitution root)
        Returns:
        new personal build type
      • addToQueue

        @Nullable
        SQueuedBuild addToQueue​(@NotNull
                                BuildPromotionEx buildPromotion,
                                @NotNull
                                String triggeredBy)
        Adds build to queue with specified build promotion. Build promotion contains various settings necessary to run a build, like build parameters, build revisions and so on.
        Parameters:
        buildPromotion - build promotion
        triggeredBy - who added build to queue
        Returns:
        new queued build instance if there is no instances of this configuration in the queue, or previously added instance otherwise.
      • addToQueue

        @Nullable
        SQueuedBuild addToQueue​(@NotNull
                                SAgentRestrictor agentRestrictor,
                                @NotNull
                                BuildPromotionEx buildPromotion,
                                @NotNull
                                String triggeredBy)
        Adds build to queue on the specified agent with manually set build parameters: these build parameters will redefined build parameters specified within this build configuration
        Parameters:
        agent - specified agent
        buildPromotion - build promotion
        triggeredBy - who added build to queue
        Returns:
        new queued build instance if there is no instances of this configuration in the queue, or previously added instance otherwise.
      • dispose

        void dispose()
        Must be called when this build configuration object is removed from the model.
      • unregister

        void unregister()
        Must be called when this build configuration was removed from the project completely (calls dispose too).
        Specified by:
        unregister in interface BuildTypeIdentityEx
      • getLastConfigModificationAction

        @Nullable
        AuditLogAction getLastConfigModificationAction()
      • getCanRunAndCompatibleAgentTypes

        @NotNull
        List<StartableAgentType> getCanRunAndCompatibleAgentTypes()
        Returns list of cloud agent types which are both allowed to run this configuration and are compatible with it.
        Returns:
        list of cloud agent types which are both allowed to run this configuration and are compatible with it.
      • getDependencyGraph

        @NotNull
        BuildTypeDependencyGraph getDependencyGraph()
        Returns:
        graph of snapshot dependencies assuming this build configuration is a top one.
      • findTops

        @NotNull
        Collection<BuildTypeEx> findTops()
        Returns:
        all topmost build configurations having direct or transitive snapshot dependency on this build configuration. If there are no such build configurations returns itself.
      • processHistoryEntries

        void processHistoryEntries​(@NotNull
                                   ItemProcessor<SFinishedBuild> itemProcessor)
        Invokes the given ItemProcessor for all history records of this build type. Entries are pushed into the processor in changes order.
        Parameters:
        itemProcessor - processor for history entries
      • getRawDependedOnMe

        @NotNull
        Map<String,​DependencyOptions> getRawDependedOnMe()
        Map from internal build type id to dependency options
        Returns:
      • getTransitiveDependedOnMe

        @NotNull
        List<SBuildType> getTransitiveDependedOnMe()
        Returns all build configurations collected up the dependency chain. Note that returned dependencies are sorted by the distance from this build type. The returned list is filtered by current user permissions and may contain not all references.
      • traverseSelfAndDependencies

        void traverseSelfAndDependencies​(@NotNull
                                         DependencyConsumer<BuildTypeEx> consumer)
        Parameters:
        consumer -
        Since:
        2018.2.2
      • traverseSelfAndDependedOnMe

        void traverseSelfAndDependedOnMe​(@NotNull
                                         DependencyConsumer<BuildTypeEx> consumer)
        Parameters:
        consumer -
        Since:
        2018.2.2
      • getBranches

        @NotNull
        List<BranchEx> getBranches​(@NotNull
                                   BranchesPolicy policy,
                                   @Nullable
                                   Boolean includeBranchesFromDependencies,
                                   boolean computeTimestamps)
      • isValidVcsBranch

        boolean isValidVcsBranch​(@NotNull
                                 String name,
                                 boolean includeBranchesFromDependencies)
      • getOwnVcsBranchNames

        @NotNull
        Collection<String> getOwnVcsBranchNames​(boolean activeOnly)
      • hasOwnBranches

        boolean hasOwnBranches()
      • getActiveBranches

        @NotNull
        List<BranchEx> getActiveBranches()
      • getBranchSpec

        @NotNull
        BranchSpec getBranchSpec​(@NotNull
                                 SVcsRoot root)
        Returns branch specification for specified parent root
        Parameters:
        root - root of interest
        Returns:
        see above
        Since:
        2017.1
      • getLastUsedBranchSpec

        @NotNull
        BranchSpec getLastUsedBranchSpec​(@NotNull
                                         SVcsRoot parentRoot)
        Returns branch specification used for changes collecting in given VCS root. If changes are not collected yet returns current value of branch specification.
        Parameters:
        parentRoot - root of interest
        Returns:
        see above
      • getLatestBuilds

        @NotNull
        List<SBuild> getLatestBuilds()
        Returns:
        latest builds (currently running and last finished)
      • isBranchSpecDefined

        boolean isBranchSpecDefined​(boolean processDependencies)
        Parameters:
        processDependencies - whether to process snapshot dependencies or not
        Returns:
        true if at least one vcs root in build configuration or its dependencies has VCS root with non empty branch spec
      • isBranchSpecDefined

        boolean isBranchSpecDefined​(boolean processDependencies,
                                    boolean processSettingsRoot)
      • getBuildTriggerDescriptors

        @NotNull
        Collection<BuildTriggerDescriptor> getBuildTriggerDescriptors​(@NotNull
                                                                      String triggerName,
                                                                      boolean enabledOnly)
        Parameters:
        enabledOnly - whether to return only enabled triggers or all
        triggerName - name of the trigger
        Returns:
        build triggers of specified type
      • getResolvedBuildTriggerDescriptors

        @NotNull
        Collection<BuildTriggerDescriptor> getResolvedBuildTriggerDescriptors​(boolean enabledOnly)
        Parameters:
        enabledOnly - whether to return only enabled triggers or all
        Returns:
        build triggers with resolved settings.
      • getResolvedBuildTriggerDescriptors

        @NotNull
        Collection<BuildTriggerDescriptor> getResolvedBuildTriggerDescriptors​(@NotNull
                                                                              String triggerName,
                                                                              boolean enabledOnly)
        Parameters:
        enabledOnly - whether to return only enabled triggers or all
        triggerName - name of the trigger
        Returns:
        build triggers of specified type with fully resolved settings.
      • getPendingChangesInAllBranches

        @NotNull
        List<ChangeDescriptor> getPendingChangesInAllBranches​(@Nullable
                                                              Boolean includeDependencyChanges)
        Returns pending changes detected in all branches of this build configuration.
        Returns:
        list of pending changes.
      • addRunParameter

        void addRunParameter​(@NotNull
                             Parameter parameter)
        For tests only!
        Parameters:
        parameter -
      • getLogicalBranchNames

        @Nullable
        Set<String> getLogicalBranchNames​(@NotNull
                                          VcsRootInstance root,
                                          @NotNull
                                          String vcsBranch)
        Returns set of possible logical names for the given VCS branch in the given VCS root according to current VCS root settings (i.e. default branch, branch spec)
        Parameters:
        root - root of interest
        vcsBranch - vcs branch of interest
        Returns:
        see above or null if branch spec is not specified for this vcs root instance
      • getDefaultBranchDisplayName

        @NotNull
        String getDefaultBranchDisplayName()
        Returns a display name of the default branch according to the current settings of all VCS roots attached to build configuration (their default branch vcs names and branch specs). Returned value might be different from Branch.DEFAULT_BRANCH_NAME when logical name of the default branch in all the roots is the same.
        Returns:
        see above
      • getBranchByDisplayName

        @NotNull
        BranchEx getBranchByDisplayName​(@NotNull
                                        String branchDisplayName)
        Returns a branch by its display name.

        Usually branch display equals to branch name. The only exception is default branch (see comments to getDefaultBranchDisplayName(). This method allows you to get a default branch by its custom display name. Use getBranch(String) method if you are sure you use a branch name (not a display name) or branch is not a default one, because this method is slower than getBranch(String).

        Parameters:
        branchDisplayName - branch display name
        Returns:
        see above
      • hasBuilds

        boolean hasBuilds()
        Returns:
        true if this build configuration has builds
      • getTags

        @NotNull
        List<String> getTags​(@NotNull
                             SUser user)
        List of all private tags set for builds of this configuration by the specified user.
        Returns:
        union of tags for each build for the configuration.
        Since:
        9.0
      • getDummyBuild

        @NotNull
        DummyBuild getDummyBuild()
      • getDummyBuildPromotion

        @Nullable
        DummyBuildPromotion getDummyBuildPromotion​(boolean createIfNotExists)
      • resetPendingChanges

        void resetPendingChanges()
      • getArtifactDirectories

        @NotNull
        List<File> getArtifactDirectories()
        Returns:
        list of directories where artifacts of builds of this build type are stored. List always has at least one element. The first directory in the list is a directory where new builds store their artifacts.
        Since:
        9.1
      • inline

        @NotNull
        BuildTypeEx inline()
        Creates a temporary copy of this buildType with all settings inherited from a project or a template inlined.
        Since:
        9.1
      • getVcsRootInstanceEntries

        @NotNull
        List<VcsRootInstanceEntry> getVcsRootInstanceEntries​(boolean includeSettingsRoot)
        Returns entries for VCS roots attached to this buildType. If buildType has an implicit settings root (not attached to buildType) and includeSettingsRoot is true, then an entry for this settings root is included in the result.
        Parameters:
        includeSettingsRoot - whether settings root should be included in result
        Returns:
        see above
        Since:
        9.1
      • isImplicitSettingsRoot

        boolean isImplicitSettingsRoot​(@NotNull
                                       VcsRootInstance root)
        Returns true if the specified VCS root is an implicit settings root, ie. this buildType's project stores settings in this root and root is not attached to this buildType
        Parameters:
        root - root of interest
        Returns:
        see above
      • createEditableCopy

        @NotNull
        BuildTypeEx createEditableCopy​(boolean fillSettings)
      • getTypedOption

        @NotNull
        default <T> TypedValue<T> getTypedOption​(@NotNull
                                                 Option<T> option)

        Get option extended value. See TypedValue. When the option is not defined

        Specified by:
        getTypedOption in interface BuildTypeSettings
        Type Parameters:
        T -
        Parameters:
        option -
        Returns:
        Since:
        10.0
      • getDeclaredOption

        @Nullable
        default <T> T getDeclaredOption​(@NotNull
                                        Option<T> option)

        Get option value declared in this BuildTypeSettings

        Specified by:
        getDeclaredOption in interface OptionSupport
        Parameters:
        option - option to retrieve value for
        Returns:
        value of the option. If value wasn't set, null is returned
        Since:
        10.0
      • replaceVcsRoot

        boolean replaceVcsRoot​(@NotNull
                               SVcsRoot oldVcsRoot,
                               @NotNull
                               SVcsRoot newVcsRoot)
        Replaces existing VCS root entry in settings with a new one, maintaining the order of the root entries
        Parameters:
        oldVcsRoot - VCS root to be replaced
        newVcsRoot - VCS root to insert instead
        Returns:
        true if VCS root was actually replaced, false otherwise (the root to be replaced did not exist or the new root already existed)
        Since:
        10.0
      • setVcsRoots

        boolean setVcsRoots​(@NotNull
                            Collection<SVcsRoot> vcsRoots)
        Sets VCS roots. All existing VCS roots that are not present in vcsRoots are deleted, all other existing VCS roots are reordered if necessary, but retain their original checkout rules.
        Parameters:
        vcsRoots -
        Returns:
        true if any changes occurred
        Since:
        10.0
      • setEditable

        void setEditable​(boolean editable)
        Enables or disables editing of the build type in web UI, see also SPersistentEntity.isReadOnly(). SBuildType.persist() method must be called afterwards.
        Parameters:
        editable - true to enable editing and false to disable
      • isDefaultBranchExcluded

        boolean isDefaultBranchExcluded()
        Returns true default branch is excluded in the build configuration branch filter
        Returns:
        see above
        Since:
        2017.1
      • getExcludedDefaultRootInstanceIds

        @NotNull
        Set<Long> getExcludedDefaultRootInstanceIds()
        Returns set of vcs root instance ids with excluded default branch
        Returns:
        see above
        Since:
        2017.1
      • getRunBuildActionName

        String getRunBuildActionName()
        Returns:
        name of the Run build action in this configuration, this could be Run, Deploy, Upload, etc. The primary usage of this name is web interface.
        Since:
        2017.1
      • isAgentLessBuildType

        boolean isAgentLessBuildType()
        Returns:
        true if this build type is agent less
      • isEmptyUuid

        boolean isEmptyUuid()
        Returns:
        true if this buildType has an empty uuid in its config on disk
      • reassignIntId

        void reassignIntId​(@NotNull
                           String internalId)
        Assigns the specified internalId to this buildType. The internalId should come from an entityId present in DB and marked as removed, otherwise an IllegalArgumentException is thrown.
      • containsOwnVcsRoot

        boolean containsOwnVcsRoot​(long vcsRootId)
        Description copied from interface: BuildTypeSettings
        Returns true if VCS root with specified id is attached directly and is not inherited via a template
        Specified by:
        containsOwnVcsRoot in interface BuildTypeSettings
        Parameters:
        vcsRootId - vcs root id
        Returns:
        true if the specified VCS root is attached to the build configuration directly and is not inherited
        Since:
        2019.2
      • updateRevisionsForOwnBranches

        void updateRevisionsForOwnBranches​(@NotNull
                                           Collection<String> logicalBranchNames)
        Make sure that revisions for specified logical branches are calculated and saved in dummy build promotions. These revisions are used to compute pending changes, so if some code is going to compute pending changes for a big amount of branches it makes sense to call this method first.
        Parameters:
        logicalBranchNames -
      • setSettings

        void setSettings​(@NotNull
                         BuildTypeSettingsEx settings)
        Complete replacement of settings
        Parameters:
        settings - new settings
        Since:
        2021.2
      • getRelatedVcsRootInstanceIds

        @NotNull
        Set<Long> getRelatedVcsRootInstanceIds()
        Returns ids of VCS root instances which reported changes associated with this build configuration.
        Returns:
        Since:
        2024.12