Class BuildCardExtension

    • Constructor Detail

      • BuildCardExtension

        public BuildCardExtension()
    • Method Detail

      • getIndex

        public abstract long getIndex()
        Return an index to where this should be displayed, relative to other options
        Returns:
        the index - lower appears first in the list
      • rerunBuild

        public int rerunBuild​(String externalizableId)
        Re-run the build known by the given Run externalizeableId
        Parameters:
        externalizableId - - a Run externalizableId
        Returns:
        the integer of the next Run
      • filterActions

        protected List<Action> filterActions​(List<Action> actions)
        Filter out the list of actions so that it only includes ParametersAction and CauseActions, removing the UserIdAction from the CauseAction's list of Causes. We want to include CauseAction because that includes upstream cause actions, which are inherited in downstream builds. We do not want to inherit the UserId cause, because the user initiating a retry may be different than the user who originated the upstream build, and so should be re-identified. We do not want to inherit any other CauseAction because that will result in duplicating actions from publishers, and builders from previous builds corrupting the retriggered build.
        Parameters:
        actions - a collection of build actions.
        Returns:
        a collection of build actions with all UserId causes removed.
      • filterOutUserIdCause

        protected CauseAction filterOutUserIdCause​(CauseAction causeAction)
        Filter out Cause.UserIdCause from the given CauseAction. We want to do this because re-run will want to contribute its own Cause.UserIdCause, not copy it from the previous run.
        Parameters:
        causeAction - the causeAction to remove UserIdCause from
        Returns:
        a causeAction with UserIdCause removed
      • triggerManualBuild

        public int triggerManualBuild​(ItemGroup pipelineContext,
                                      Integer upstreamBuildNumber,
                                      String triggerProjectName,
                                      String upstreamProjectName)
        Trigger a manual build
        Parameters:
        pipelineContext - - the context of the calling pipeline, used to find projects in the pipeline
        upstreamBuildNumber - - the build number of the upstream build
        triggerProjectName - - the name of the project being manually triggered
        upstreamProjectName - - the name of the project in the upstream build
        Returns:
        the build number of the triggered manual build
      • triggerBuild

        protected int triggerBuild​(AbstractProject<?,​?> triggerProject,
                                   AbstractBuild<?,​?> upstreamBuild,
                                   Action buildParametersAction)
        Schedules a build to start. The build will take an upstream build as its Cause and a set of ParametersAction from the upstream build.
        Parameters:
        triggerProject - - Schedule a build to start on this AbstractProject
        upstreamBuild - - The upstream AbstractBuild that will be used as a Cause for the triggerProject's build.
        buildParametersAction - - The upstream ParametersAction that will be used as an Action for the triggerProject's build.
        Returns:
        next build number
      • retrieveUpstreamProjectTriggerConfig

        protected List<hudson.plugins.parameterizedtrigger.AbstractBuildParameters> retrieveUpstreamProjectTriggerConfig​(AbstractProject<?,​?> project,
                                                                                                                         AbstractBuild<?,​?> upstreamBuild)
        Used to retrieve the parameters from the upstream project build trigger relative to the given downstream project
        Parameters:
        project - the downstream project
        upstreamBuild - the upstream project build
        Returns:
        the trigger config relative to the given downstream project
      • mergeParameters

        protected static ParametersAction mergeParameters​(ParametersAction base,
                                                          ParametersAction overlay)
        From parameterized trigger plugin src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java
        Parameters:
        base - One of the two parameters to merge.
        overlay - The other parameters to merge
        Returns:
        Result of the merge.
      • retrieveBuild

        protected AbstractBuild<?,​?> retrieveBuild​(int buildNo,
                                                         AbstractProject<?,​?> project)
        Given an AbstractProject and a build number the associated AbstractBuild will be retrieved.
        Parameters:
        buildNo - - Build number
        project - - AbstractProject
        Returns:
        The AbstractBuild associated with the AbstractProject and build number.