Interface BuildTypeSettings

    • Method Detail

      • getProject

        @NotNull
        SProject getProject()
        Returns the project this build type entity belongs to.
        Returns:
        the project this build type entity belongs to.
      • getRunnerTypes

        @NotNull
        java.util.Collection<java.lang.String> getRunnerTypes()
        Returns types of the runners attached to these settings
        Returns:
        see above
        Since:
        6.0
      • getRunTypeRequirements

        @NotNull
        java.util.List<Requirement> getRunTypeRequirements()
        Returns list of additional agent requirements imposed by configured runners.
        Returns:
        see above
      • getBuildFeatureRequirements

        @NotNull
        java.util.List<Requirement> getBuildFeatureRequirements()
        Returns list of additional agent requirements imposed by configured enabled build features.
        Returns:
        see above
        Since:
        2019.1
      • addBuildRunner

        @NotNull
        SBuildRunnerDescriptor addBuildRunner​(@NotNull
                                              java.lang.String name,
                                              @NotNull
                                              java.lang.String runnerType,
                                              @NotNull
                                              java.util.Map<java.lang.String,​java.lang.String> parameters)
        Creates new build runner and adds it to these settings.
        Parameters:
        name - runner name
        runnerType - type of the runner
        parameters - runner parameters
        Returns:
        newly created runner
        Since:
        6.5
      • removeBuildRunner

        @Nullable
        SBuildRunnerDescriptor removeBuildRunner​(@NotNull
                                                 java.lang.String runnerId)
        Removes runner descriptor with specified id.
        Parameters:
        runnerId - descriptor id
        Returns:
        removed runner descriptor
        Since:
        6.0
      • updateBuildRunner

        boolean updateBuildRunner​(@NotNull
                                  java.lang.String runnerId,
                                  @NotNull
                                  java.lang.String newName,
                                  @NotNull
                                  java.lang.String newType,
                                  @NotNull
                                  java.util.Map<java.lang.String,​java.lang.String> newParams)
        Updates parameters in the existing build runner descriptor. Does nothing if there runner with specified id was not found.
        Parameters:
        runnerId - id of runner descriptor
        newName - new runner name
        newType - new type of the runner
        newParams - new runner parameters
        Returns:
        true if parameters updated and false otherwise
        Since:
        6.5
      • getBuildRunners

        @NotNull
        java.util.List<SBuildRunnerDescriptor> getBuildRunners()
        Returns collection of build runners attached to these settings
        Returns:
        see above
        Since:
        6.0
      • removeAllBuildRunners

        void removeAllBuildRunners()
        Removes all build runners from these settings
        Since:
        6.0
      • getRunnersOrder

        @Nullable
        java.lang.String[] getRunnersOrder()
        Returns:
        runner ids in their custom order (if such order is set), null otherwise
      • applyRunnersOrder

        void applyRunnersOrder​(@NotNull
                               java.lang.String[] ids)
        Accepts array of runner identifiers and reorders them according to this array.
        Parameters:
        ids - runner identifiers
        Since:
        6.0
      • resetRunnersOrder

        void resetRunnersOrder()
        Resets custom runner order to default.
      • findBuildRunnerByType

        @Nullable
        SBuildRunnerDescriptor findBuildRunnerByType​(@NotNull
                                                     java.lang.String runnerType)
        Finds build runner by its' type. If there is more than one build runner, returns the first one.
        Parameters:
        runnerType - type of the runner
        Returns:
        build runner or null if runner was not found
        Since:
        6.0
      • findBuildRunnerById

        @Nullable
        SBuildRunnerDescriptor findBuildRunnerById​(@NotNull
                                                   java.lang.String runnerId)
        Finds build runner by its' id
        Parameters:
        runnerId - id of the runner
        Returns:
        build runner or null if runner with such id not found
        Since:
        6.0
      • findRunnerParameter

        @Nullable
        java.lang.String findRunnerParameter​(@NotNull
                                             java.lang.String paramName)
        Searches runner parameter in all build runners and returns value of the first found parameter with given name.
        Parameters:
        paramName - name of the parameter
        Returns:
        the first found parameter value or null
        Since:
        6.0
      • getBuildParameters

        @NotNull
        java.util.Map<java.lang.String,​java.lang.String> getBuildParameters()
        Return map of build parameters specified by user. Each build parameter has name and value. Name of each parameter starts from a prefix: env. or system. Value may by either simple string, or may contain references to other parameters in form %env.HOME% or %system.os.name% or %system.agent.name%
        Returns:
        see above
      • getBuildParametersCollection

        @NotNull
        java.util.Collection<Parameter> getBuildParametersCollection()
        Returns build parameters collection.
        Returns:
        see above
      • addBuildParameter

        void addBuildParameter​(Parameter parameter)
        Adds build parameter to the configuration. Build parameter is a system or environment variable. Concrete parameter type is being selected by its name prefix. Constants.SYSTEM_PREFIX for system properties and Constants.ENV_PREFIX for environment variable.
        Parameters:
        parameter - specified parameter.
      • removeBuildParameter

        void removeBuildParameter​(java.lang.String paramName)
        Removes existing build parameter by its name.
        Parameters:
        paramName - specified parameter name.
      • getBuildParameter

        java.lang.String getBuildParameter​(java.lang.String key)
        Returns build parameter by parameter key
        Parameters:
        key - parameter key
        Returns:
        build parameter by parameter key
      • getVcsRoots

        @NotNull
        java.util.List<SVcsRoot> getVcsRoots()
        Returns all roots currently attached to this configuration
        Returns:
        collection of all attached vcs roots.
      • addBuildTrigger

        boolean addBuildTrigger​(@NotNull
                                BuildTriggerDescriptor triggerDescriptor)
        Adds new trigger to build configuration settings. Use BuildTriggerDescriptorFactory to create trigger descriptor.
        Parameters:
        triggerDescriptor - trigger descriptor
        Returns:
        true if trigger was added, and false if trigger with such id already exists
        Since:
        5.1
      • addBuildTrigger

        @NotNull
        BuildTriggerDescriptor addBuildTrigger​(@NotNull
                                               java.lang.String type,
                                               @NotNull
                                               java.util.Map<java.lang.String,​java.lang.String> params)
        Adds new trigger of specified type and with specified parameters to build configuration settings.
        Parameters:
        type - type of the trigger
        params - parameters map
        Returns:
        newly created trigger descriptor
        Since:
        7.0
      • removeBuildTrigger

        boolean removeBuildTrigger​(@NotNull
                                   BuildTriggerDescriptor triggerDescriptor)
        Removes specified build trigger from the settings
        Parameters:
        triggerDescriptor - trigger descriptor
        Returns:
        true if trigger was actually removed and false otherwise
        Since:
        5.1
      • updateBuildTrigger

        boolean updateBuildTrigger​(@NotNull
                                   java.lang.String triggerId,
                                   @NotNull
                                   java.lang.String newType,
                                   @NotNull
                                   java.util.Map<java.lang.String,​java.lang.String> newParams)
        Updates build trigger descriptor with specified id, changes type and parameters.
        Parameters:
        triggerId - id of build trigger descriptor
        newType - type of build trigger descriptor
        newParams - parameters map
        Returns:
        true if parameters of build trigger descriptor were changed (descriptor with such id exists) and false otherwise
        Since:
        7.0
      • getBuildTriggersCollection

        @NotNull
        java.util.Collection<BuildTriggerDescriptor> getBuildTriggersCollection()
        Returns collection of build trigger settings
        Returns:
        see above
        Since:
        5.1
      • findTriggerById

        @Nullable
        BuildTriggerDescriptor findTriggerById​(@NotNull
                                               java.lang.String triggerId)
        Finds build trigger descriptor by its' id
        Parameters:
        triggerId - id of the trigger
        Returns:
        build trigger descriptor or null if trigger with such id not found
        Since:
        6.0
      • setCheckoutDirectory

        void setCheckoutDirectory​(@Nullable
                                  java.lang.String dir)
        Sets build checkout directory. Set it to null to use default checkout directory.
        Parameters:
        dir - checkout directory
      • getCheckoutDirectory

        @Nullable
        java.lang.String getCheckoutDirectory()

        Returns build checkout directory - if specified explicitly using setCheckoutDirectory(String). Returns null if default checkout directory, generated by TeamCity should be used.

        Returns:
        build checkout directory.
        See Also:
        setCheckoutDirectory(String)
      • setArtifactPaths

        void setArtifactPaths​(@Nullable
                              java.lang.String artifactPaths)
        Sets build artifact paths. Artifact paths are comma separated paths to build artifacts. Support ant-style wildcards and target directories like *.zip => winFiles,unix/dist.tgz => linuxFiles, where winFiles and linuxFiles are target directories. Set to null or empty string to disable artifacts processing.
        Parameters:
        artifactPaths - paths to build artifacts
        Since:
        8.1 same as #setOption(BuildTypeOptions#BT_ARTIFACT_RULES, rules)}
      • getArtifactPaths

        @Nullable
        java.lang.String getArtifactPaths()
        Returns build artifact paths.
        Returns:
        build artifact paths
        Since:
        8.1 same as #getOption(BuildTypeOptions#BT_ARTIFACT_RULES)}
      • getArtifactDependencies

        @NotNull
        java.util.List<SArtifactDependency> getArtifactDependencies()
        Returns artifacts this build configuration depending on.
        Returns:
        list of artifacts this build configuration depending on
      • setArtifactDependencies

        void setArtifactDependencies​(@NotNull
                                     java.util.List<SArtifactDependency> artifacts)
        Sets artifacts this build configuration depending on.
        Parameters:
        artifacts - new artifacts dependency list.
      • addArtifactDependency

        void addArtifactDependency​(@NotNull
                                   SArtifactDependency dependency)
        Adds artifact dependency.
        Parameters:
        dependency - new artifact dependency
        Since:
        10.0
      • removeArtifactDependency

        void removeArtifactDependency​(@NotNull
                                      SArtifactDependency dependency)
        Removes artifact dependency.
        Parameters:
        dependency - artifact dependency
        Since:
        10.0
      • containsVcsRoot

        boolean containsVcsRoot​(long vcsRootId)
        Returns true if VCS root with specified id is attached directly or is inherited via a template
        Parameters:
        vcsRootId - id of VCS root
        Returns:
        see above
      • containsOwnVcsRoot

        boolean containsOwnVcsRoot​(long vcsRootId)
        Returns true if VCS root with specified id is attached directly and is not inherited via a template
        Parameters:
        vcsRootId - id of VCS root
        Returns:
        see above
        Since:
        2019.2
      • getVcsRootEntries

        @NotNull
        java.util.List<VcsRootEntry> getVcsRootEntries()
        Returns all entries of vcs roots. Each entry contains reference to root and its checkout rules.
        Returns:
        all entries of vcs roots for this configuration
      • removeVcsRoot

        boolean removeVcsRoot​(@NotNull
                              SVcsRoot root)
        Removes existing VCS root from the build configuration. If there were checkout rules attached to this VCS root they will be removed too.
        Parameters:
        root - VCS root to remove
        Returns:
        true if VCS root was actually removed from the build configuration and false if build configuration did not have this vcs root attached
      • setCheckoutRules

        boolean setCheckoutRules​(@NotNull
                                 VcsRoot root,
                                 @NotNull
                                 CheckoutRules checkoutRules)
        Sets checkout rules for specified VCS root. VCS root must be attached to this build configuration.
        Parameters:
        root - root to set rules for
        checkoutRules - checkout rules for the VCS root
        Returns:
        true if checkout rules were set for the VCS root (if VCS root is attached) and false otherwise
      • getCheckoutRules

        CheckoutRules getCheckoutRules​(@NotNull
                                       VcsRoot root)
        Returns checkout rules configured for the specified VCS root. If there are no checkout rules or specified VCS root is not attached to this build configuration, null is returned.
        Parameters:
        root - VCS root
        Returns:
        checkout rules or null
      • addConfigParameter

        void addConfigParameter​(@NotNull
                                Parameter param)
        Adds configuration parameter. There are three different types of parameters which can be added to build configuration settings:
        • build parameters - these are parameters passed to agent and then to a build (see addBuildParameter(Parameter)), these parameters must have prefix system. or env.
        • runner parameters - these are parameters of a runner, they are transferred to agent and passed to corresponding build runner plugin
        • configuration parameters - these parameters are not transferred to agent or build, but can be referenced in various places (including build & runner parameters and thus can effectively pass to a build)
        Parameters:
        param - configuration parameter
      • removeConfigParameter

        void removeConfigParameter​(@NotNull
                                   java.lang.String paramName)
        Removes configuration parameters with specified name
        Parameters:
        paramName - parameter name
      • getConfigParametersCollection

        @NotNull
        java.util.Collection<Parameter> getConfigParametersCollection()
        Returns collection of configuration parameters.
        Returns:
        see above
      • getConfigParameters

        @NotNull
        java.util.Map<java.lang.String,​java.lang.String> getConfigParameters()
        Returns map of configuration parameters
        Returns:
        see above
      • getUndefinedParameters

        @NotNull
        java.util.List<java.lang.String> getUndefinedParameters()
        Returns collection of parameter names (config and build params) referenced in the build configuration settings but without values provided. I.e. there is a reference to a parameter but such parameter is not defined anywhere.
        Parameter value can come from different sources:
        • build configuration or template settings
        • agents
        • various extensions
        Returns:
        see above
        Since:
        6.0
      • isTemplateBased

        boolean isTemplateBased()
        Returns true if these settings are directly based on a template. It does not take into account a default template.
        Returns:
        see above
      • getTemplates

        @NotNull
        java.util.List<? extends BuildTypeTemplate> getTemplates()
        Returns templates these settings are based on, including the default template.
        Returns:
        see above
        Since:
        2017.2
      • getTemplate

        @Deprecated
        @Nullable
        BuildTypeTemplate getTemplate()
        Deprecated.
        since 2017.2, use getTemplates() instead
        Returns the first template these settings are based on.
        Returns:
        see above
      • isTemplateAccessible

        boolean isTemplateAccessible()
        Checks accessibility of all attached templates, excluding the default template (if present)
        Returns:
        true if there are such templates and all of them are accessible to currently logged in user, false otherwise
        Since:
        8.1.3
      • getTemplateIds

        @NotNull
        java.util.List<java.lang.String> getTemplateIds()
        Returns internal ids of the templates this settings are based on, including one of the default template
        Returns:
        see above
        Since:
        2017.2
      • getTemplateId

        @Nullable
        @Deprecated
        java.lang.String getTemplateId()
        Deprecated.
        since 2017.2, use getTemplateIds() instead
        Returns internal id of the first template this setting is based on
        Returns:
        see above
      • getRequirements

        @NotNull
        java.util.List<Requirement> getRequirements()
        Get list of explicit requirements for build agents which can run this build configuration. Explicit requirements are specified by user in Web UI explicitly.
        Returns:
        see above
      • getImplicitRequirements

        @NotNull
        java.util.List<Requirement> getImplicitRequirements()
        Get list of non-satisfied implicit requirements for build agents. Implicit requirements appear when some build configuration property, or run parameter contains a reference to another parameter in form %<param name>%.
        Returns:
        see above
      • addRequirement

        void addRequirement​(@NotNull
                            Requirement requirement)
        Adds new build requirement to the configuration. If the requirement has no id, then a copy of it with new id is generated and added to the settings.
        Parameters:
        requirement - new requirement.
      • removeRequirement

        void removeRequirement​(java.lang.String parameterName)
        Removes first requirement with the specified property name from the configuration.
        Parameters:
        parameterName - name of the requirement parameter.
      • removeRequirement

        void removeRequirement​(Requirement requirement)
        Removes a requirement from the configuration.
        Parameters:
        requirement - requirement to be removed
        Since:
        10.0
      • getBuildNumberPattern

        @NotNull
        java.lang.String getBuildNumberPattern()
        Returns current build number pattern
        Returns:
        see above
        Since:
        5.0
      • setBuildNumberPattern

        void setBuildNumberPattern​(@NotNull
                                   java.lang.String pattern)
        Sets build number pattern. %build.counter% in the pattern will be replaced with current build number value when build starts
        Parameters:
        pattern - pattern to set
        Since:
        5.0
      • replaceInValues

        boolean replaceInValues​(@NotNull
                                java.lang.String regexp,
                                @NotNull
                                java.lang.String replacement)
                         throws java.util.regex.PatternSyntaxException
        Replaces values according to specified regexp and replacement string in all text parameters of the build configuration
        Parameters:
        regexp - regexp
        replacement - replacement
        Returns:
        true if at least one text value was affected and false otherwise
        Throws:
        java.util.regex.PatternSyntaxException - if pattern is incorrect
        Since:
        5.1
      • replaceInValues

        boolean replaceInValues​(@NotNull
                                java.util.regex.Pattern regexpPattern,
                                @NotNull
                                java.lang.String replacement)
        Replaces values according to specified pattern and replacement string in all text parameters of the build configuration
        Parameters:
        regexpPattern - regexp pattern
        replacement - replacement
        Returns:
        true if at least one text value was affected and false otherwise
        Since:
        8.0.7
      • textValueMatches

        boolean textValueMatches​(@NotNull
                                 java.util.regex.Pattern regexpPattern)
        Returns true if configuration has value in text parameters which matches specified pattern. Only own parameters are checked - without inherited
        Parameters:
        regexpPattern - regexp pattern
        Returns:
        true if such value exists and false otherwise
        Since:
        8.0.7
      • addBuildFeature

        @NotNull
        SBuildFeatureDescriptor addBuildFeature​(@NotNull
                                                java.lang.String type,
                                                @NotNull
                                                java.util.Map<java.lang.String,​java.lang.String> params)
        Adds build feature with specified type and parameters to this settings object.
        Parameters:
        type - build feature type
        params - build feature parameters
        Returns:
        build feature descriptor
        Since:
        6.0
      • addBuildFeature

        void addBuildFeature​(@NotNull
                             SBuildFeatureDescriptor feature)
        Adds build feature descriptor to this settings object.
        Parameters:
        feature - build feature descriptor
        Since:
        6.0
      • getBuildFeatures

        @NotNull
        java.util.Collection<SBuildFeatureDescriptor> getBuildFeatures()
        Returns build features added to this settings object.
        Returns:
        collection of configured build features
        Since:
        6.0
      • getBuildFeaturesOfType

        @NotNull
        java.util.Collection<SBuildFeatureDescriptor> getBuildFeaturesOfType​(@NotNull
                                                                             java.lang.String type)
        Returns all build features of specified type.
        Returns:
        see above
        Since:
        8.1
      • removeBuildFeature

        @Nullable
        SBuildFeatureDescriptor removeBuildFeature​(@NotNull
                                                   java.lang.String featureId)
        Removes build feature with specified id from this settings object.
        Parameters:
        featureId - id of the feature
        Returns:
        removed build feature descriptor or null if there were no feature descriptor with such id
        Since:
        6.0
      • updateBuildFeature

        boolean updateBuildFeature​(@NotNull
                                   java.lang.String featureId,
                                   @NotNull
                                   java.lang.String newType,
                                   @NotNull
                                   java.util.Map<java.lang.String,​java.lang.String> newParams)
        Updates build feature descriptor with specified id, changes type and parameters.
        Parameters:
        featureId - id of build feature descriptor
        newType - type of build feature descriptor
        newParams - parameters map
        Returns:
        true if parameters of build feature descriptor were changed (descriptor with such id exists) and false otherwise
        Since:
        6.0
      • findBuildFeatureById

        @Nullable
        SBuildFeatureDescriptor findBuildFeatureById​(@NotNull
                                                     java.lang.String featureId)
        Returns build feature with specified id
        Parameters:
        featureId - id of the feature
        Returns:
        see above
        Since:
        8.1
      • setEnabled

        void setEnabled​(@NotNull
                        java.lang.String parametersDescriptorId,
                        boolean enabled)
        Enables or disables descriptor with specified id in build configuration settings. This method can be used to enable or disable build runners, triggers and build features.
        Parameters:
        parametersDescriptorId - id of build runner, trigger or build feature
        enabled - true to enable, false to disable
        Since:
        7.0
      • isEnabled

        boolean isEnabled​(@NotNull
                          java.lang.String parametersDescriptorId)
        Returns true if descriptor with specified id (runner, trigger or build feature) is enabled and false otherwise.
        Parameters:
        parametersDescriptorId - id of build runner, trigger or build feature
        Since:
        7.0
      • getTypedOption

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

        Get option extended value. See TypedValue. When the option is not defined in this Settings TypedValue will contain null in getValue()

        Since:
        10.0
      • isDeployment

        boolean isDeployment()
        Returns:
        true if this build configuration is doing deployment
        Since:
        2020.1
      • isCompositeBuildType

        boolean isCompositeBuildType()
        Returns:
        true if this build type is composite
        Since:
        2017.2