Package jetbrains.buildServer.serverSide
Interface BuildTypeSettings
-
- All Superinterfaces:
BuildTypeOptions
,CompatibleAgents
,DependencySettings
,InheritableUserParametersHolder
,OptionSupport
,ReadOnlyUserParameters
,UserParametersHolder
,VcsLabelingSettings
- All Known Subinterfaces:
BuildTypeEx
,BuildTypeSettingsEx
,BuildTypeTemplate
,BuildTypeTemplateEx
,RemoteBuildType
,RemoteBuildTypeEx
,SBuildType
- All Known Implementing Classes:
BuildTypeImpl
,BuildTypeSettingsImpl
,BuildTypeTemplateImpl
,DummyBuildType
,EditableBuildTypeCopy
,EditableTemplateCopy
,InaccessibleTemplate
,MockBuildType
,RemoteBuildTypeImpl
,SecuredBuildType
,SecuredBuildTypeTemplate
public interface BuildTypeSettings extends BuildTypeOptions, InheritableUserParametersHolder, DependencySettings, VcsLabelingSettings, CompatibleAgents
Contains build configuration settings- Since:
- 5.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.BuildTypeOptions
BuildTypeOptions.BuildConfigurationType
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.vcs.VcsLabelingSettings
VcsLabelingSettings.LabelingType
-
-
Field Summary
-
Fields inherited from interface jetbrains.buildServer.serverSide.BuildTypeOptions
BT_ALLOW_EXTERNAL_STATUS, BT_ALLOW_PERSONAL_BUILD_TRIGGERING, BT_ARTIFACT_PUBLISH_CONDITION, BT_ARTIFACT_RULES, BT_BRANCH_FILTER, BT_BUILD_CONFIGURATION_TYPE, BT_BUILD_DEFAULT_BRANCH, BT_BUILD_NUMBER_PATTERN, BT_CHECKOUT_DIR, BT_CHECKOUT_MODE, BT_CLEAN_BUILD, BT_EXCLUDE_DEFAULT_BRANCH_CHANGES, BT_EXECUTION_TIMEOUT, BT_FAIL_IF_TESTS_FAIL, BT_FAIL_ON_ANY_ERROR_MESSAGE, BT_FAIL_ON_EXIT_CODE, BT_FAIL_ON_OOME_OR_CRASH, BT_GENERATED_SETTINGS_CHECKSUM, BT_HANGING_BUILDS_DETECTION_ENABLED, BT_MAX_RUNNING_BUILDS, BT_MAX_RUNNING_BUILDS_PER_BRANCH, BT_SHOW_DEPS_CHANGES, BT_SUPPORT_TEST_RETRY, DEFAULT_BUILD_NUMBER_PATTERN, DEFAULT_MAX_RUNNING_BUILDS_PER_BRANCH, DEFAULT_VCS_LABELING_BRANCH_FILTER, VCS_LABELING_BRANCH_FILTER
-
Fields inherited from interface jetbrains.buildServer.serverSide.vcs.VcsLabelingSettings
DEFAULT_LABEL_PATTERN
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addArtifactDependency(SArtifactDependency dependency)
Adds artifact dependency.SBuildFeatureDescriptor
addBuildFeature(String type, Map<String,String> params)
Adds build feature with specified type and parameters to this settings object.void
addBuildFeature(SBuildFeatureDescriptor feature)
Adds build feature descriptor to this settings object.void
addBuildParameter(Parameter parameter)
Adds build parameter to the configuration.SBuildRunnerDescriptor
addBuildRunner(String id, String name, String runnerType, Map<String,String> parameters)
Creates a new build runner with the specified id, name, runner type, and parameters, and adds it to the current build settings.SBuildRunnerDescriptor
addBuildRunner(String name, String runnerType, Map<String,String> parameters)
Creates new build runner and adds it to these settings.SBuildRunnerDescriptor
addBuildRunner(BuildRunnerDescriptor runner)
Adds runner descriptor.BuildTriggerDescriptor
addBuildTrigger(String type, Map<String,String> params)
Deprecated.since 2021.1, useaddBuildTrigger(BuildTriggerDescriptor)
insteadboolean
addBuildTrigger(BuildTriggerDescriptor triggerDescriptor)
Adds new trigger to build configuration settings.void
addConfigParameter(Parameter param)
Adds configuration parameter.void
addRequirement(Requirement requirement)
Adds new build requirement to the configuration.boolean
addVcsRoot(SVcsRoot root)
Adds VCS root to the build configuration with default checkout rules.void
applyRunnersOrder(String[] ids)
Accepts array of runner identifiers and reorders them according to this array.boolean
containsOwnVcsRoot(long vcsRootId)
Returns true if VCS root with specified id is attached directly and is not inherited via a templateboolean
containsVcsRoot(long vcsRootId)
Returns true if VCS root with specified id is attached directly or is inherited via a templateSBuildFeatureDescriptor
findBuildFeatureById(String featureId)
Returns build feature with specified idSBuildRunnerDescriptor
findBuildRunnerById(String runnerId)
Finds build runner by its' idSBuildRunnerDescriptor
findBuildRunnerByType(String runnerType)
Finds build runner by its' type.String
findRunnerParameter(String paramName)
Searches runner parameter in all build runners and returns value of the first found parameter with given name.BuildTriggerDescriptor
findTriggerById(String triggerId)
Finds build trigger descriptor by its' idList<SArtifactDependency>
getArtifactDependencies()
Returns artifacts this build configuration depending on.String
getArtifactPaths()
Returns build artifact paths.List<Requirement>
getBuildFeatureRequirements()
Returns list of additional agent requirements imposed by configured enabled build features.Collection<SBuildFeatureDescriptor>
getBuildFeatures()
Returns build features added to this settings object.Collection<SBuildFeatureDescriptor>
getBuildFeaturesOfType(String type)
Returns all build features of specified type.String
getBuildNumberPattern()
Returns current build number patternString
getBuildParameter(String key)
Returns build parameter by parameter keyMap<String,String>
getBuildParameters()
Return map of build parameters specified by user.Collection<Parameter>
getBuildParametersCollection()
Returns build parameters collection.List<SBuildRunnerDescriptor>
getBuildRunners()
Returns collection of build runners attached to these settingsCollection<BuildTriggerDescriptor>
getBuildTriggersCollection()
Returns collection of build trigger settingsString
getCheckoutDirectory()
Returns build checkout directory - if specified explicitly usingsetCheckoutDirectory(String)
.CheckoutRules
getCheckoutRules(VcsRoot root)
Returns checkout rules configured for the specified VCS root.BuildTypeDescriptor.CheckoutType
getCheckoutType()
Returns method used by agent to retrieve project sources.Map<String,String>
getConfigParameters()
Returns map of configuration parametersCollection<Parameter>
getConfigParametersCollection()
Returns collection of configuration parameters.List<Requirement>
getImplicitRequirements()
Get list of non-satisfied implicit requirements for build agents.SProject
getProject()
Returns the project this build type entity belongs to.ReadOnlyReason
getReadOnlyReason()
List<Requirement>
getRequirements()
Get list of explicit requirements for build agents which can run this build configuration.BuildStepConditions
getRunnerConditions(SBuildRunnerDescriptor descriptor)
String[]
getRunnersOrder()
Collection<String>
getRunnerTypes()
Returns types of the runners attached to these settingsList<Requirement>
getRunTypeRequirements()
Returns list of additional agent requirements imposed by configured runners.BuildTypeTemplate
getTemplate()
Deprecated.since 2017.2, usegetTemplates()
insteadString
getTemplateId()
Deprecated.since 2017.2, usegetTemplateIds()
insteadList<String>
getTemplateIds()
Returns internal ids of the templates this settings are based on, including one of the default templateList<? extends BuildTypeTemplate>
getTemplates()
Returns templates these settings are based on, including the default template.<T> TypedValue<T>
getTypedOption(Option<T> option)
Get option extended value.List<String>
getUndefinedParameters()
Returns collection of parameter names (config and build params) referenced in the build configuration settings but without values provided.List<VcsRootEntry>
getVcsRootEntries()
Returns all entries of vcs roots.List<SVcsRoot>
getVcsRoots()
Returns all roots currently attached to this configurationboolean
isCompositeBuildType()
boolean
isDeployment()
boolean
isEnabled(String parametersDescriptorId)
Returns true if descriptor with specified id (runner, trigger or build feature) is enabled and false otherwise.boolean
isReadOnly()
boolean
isTemplateAccessible()
Checks accessibility of all attached templates, excluding the default template (if present)boolean
isTemplateBased()
Returns true if these settings are directly based on a template.void
persist()
Persists these settings.void
persist(ConfigAction cause)
void
removeAllBuildRunners()
Removes all build runners from these settingsvoid
removeArtifactDependency(SArtifactDependency dependency)
Removes artifact dependency.SBuildFeatureDescriptor
removeBuildFeature(String featureId)
Removes build feature with specified id from this settings object.void
removeBuildParameter(String paramName)
Removes existing build parameter by its name.SBuildRunnerDescriptor
removeBuildRunner(String runnerId)
Removes runner descriptor with specified id.boolean
removeBuildTrigger(BuildTriggerDescriptor triggerDescriptor)
Removes specified build trigger from the settingsvoid
removeConfigParameter(String paramName)
Removes configuration parameters with specified namevoid
removeRequirement(String parameterName)
Removes first requirement with the specified property name from the configuration.void
removeRequirement(Requirement requirement)
Removes a requirement from the configuration.boolean
removeVcsRoot(SVcsRoot root)
Removes existing VCS root from the build configuration.boolean
replaceInValues(String regexp, String replacement)
Replaces values according to specified regexp and replacement string in all text parameters of the build configurationboolean
replaceInValues(Pattern regexpPattern, String replacement)
Replaces values according to specified pattern and replacement string in all text parameters of the build configurationvoid
resetRunnersOrder()
Resets custom runner order to default.void
setArtifactDependencies(List<SArtifactDependency> artifacts)
Sets artifacts this build configuration depending on.void
setArtifactPaths(String artifactPaths)
Sets build artifact paths.void
setBuildNumberPattern(String pattern)
Sets build number pattern.void
setCheckoutDirectory(String dir)
Sets build checkout directory.boolean
setCheckoutRules(VcsRoot root, CheckoutRules checkoutRules)
Sets checkout rules for specified VCS root.void
setCheckoutType(BuildTypeDescriptor.CheckoutType type)
Sets preferred checkout type for the configuration sources.void
setEnabled(String parametersDescriptorId, boolean enabled)
Enables or disables descriptor with specified id in build configuration settings.boolean
textValueMatches(Pattern regexpPattern)
Returns true if configuration has value in text parameters which matches specified pattern.boolean
updateBuildFeature(String featureId, String newType, Map<String,String> newParams)
Updates build feature descriptor with specified id, changes type and parameters.boolean
updateBuildRunner(String runnerId, String newName, String newType, Map<String,String> newParams)
Updates parameters in the existing build runner descriptor.boolean
updateBuildTrigger(String triggerId, String newType, Map<String,String> newParams)
Deprecated.boolean
updateBuildTrigger(BuildTriggerDescriptor newDescriptor)
Updates build trigger descriptor with id equal to newDescriptor id.-
Methods inherited from interface jetbrains.buildServer.serverSide.CompatibleAgents
getAgentCompatibility, getCompatibilityMap, getCompatibleAgents
-
Methods inherited from interface jetbrains.buildServer.serverSide.dependency.DependencySettings
addDependency, getDependencies, removeDependency
-
Methods inherited from interface jetbrains.buildServer.serverSide.InheritableUserParametersHolder
getInheritedParametersCollection, getOwnParameter, getOwnParameters, getOwnParametersCollection, getOwnParametersWithoutInheritedSpec, getParameters, getParametersCollection
-
Methods inherited from interface jetbrains.buildServer.util.OptionSupport
getChangedOptions, getDeclaredOption, getOption, getOptionDefaultValue, getOptions, getOwnOptions, setOption
-
Methods inherited from interface jetbrains.buildServer.serverSide.ReadOnlyUserParameters
getParameter, getParameterValue
-
Methods inherited from interface jetbrains.buildServer.serverSide.UserParametersHolder
addParameter, removeParameter
-
Methods inherited from interface jetbrains.buildServer.serverSide.vcs.VcsLabelingSettings
getLabelingRoots, getLabelingType, getLabelPattern
-
-
-
-
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 Collection<String> getRunnerTypes()
Returns types of the runners attached to these settings- Returns:
- see above
- Since:
- 6.0
-
getRunTypeRequirements
@NotNull List<Requirement> getRunTypeRequirements()
Returns list of additional agent requirements imposed by configured runners.- Returns:
- see above
-
getBuildFeatureRequirements
@NotNull 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 BuildRunnerDescriptor runner) throws ReadOnlyEntityException
Adds runner descriptor. UseBuildRunnerDescriptorFactory
to create instance of runner descriptor.
Before 8.0 this method requiredSBuildRunnerDescriptor
as parameter- Parameters:
runner
- descriptor- Returns:
- instance of actually added runner
- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
addBuildRunner
@NotNull SBuildRunnerDescriptor addBuildRunner(@NotNull String name, @NotNull String runnerType, @NotNull Map<String,String> parameters) throws ReadOnlyEntityException
Creates new build runner and adds it to these settings. Runner's ID is autogenerated- Parameters:
name
- runner namerunnerType
- type of the runnerparameters
- runner parameters- Returns:
- newly created runner
- Throws:
ReadOnlyEntityException
- Since:
- 6.5
-
addBuildRunner
@NotNull SBuildRunnerDescriptor addBuildRunner(@NotNull String id, @NotNull String name, @NotNull String runnerType, @NotNull Map<String,String> parameters) throws DuplicateIdException, InvalidIdentifierException, ReadOnlyEntityException
Creates a new build runner with the specified id, name, runner type, and parameters, and adds it to the current build settings.- Parameters:
id
- the unique id of the build runner (should be unique within all runners of this configuration)name
- the name of the build runnerrunnerType
- the type of the build runnerparameters
- the parameters for the build runner- Returns:
- the newly created build runner descriptor
- Throws:
DuplicateIdException
- if the id is already in use by another build runner, runners inherited from templates are not consideredInvalidIdentifierException
- if the id is invalid or emptyReadOnlyEntityException
- if the settings are read-only and cannot be modified- Since:
- 2023.09
-
removeBuildRunner
@Nullable SBuildRunnerDescriptor removeBuildRunner(@NotNull String runnerId) throws ReadOnlyEntityException
Removes runner descriptor with specified id.- Parameters:
runnerId
- descriptor id- Returns:
- removed runner descriptor
- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
updateBuildRunner
boolean updateBuildRunner(@NotNull String runnerId, @NotNull String newName, @NotNull String newType, @NotNull Map<String,String> newParams) throws ReadOnlyEntityException
Updates parameters in the existing build runner descriptor. Does nothing if there runner with specified id was not found.- Parameters:
runnerId
- id of runner descriptornewName
- new runner namenewType
- new type of the runnernewParams
- new runner parameters- Returns:
- true if parameters updated and false otherwise
- Throws:
ReadOnlyEntityException
- Since:
- 6.5
-
getBuildRunners
@NotNull List<SBuildRunnerDescriptor> getBuildRunners()
Returns collection of build runners attached to these settings- Returns:
- see above
- Since:
- 6.0
-
removeAllBuildRunners
void removeAllBuildRunners() throws ReadOnlyEntityException
Removes all build runners from these settings- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
getRunnersOrder
@Nullable String[] getRunnersOrder()
- Returns:
- runner ids in their custom order (if such order is set), null otherwise
-
applyRunnersOrder
void applyRunnersOrder(@NotNull String[] ids) throws ReadOnlyEntityException
Accepts array of runner identifiers and reorders them according to this array.- Parameters:
ids
- runner identifiers- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
resetRunnersOrder
void resetRunnersOrder() throws ReadOnlyEntityException
Resets custom runner order to default.- Throws:
ReadOnlyEntityException
-
findBuildRunnerByType
@Nullable SBuildRunnerDescriptor findBuildRunnerByType(@NotNull 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 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 String findRunnerParameter(@NotNull 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
-
getRunnerConditions
@NotNull BuildStepConditions getRunnerConditions(@NotNull SBuildRunnerDescriptor descriptor)
- Returns:
- support for conditions for conditional build steps
- Since:
- 2020.1
-
getBuildParameters
@NotNull Map<String,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 Collection<Parameter> getBuildParametersCollection()
Returns build parameters collection.- Returns:
- see above
-
addBuildParameter
void addBuildParameter(Parameter parameter) throws ReadOnlyEntityException
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 andConstants.ENV_PREFIX
for environment variable.- Parameters:
parameter
- specified parameter.- Throws:
ReadOnlyEntityException
-
removeBuildParameter
void removeBuildParameter(String paramName) throws ReadOnlyEntityException
Removes existing build parameter by its name.- Parameters:
paramName
- specified parameter name.- Throws:
ReadOnlyEntityException
-
getBuildParameter
String getBuildParameter(String key)
Returns build parameter by parameter key- Parameters:
key
- parameter key- Returns:
- build parameter by parameter key
-
getVcsRoots
@NotNull List<SVcsRoot> getVcsRoots()
Returns all roots currently attached to this configuration- Returns:
- collection of all attached vcs roots.
-
addBuildTrigger
boolean addBuildTrigger(@NotNull BuildTriggerDescriptor triggerDescriptor) throws ReadOnlyEntityException
Adds new trigger to build configuration settings. UseBuildTriggerDescriptorFactory
to create trigger descriptor.- Parameters:
triggerDescriptor
- trigger descriptor- Returns:
- true if trigger was added, and false if trigger with such id already exists
- Throws:
ReadOnlyEntityException
- Since:
- 5.1
-
addBuildTrigger
@NotNull BuildTriggerDescriptor addBuildTrigger(@NotNull String type, @NotNull Map<String,String> params) throws ReadOnlyEntityException
Deprecated.since 2021.1, useaddBuildTrigger(BuildTriggerDescriptor)
insteadAdds new trigger of specified type and with specified parameters to build configuration settings.- Parameters:
type
- type of the triggerparams
- parameters map- Returns:
- newly created trigger descriptor
- Throws:
ReadOnlyEntityException
- Since:
- 7.0
-
removeBuildTrigger
boolean removeBuildTrigger(@NotNull BuildTriggerDescriptor triggerDescriptor) throws ReadOnlyEntityException
Removes specified build trigger from the settings- Parameters:
triggerDescriptor
- trigger descriptor- Returns:
- true if trigger was actually removed and false otherwise
- Throws:
ReadOnlyEntityException
- Since:
- 5.1
-
updateBuildTrigger
boolean updateBuildTrigger(@NotNull String triggerId, @NotNull String newType, @NotNull Map<String,String> newParams) throws ReadOnlyEntityException
Deprecated.Updates build trigger descriptor with specified id, changes type and parameters.- Parameters:
triggerId
- id of build trigger descriptornewType
- type of build trigger descriptornewParams
- parameters map- Returns:
- true if parameters of build trigger descriptor were changed (descriptor with such id exists) and false otherwise
- Throws:
ReadOnlyEntityException
- Since:
- 7.0
-
updateBuildTrigger
boolean updateBuildTrigger(@NotNull BuildTriggerDescriptor newDescriptor)
Updates build trigger descriptor with id equal to newDescriptor id.- Parameters:
newDescriptor
- new settings of the trigger- Returns:
- true if parameters of build trigger descriptor were changed (descriptor with such id exists) and false otherwise
-
getBuildTriggersCollection
@NotNull Collection<BuildTriggerDescriptor> getBuildTriggersCollection()
Returns collection of build trigger settings- Returns:
- see above
- Since:
- 5.1
-
findTriggerById
@Nullable BuildTriggerDescriptor findTriggerById(@NotNull 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
-
setCheckoutType
void setCheckoutType(BuildTypeDescriptor.CheckoutType type) throws ReadOnlyEntityException
Sets preferred checkout type for the configuration sources. Actual checkout type may differ, for example, if preferred checkout type is set to ON_AGENT, but there is vcs root which does not support on agent checkout, actual checkout type will be switched to ON_SERVER.BuildTypeDescriptor.CheckoutType.ON_SERVER
- checkout sources automatically on the server and snd it to the agent.BuildTypeDescriptor.CheckoutType.ON_AGENT
- checkout sources automatically on the agent.BuildTypeDescriptor.CheckoutType.MANUAL
- do not check out sources automatically.- Parameters:
type
- new checkout type.- Throws:
ReadOnlyEntityException
-
getCheckoutType
@NotNull BuildTypeDescriptor.CheckoutType getCheckoutType()
Returns method used by agent to retrieve project sources. CheckoutType.ON_SERVER server creates patch and sends it to agent CheckoutType.ON_AGENT agent checks sources out CheckoutType.MANUAL script does it itself. This method returns actual checkout type, which may differ from the value set bysetCheckoutType(jetbrains.buildServer.BuildTypeDescriptor.CheckoutType)
- Returns:
- method to get sources on agent.
-
setCheckoutDirectory
void setCheckoutDirectory(@Nullable String dir) throws ReadOnlyEntityException
Sets build checkout directory. Set it to null to use default checkout directory.- Parameters:
dir
- checkout directory- Throws:
ReadOnlyEntityException
-
getCheckoutDirectory
@Nullable String getCheckoutDirectory()
Returns build checkout directory - if specified explicitly using
setCheckoutDirectory(String)
. Returnsnull
if default checkout directory, generated by TeamCity should be used.- Returns:
- build checkout directory.
- See Also:
setCheckoutDirectory(String)
-
setArtifactPaths
void setArtifactPaths(@Nullable String artifactPaths) throws ReadOnlyEntityException
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- Throws:
ReadOnlyEntityException
- Since:
- 8.1 same as #setOption(BuildTypeOptions#BT_ARTIFACT_RULES, rules)}
-
getArtifactPaths
@Nullable String getArtifactPaths()
Returns build artifact paths.- Returns:
- build artifact paths
- Since:
- 8.1 same as #getOption(BuildTypeOptions#BT_ARTIFACT_RULES)}
-
getArtifactDependencies
@NotNull List<SArtifactDependency> getArtifactDependencies()
Returns artifacts this build configuration depending on.- Returns:
- list of artifacts this build configuration depending on
-
setArtifactDependencies
void setArtifactDependencies(@NotNull List<SArtifactDependency> artifacts) throws ReadOnlyEntityException
Sets artifacts this build configuration depending on.- Parameters:
artifacts
- new artifacts dependency list.- Throws:
ReadOnlyEntityException
-
addArtifactDependency
void addArtifactDependency(@NotNull SArtifactDependency dependency) throws ReadOnlyEntityException
Adds artifact dependency.- Parameters:
dependency
- new artifact dependency- Throws:
ReadOnlyEntityException
- Since:
- 10.0
-
removeArtifactDependency
void removeArtifactDependency(@NotNull SArtifactDependency dependency) throws ReadOnlyEntityException
Removes artifact dependency.- Parameters:
dependency
- artifact dependency- Throws:
ReadOnlyEntityException
- 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 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
-
addVcsRoot
boolean addVcsRoot(@NotNull SVcsRoot root) throws InvalidVcsRootScopeException, VcsRootNotFoundException, ReadOnlyEntityException
Adds VCS root to the build configuration with default checkout rules.- Parameters:
root
- VCS root to add- Returns:
- true if VCS root was actually added and false otherwise (this VCS root already exists)
- Throws:
InvalidVcsRootScopeException
- if VCS root scope is local and corresponds to another project (not the project - owner of this build configuration)VcsRootNotFoundException
- if specified VCS root does not exist anymoreReadOnlyEntityException
-
removeVcsRoot
boolean removeVcsRoot(@NotNull SVcsRoot root) throws ReadOnlyEntityException
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
- Throws:
ReadOnlyEntityException
-
setCheckoutRules
boolean setCheckoutRules(@NotNull VcsRoot root, @NotNull CheckoutRules checkoutRules) throws ReadOnlyEntityException
Sets checkout rules for specified VCS root. VCS root must be attached to this build configuration.- Parameters:
root
- root to set rules forcheckoutRules
- 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
- Throws:
ReadOnlyEntityException
-
getCheckoutRules
@Nullable CheckoutRules getCheckoutRules(@NotNull VcsRoot root)
Returns checkout rules configured for the specified VCS root. If specified VCS root is not attached to this build configuration, then null is returned.- Parameters:
root
- VCS root- Returns:
- checkout rules or null if specified VCS root is not attached to the build configuration
-
addConfigParameter
void addConfigParameter(@NotNull Parameter param) throws ReadOnlyEntityException
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- Throws:
ReadOnlyEntityException
- build parameters - these are parameters passed to agent and then to a build (see
-
removeConfigParameter
void removeConfigParameter(@NotNull String paramName) throws ReadOnlyEntityException
Removes configuration parameters with specified name- Parameters:
paramName
- parameter name- Throws:
ReadOnlyEntityException
-
getConfigParametersCollection
@NotNull Collection<Parameter> getConfigParametersCollection()
Returns collection of configuration parameters.- Returns:
- see above
-
getConfigParameters
@NotNull Map<String,String> getConfigParameters()
Returns map of configuration parameters- Returns:
- see above
-
getUndefinedParameters
@NotNull List<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 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, usegetTemplates()
insteadReturns 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 List<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 String getTemplateId()
Deprecated.since 2017.2, usegetTemplateIds()
insteadReturns internal id of the first template this setting is based on- Returns:
- see above
-
getRequirements
@NotNull 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 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) throws ReadOnlyEntityException
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.- Throws:
ReadOnlyEntityException
-
removeRequirement
void removeRequirement(String parameterName) throws ReadOnlyEntityException
Removes first requirement with the specified property name from the configuration.- Parameters:
parameterName
- name of the requirement parameter.- Throws:
ReadOnlyEntityException
-
removeRequirement
void removeRequirement(Requirement requirement) throws ReadOnlyEntityException
Removes a requirement from the configuration.- Parameters:
requirement
- requirement to be removed- Throws:
ReadOnlyEntityException
- Since:
- 10.0
-
getBuildNumberPattern
@NotNull String getBuildNumberPattern()
Returns current build number pattern- Returns:
- see above
- Since:
- 5.0
-
setBuildNumberPattern
void setBuildNumberPattern(@NotNull String pattern) throws ReadOnlyEntityException
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- Throws:
ReadOnlyEntityException
- Since:
- 5.0
-
persist
void persist() throws PersistFailedException
Persists these settings.- Throws:
PersistFailedException
-
persist
void persist(@NotNull ConfigAction cause) throws PersistFailedException
- Throws:
PersistFailedException
-
replaceInValues
boolean replaceInValues(@NotNull String regexp, @NotNull String replacement) throws PatternSyntaxException, ReadOnlyEntityException
Replaces values according to specified regexp and replacement string in all text parameters of the build configuration- Parameters:
regexp
- regexpreplacement
- replacement- Returns:
- true if at least one text value was affected and false otherwise
- Throws:
PatternSyntaxException
- if pattern is incorrectReadOnlyEntityException
- Since:
- 5.1
-
replaceInValues
boolean replaceInValues(@NotNull Pattern regexpPattern, @NotNull String replacement) throws ReadOnlyEntityException
Replaces values according to specified pattern and replacement string in all text parameters of the build configuration- Parameters:
regexpPattern
- regexp patternreplacement
- replacement- Returns:
- true if at least one text value was affected and false otherwise
- Throws:
ReadOnlyEntityException
- Since:
- 8.0.7
-
textValueMatches
boolean textValueMatches(@NotNull 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 String type, @NotNull Map<String,String> params) throws ReadOnlyEntityException
Adds build feature with specified type and parameters to this settings object.- Parameters:
type
- build feature typeparams
- build feature parameters- Returns:
- build feature descriptor
- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
addBuildFeature
void addBuildFeature(@NotNull SBuildFeatureDescriptor feature) throws ReadOnlyEntityException
Adds build feature descriptor to this settings object.- Parameters:
feature
- build feature descriptor- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
getBuildFeatures
@NotNull Collection<SBuildFeatureDescriptor> getBuildFeatures()
Returns build features added to this settings object.- Returns:
- collection of configured build features
- Since:
- 6.0
-
getBuildFeaturesOfType
@NotNull Collection<SBuildFeatureDescriptor> getBuildFeaturesOfType(@NotNull String type)
Returns all build features of specified type.- Returns:
- see above
- Since:
- 8.1
-
removeBuildFeature
@Nullable SBuildFeatureDescriptor removeBuildFeature(@NotNull String featureId) throws ReadOnlyEntityException
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
- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
updateBuildFeature
boolean updateBuildFeature(@NotNull String featureId, @NotNull String newType, @NotNull Map<String,String> newParams) throws ReadOnlyEntityException
Updates build feature descriptor with specified id, changes type and parameters.- Parameters:
featureId
- id of build feature descriptornewType
- type of build feature descriptornewParams
- parameters map- Returns:
- true if parameters of build feature descriptor were changed (descriptor with such id exists) and false otherwise
- Throws:
ReadOnlyEntityException
- Since:
- 6.0
-
findBuildFeatureById
@Nullable SBuildFeatureDescriptor findBuildFeatureById(@NotNull String featureId)
Returns build feature with specified id- Parameters:
featureId
- id of the feature- Returns:
- see above
- Since:
- 8.1
-
setEnabled
void setEnabled(@NotNull String parametersDescriptorId, boolean enabled) throws ReadOnlyEntityException
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 featureenabled
- true to enable, false to disable- Throws:
ReadOnlyEntityException
- Since:
- 7.0
-
isEnabled
boolean isEnabled(@NotNull 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
-
isReadOnly
boolean isReadOnly()
- Returns:
- true if these settings are in read only mode
- Since:
- 2021.1
-
getReadOnlyReason
@Nullable ReadOnlyReason getReadOnlyReason()
- Returns:
- reason why these settings are in read only state or null if they are not read only
- Since:
- 2021.1
-
-