Package hudson.plugins.promoted_builds
Class PromotionProcess
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Actionable
hudson.model.AbstractItem
hudson.model.Job<P,R>
hudson.model.AbstractProject<PromotionProcess,Promotion>
hudson.plugins.promoted_builds.PromotionProcess
- All Implemented Interfaces:
ExtensionPoint
,BuildableItem
,BuildableItemWithBuildWrappers
,Describable<PromotionProcess>
,DescriptorByNameOwner
,Item
,ModelObject
,PersistenceRoot
,SubTask
,Queue.Task
,ResourceActivity
,Saveable
,SearchableModelObject
,SearchItem
,AccessControlled
,LazyBuildMixIn.LazyLoadingJob<PromotionProcess,
,Promotion> Loadable
,ModelObjectWithChildren
,ModelObjectWithContextMenu
,ParameterizedJobMixIn.ParameterizedJob<PromotionProcess,
,Promotion> TriggeredItem
,OnMaster
,HasWidgets
,org.kohsuke.stapler.HttpDeletable
,org.kohsuke.stapler.StaplerOverridable
,org.kohsuke.stapler.StaplerProxy
public final class PromotionProcess
extends AbstractProject<PromotionProcess,Promotion>
implements Saveable, Describable<PromotionProcess>, BuildableItemWithBuildWrappers
A dummy
AbstractProject
to carry out promotion operations.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.AbstractProject
AbstractProject.AbstractProjectDescriptor, AbstractProject.BecauseOfBuildInProgress, AbstractProject.BecauseOfDownstreamBuildInProgress, AbstractProject.BecauseOfUpstreamBuildInProgress, AbstractProject.LabelValidator
Nested classes/interfaces inherited from class hudson.model.Job
Job.LastItemListener, Job.SubItemBuildsLocationImpl
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
Field Summary
Modifier and TypeFieldDescriptionThe label that promotion process can be run on.The icon that represents this promotion process.Tells if this promotion should be hidden.Fields inherited from class hudson.model.AbstractProject
ABORT, blockBuildWhenDownstreamBuilding, blockBuildWhenUpstreamBuilding, BUILD_NOW_TEXT, builds, disabled, transientActions, triggers
Fields inherited from class hudson.model.Job
HISTORY_ADAPTER, nextBuildNumber, properties, runIdMigrator
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUN
-
Method Summary
Modifier and TypeMethodDescriptionAbstractProject<?,
?> protected void
boolean
considerPromotion
(AbstractBuild<?, ?> build) Deprecated.considerPromotion2
(AbstractBuild<?, ?> build) Checks if the build is promotable, and if so, promote it.considerPromotion2
(AbstractBuild<?, ?> build, ManualCondition.ManualApproval approval) considerPromotion2
(AbstractBuild<?, ?> build, List<ParameterValue> params) void
doBuild
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, TimeDuration delay) void
static PromotionProcess
fromJson
(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject o) Creates unconnectedPromotionProcess
instance from the JSON configuration.getACL()
static List<Descriptor<? extends BuildStep>>
getAll()
Gets the textual representation of the assigned label as it was entered by the user.Gets the customWorkspace of the owner project.getIcon()
Get the icon name, without the extension.getJDK()
getMetQualifications
(AbstractBuild<?, ?> build) Get the badges of conditions that were passed for this promotion for the buildAbstractProject<?,
?> getOwner()
Gets the ownerAbstractProject
that configuredJobPropertyImpl
as a job property.getPromotionCondition
(String promotionClassName) Get the promotion condition by referencing it fully qualified class nameReturns the root project value.getUnmetConditions
(AbstractBuild<?, ?> build) Get the conditions that have not been met for this promotion for the buildboolean
isActive()
boolean
boolean
isInQueue
(AbstractBuild<?, ?> build) isMet
(AbstractBuild<?, ?> build) Checks if all the conditions to promote a build is met.boolean
void
promote
(AbstractBuild<?, ?> build, Cause cause, PromotionBadge... badges) void
promote
(AbstractBuild<?, ?> build, Cause cause, Status qualification) Deprecated.promote2
(AbstractBuild<?, ?> build, Cause cause, Status qualification) Promote the given build by using the given qualification.promote2
(AbstractBuild<?, ?> build, Cause cause, Status qualification, List<ParameterValue> params) Promote the given build by using the given qualification.boolean
Deprecated.You need to be usingscheduleBuild(AbstractBuild)
boolean
scheduleBuild
(AbstractBuild<?, ?> build) boolean
scheduleBuild
(AbstractBuild<?, ?> build, Cause cause) Deprecated.scheduleBuild2
(AbstractBuild<?, ?> build, Cause cause) scheduleBuild2
(AbstractBuild<?, ?> build, Cause cause, List<ParameterValue> params) Schedules the promotion.boolean
JENKINS-27716: Since 1.585, the promotion must explicitly indicate that it can be disabled.Methods inherited from class hudson.model.AbstractProject
_getRuns, addProperty, addToList, addTrigger, blockBuildWhenDownstreamBuilding, blockBuildWhenUpstreamBuilding, buildDescribable, buildDescribable, checkAbortPermission, checkout, createExecutable, createHistoryWidget, createTransientActions, disable, doBuild, doBuildWithParameters, doCheckRetryCount, doConfigSubmit, doDoWipeOutWorkspace, doPolling, doWs, enable, findNearest, findNearest, getActions, getAuthToken, getBuild, getBuildByNumber, getBuildingDownstream, getBuildingUpstream, getBuildNowText, getBuildTriggerUpstreamProjects, getCauseOfBlockage, getDelay, getDownstreamProjects, getDownstreamProjectsForApi, getEnvironment, getEstimatedDurationCandidates, getFirstBuild, getHasCustomQuietPeriod, getIconColor, getLastBuild, getLastBuiltOn, getLazyBuildMixIn, getModuleRoot, getModuleRoots, getNearestBuild, getNearestOldBuild, getProminentActions, getPronoun, getQueueItem, getQuietPeriod, getRelationship, getRelevantLabels, getResourceActivities, getResourceList, getSameNodeConstraint, getScm, getScmCheckoutRetryCount, getScmCheckoutStrategy, getSomeBuildWithWorkspace, getSomeWorkspace, getSubTasks, getTransitiveDownstreamProjects, getTransitiveUpstreamProjects, getTrigger, getTriggers, getUpstreamProjects, getUpstreamProjectsForApi, getWorkspace, getWorkspaceResource, hasAbortPermission, hasCustomScmCheckoutRetryCount, hasParticipant, isBuildable, isConcurrentBuild, isConfigurable, isDisabled, isInQueue, loadBuild, makeSearchIndex, newBuild, onCreatedFromScratch, onLoad, performDelete, poll, pollSCMChanges, removeFromList, removeRun, removeTrigger, resolveForCLI, save, scheduleBuild, scheduleBuild2, scheduleBuild2, scheduleBuild2, scheduleBuild2, scheduleBuild2, schedulePolling, setAssignedLabel, setAssignedNode, setBlockBuildWhenDownstreamBuilding, setBlockBuildWhenUpstreamBuilding, setConcurrentBuild, setCustomWorkspace, setDisabled, setJDK, setQuietPeriod, setScm, setScmCheckoutStrategy, submit, triggers, updateTransientActions
Methods inherited from class hudson.model.Job
assignBuildNumber, checkRename, delete, doBuildStatus, doChildrenContextMenu, doDescription, doDoRename, doRssAll, doRssChangelog, doRssFailed, getAllJobs, getAllProperties, getBuildDir, getBuildDiscarder, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusIconClassName, getBuildStatusUrl, getBuildTimeGraph, getCharacteristicEnvVars, getDynamic, getEstimatedDuration, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getLogRotator, getNewBuilds, getNextBuildNumber, getOverrides, getPermalinks, getProperties, getProperty, getProperty, getTimeline, isBuilding, isHoldOffBuildUntilSave, isKeepDependencies, isLogUpdated, isNameEditable, logRotate, movedTo, onCopiedFrom, removeProperty, removeProperty, renameTo, saveNextBuildNumber, setBuildDiscarder, setLogRotator, supportsLogRotator, updateNextBuildNumber
Methods inherited from class hudson.model.AbstractItem
delete, doCheckNewName, doConfigDotXml, doConfirmRename, doDoDelete, doReload, doSubmitDescription, getAbsoluteUrl, getApi, getConfigFile, getDescription, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getRelativeDisplayNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getTarget, getTaskNoun, getUrl, load, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml, writeConfigDotXml, writeReplace
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getAllActions, removeAction, removeActions, replaceAction, replaceActions
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
Methods inherited from interface hudson.model.BuildableItem
scheduleBuild
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
Methods inherited from interface jenkins.widgets.HasWidgets
getWidget, getWidgets
Methods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getDisplayName, getFullDisplayName, getFullName, getName, getRelativeNameFrom, getRelativeNameFrom, getUrl, onCopiedFrom, onCreatedFromScratch, onLoad, save
Methods inherited from interface jenkins.model.ParameterizedJobMixIn.ParameterizedJob
doBuildWithParameters, doCancelQueue, doDisable, doEnable, getParameterizedJobMixIn, isParameterized, makeDisabled, scheduleBuild, scheduleBuild
Methods inherited from interface hudson.model.PersistenceRoot
getRootDir
Methods inherited from interface hudson.model.Queue.Task
checkAbortPermission, getAffinityKey, getCauseOfBlockage, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2, getFullDisplayName, getName, getSubTasks, getUrl, getWhyBlocked, hasAbortPermission, isBuildBlocked, isConcurrentBuild
Methods inherited from interface hudson.model.ResourceActivity
getDisplayName, getResourceList
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
Methods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrl
Methods inherited from interface hudson.model.queue.SubTask
getEstimatedDuration, getLastBuiltOn, getOwnerExecutable, getOwnerTask, getSameNodeConstraint
-
Field Details
-
conditions
PromotionCondition
s. All have to be met for a build to be promoted. -
icon
The icon that represents this promotion process. This is the name of the SVG icon that can be found in ${rootURL}/plugin/promoted-builds/icons/, e.g."star-gold"
. -
assignedLabel
The label that promotion process can be run on. -
isVisible
Tells if this promotion should be hidden.
-
-
Method Details
-
fromJson
public static PromotionProcess fromJson(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject o) throws Descriptor.FormException, IOException Creates unconnectedPromotionProcess
instance from the JSON configuration. This is mostly only useful for capturing its configuration in XML format.- Parameters:
req
- Requesto
- JSON object with source data- Returns:
- Parsed promotion process
- Throws:
Descriptor.FormException
- form submission issue, includes form validationIOException
-PromotionProcess
creation issue
-
doSetName
- Overrides:
doSetName
in classAbstractItem
-
getRootProject
Returns the root project value.- Overrides:
getRootProject
in classAbstractProject<PromotionProcess,
Promotion> - Returns:
- the root project value.
-
getParent
- Specified by:
getParent
in interfaceItem
- Overrides:
getParent
in classAbstractItem
-
getOwner
Gets the ownerAbstractProject
that configuredJobPropertyImpl
as a job property.- Returns:
- Current owner project
-
getACL
- Specified by:
getACL
in interfaceAccessControlled
- Overrides:
getACL
in classJob<PromotionProcess,
Promotion>
-
supportsMakeDisabled
public boolean supportsMakeDisabled()JENKINS-27716: Since 1.585, the promotion must explicitly indicate that it can be disabled. Otherwise, promotions which trigger automatically upon build completion will execute, even if they're archived.- Specified by:
supportsMakeDisabled
in interfaceParameterizedJobMixIn.ParameterizedJob<PromotionProcess,
Promotion> - Overrides:
supportsMakeDisabled
in classAbstractProject<PromotionProcess,
Promotion>
-
getPromotionCondition
Get the promotion condition by referencing it fully qualified class name- Parameters:
promotionClassName
- Class name ofPromotion
- Returns:
- Promotion condition if exists
-
getPublishersList
- Specified by:
getPublishersList
in classAbstractProject<PromotionProcess,
Promotion>
-
asProject
- Specified by:
asProject
in interfaceBuildableItemWithBuildWrappers
-
getBuildWrappers
-
getBuildWrappersList
- Specified by:
getBuildWrappersList
in interfaceBuildableItemWithBuildWrappers
-
getBuildClass
- Specified by:
getBuildClass
in classAbstractProject<PromotionProcess,
Promotion>
-
getBuildSteps
-
getAssignedLabelString
Gets the textual representation of the assigned label as it was entered by the user.- Overrides:
getAssignedLabelString
in classAbstractProject<PromotionProcess,
Promotion> - Returns:
- Assigned label string
-
getAssignedLabel
- Specified by:
getAssignedLabel
in interfaceSubTask
- Overrides:
getAssignedLabel
in classAbstractProject<PromotionProcess,
Promotion>
-
getJDK
- Overrides:
getJDK
in classAbstractProject<PromotionProcess,
Promotion>
-
getCustomWorkspace
Gets the customWorkspace of the owner project. Support for FreeStyleProject only.- Overrides:
getCustomWorkspace
in classAbstractProject<PromotionProcess,
Promotion> - Returns:
- customWorkspace
-
getIcon
Get the icon name, without the extension. It will always return a non null and non empty string, as"star-gold"
is used for compatibility for older promotions configurations.- Returns:
- the icon name
-
getIsVisible
-
isVisible
public boolean isVisible() -
getMetQualifications
Get the badges of conditions that were passed for this promotion for the build- Parameters:
build
- The build to be checked- Returns:
- List of generated promotion badges
-
getUnmetConditions
Get the conditions that have not been met for this promotion for the build- Parameters:
build
- Build to be checked- Returns:
- List of unmet promotion conditions
-
isMet
Checks if all the conditions to promote a build is met.- Parameters:
build
- Build to be checked- Returns:
null
if promotion conditions are not met. otherwise returns a list of badges that record how the promotion happened.
-
considerPromotion
Deprecated.- Throws:
IOException
-
considerPromotion2
@CheckForNull public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build) throws IOExceptionChecks if the build is promotable, and if so, promote it.- Parameters:
build
- Build to be promoted- Returns:
null
if the build was not promoted, otherwise Future that kicks in when the build is completed.- Throws:
IOException
-
considerPromotion2
@CheckForNull public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build, List<ParameterValue> params) throws IOException- Throws:
IOException
-
promote
public void promote(AbstractBuild<?, ?> build, Cause cause, PromotionBadge... badges) throws IOException- Throws:
IOException
-
promote
@Deprecated public void promote(AbstractBuild<?, ?> build, Cause cause, Status qualification) throws IOExceptionDeprecated.- Throws:
IOException
-
promote2
public Future<Promotion> promote2(AbstractBuild<?, ?> build, Cause cause, Status qualification) throws IOExceptionPromote the given build by using the given qualification.- Parameters:
build
- Build to promotecause
- Why the build is promoted?qualification
- Initial promotion status- Returns:
- Future to track the completion of the promotion.
- Throws:
IOException
- Promotion failure
-
promote2
public Future<Promotion> promote2(AbstractBuild<?, ?> build, Cause cause, Status qualification, List<ParameterValue> params) throws IOExceptionPromote the given build by using the given qualification.- Parameters:
build
- Build to promotecause
- Why the build is promoted?qualification
- Initial promotion statusparams
- Promotion parameters- Returns:
- Future to track the completion of the promotion.
- Throws:
IOException
- Promotion failure
-
scheduleBuild
Deprecated.You need to be usingscheduleBuild(AbstractBuild)
- Specified by:
scheduleBuild
in interfaceBuildableItem
-
scheduleBuild
-
scheduleBuild
Deprecated.- Parameters:
build
- Target buildcause
- Promotion cause- Returns:
true
if scheduling is successful
-
scheduleBuild2
@CheckForNull public Future<Promotion> scheduleBuild2(@NonNull AbstractBuild<?, ?> build, Cause cause, @CheckForNull List<ParameterValue> params) Schedules the promotion.- Parameters:
build
- Target buildcause
- Promotion causeparams
- Parameters to be passed- Returns:
- Future result or
null
if the promotion cannot be scheduled
-
doBuild
public void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, javax.servlet.ServletException - Specified by:
doBuild
in interfaceParameterizedJobMixIn.ParameterizedJob<PromotionProcess,
Promotion> - Throws:
IOException
javax.servlet.ServletException
-
scheduleBuild2
-
isInQueue
-
isFingerprintConfigured
public boolean isFingerprintConfigured()- Specified by:
isFingerprintConfigured
in classAbstractProject<PromotionProcess,
Promotion>
-
buildDependencyGraph
- Overrides:
buildDependencyGraph
in classAbstractProject<PromotionProcess,
Promotion>
-
getAll
-
asPermalink
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<PromotionProcess>
-
getShortUrl
- Specified by:
getShortUrl
in interfaceItem
- Overrides:
getShortUrl
in classAbstractItem
-
isActive
public boolean isActive() -
considerPromotion2
public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build, ManualCondition.ManualApproval approval) throws IOException- Throws:
IOException
-
considerPromotion2(AbstractBuild)