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 ClassesNested classes/interfaces inherited from class hudson.model.AbstractProject
AbstractProject.AbstractProjectDescriptor, AbstractProject.BecauseOfBuildInProgress, AbstractProject.BecauseOfDownstreamBuildInProgress, AbstractProject.BecauseOfUpstreamBuildInProgress, AbstractProject.LabelValidatorNested classes/interfaces inherited from class hudson.model.Job
Job.LastItemListener, Job.SubItemBuildsLocationImplNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested classes/interfaces inherited from interface org.kohsuke.stapler.HttpDeletable
org.kohsuke.stapler.HttpDeletable.HttpDeletableDispatcherNested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType -
Field Summary
FieldsModifier 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, triggersFields inherited from class hudson.model.Job
HISTORY_ADAPTER, nextBuildNumber, properties, runIdMigratorFields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN, SKIP_PERMISSION_CHECK, TASK_NOUN -
Method Summary
Modifier and TypeMethodDescriptionAbstractProject<?,?> protected voidbooleanconsiderPromotion(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) voiddoBuild(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, TimeDuration delay) voidstatic PromotionProcessfromJson(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject o) Creates unconnectedPromotionProcessinstance 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 ownerAbstractProjectthat configuredJobPropertyImplas 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 buildbooleanisActive()booleanbooleanisInQueue(AbstractBuild<?, ?> build) isMet(AbstractBuild<?, ?> build) Checks if all the conditions to promote a build is met.booleanvoidpromote(AbstractBuild<?, ?> build, Cause cause, PromotionBadge... badges) voidpromote(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.booleanDeprecated.You need to be usingscheduleBuild(AbstractBuild)booleanscheduleBuild(AbstractBuild<?, ?> build) booleanscheduleBuild(AbstractBuild<?, ?> build, Cause cause) Deprecated.scheduleBuild2(AbstractBuild<?, ?> build, Cause cause) scheduleBuild2(AbstractBuild<?, ?> build, Cause cause, List<ParameterValue> params) Schedules the promotion.booleanJENKINS-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, 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, submit, triggers, updateTransientActionsMethods inherited from class hudson.model.Job
assignBuildNumber, checkRename, createHistoryWidget, delete, doBuildStatus, doChildrenContextMenu, doChildrenContextMenu, doDescription, doDoRename, doRssAll, doRssChangelog, doRssFailed, fastUpdateNextBuildNumber, getAllJobs, getAllProperties, getBuildDir, getBuildDiscarder, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusIconClassName, getBuildStatusUrl, getBuildTimeGraph, getCharacteristicEnvVars, getDynamic, 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, updateNextBuildNumberMethods inherited from class hudson.model.AbstractItem
delete, delete, doCheckNewName, doConfigDotXml, doConfigDotXml, doConfirmRename, doDoDelete, doDoDelete, doReload, doSubmitDescription, 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, writeReplaceMethods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getAllActions, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2Methods inherited from interface hudson.model.BuildableItem
scheduleBuildMethods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByNameMethods inherited from interface jenkins.widgets.HasWidgets
getWidget, getWidgetsMethods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getDisplayName, getFullDisplayName, getFullName, getName, getRelativeNameFrom, getRelativeNameFrom, getUrl, onCopiedFrom, onCreatedFromScratch, onLoad, saveMethods inherited from interface jenkins.model.ParameterizedJobMixIn.ParameterizedJob
doBuild, doBuildWithParameters, doBuildWithParameters, doCancelQueue, doDisable, doEnable, getParameterizedJobMixIn, isParameterized, makeDisabled, scheduleBuild, scheduleBuildMethods inherited from interface hudson.model.PersistenceRoot
getRootDirMethods inherited from interface hudson.model.Queue.Task
checkAbortPermission, getAffinityKey, getCauseOfBlockage, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2, getFullDisplayName, getName, getSubTasks, getUrl, getWhyBlocked, hasAbortPermission, isBuildBlocked, isConcurrentBuildMethods inherited from interface hudson.model.ResourceActivity
getDisplayName, getResourceListMethods inherited from interface hudson.search.SearchableModelObject
getSearchMethods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrlMethods inherited from interface hudson.model.queue.SubTask
getEstimatedDuration, getLastBuiltOn, getOwnerExecutable, getOwnerTask, getSameNodeConstraint
-
Field Details
-
conditions
PromotionConditions. 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.StaplerRequest2 req, net.sf.json.JSONObject o) throws Descriptor.FormException, IOException Creates unconnectedPromotionProcessinstance 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-PromotionProcesscreation issue
-
doSetName
- Overrides:
doSetNamein classAbstractItem
-
getRootProject
Returns the root project value.- Overrides:
getRootProjectin classAbstractProject<PromotionProcess,Promotion> - Returns:
- the root project value.
-
getParent
- Specified by:
getParentin interfaceItem- Overrides:
getParentin classAbstractItem
-
getOwner
Gets the ownerAbstractProjectthat configuredJobPropertyImplas a job property.- Returns:
- Current owner project
-
getACL
- Specified by:
getACLin interfaceAccessControlled- Overrides:
getACLin 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:
supportsMakeDisabledin interfaceParameterizedJobMixIn.ParameterizedJob<PromotionProcess,Promotion> - Overrides:
supportsMakeDisabledin 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:
getPublishersListin classAbstractProject<PromotionProcess,Promotion>
-
asProject
- Specified by:
asProjectin interfaceBuildableItemWithBuildWrappers
-
getBuildWrappers
-
getBuildWrappersList
- Specified by:
getBuildWrappersListin interfaceBuildableItemWithBuildWrappers
-
getBuildClass
- Specified by:
getBuildClassin classAbstractProject<PromotionProcess,Promotion>
-
getBuildSteps
-
getAssignedLabelString
Gets the textual representation of the assigned label as it was entered by the user.- Overrides:
getAssignedLabelStringin classAbstractProject<PromotionProcess,Promotion> - Returns:
- Assigned label string
-
getAssignedLabel
- Specified by:
getAssignedLabelin interfaceSubTask- Overrides:
getAssignedLabelin classAbstractProject<PromotionProcess,Promotion>
-
getJDK
- Overrides:
getJDKin classAbstractProject<PromotionProcess,Promotion>
-
getCustomWorkspace
Gets the customWorkspace of the owner project. Support for FreeStyleProject only.- Overrides:
getCustomWorkspacein 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:
nullif 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:
nullif 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:
scheduleBuildin interfaceBuildableItem
-
scheduleBuild
-
scheduleBuild
Deprecated.- Parameters:
build- Target buildcause- Promotion cause- Returns:
trueif 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
nullif the promotion cannot be scheduled
-
doBuild
public void doBuild(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter TimeDuration delay) throws IOException, jakarta.servlet.ServletException - Specified by:
doBuildin interfaceParameterizedJobMixIn.ParameterizedJob<PromotionProcess,Promotion> - Throws:
IOExceptionjakarta.servlet.ServletException
-
scheduleBuild2
-
isInQueue
-
isFingerprintConfigured
public boolean isFingerprintConfigured()- Specified by:
isFingerprintConfiguredin classAbstractProject<PromotionProcess,Promotion>
-
buildDependencyGraph
- Overrides:
buildDependencyGraphin classAbstractProject<PromotionProcess,Promotion>
-
getAll
-
asPermalink
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<PromotionProcess>
-
getShortUrl
- Specified by:
getShortUrlin interfaceItem- Overrides:
getShortUrlin classAbstractItem
-
isActive
public boolean isActive() -
considerPromotion2
public Future<Promotion> considerPromotion2(AbstractBuild<?, ?> build, ManualCondition.ManualApproval approval) throws IOException- Throws:
IOException
-
considerPromotion2(AbstractBuild)