Class CompositeRunningBuild

    • Field Detail

      • KEY_ARCHIVE_INTROSPECTION_ENABLED

        @NonNls
        @NotNull
        public static final String KEY_ARCHIVE_INTROSPECTION_ENABLED

        The name of the build configuration parameter which allows to enable or disable archive introspection for the artifacts of composite builds. The default is off (archive introspection disabled).

        See Also:
        Constant Field Values
    • Method Detail

      • isStarted

        public boolean isStarted()
      • isStarting

        public boolean isStarting()
        Description copied from interface: RunningBuildEx
        Returns true if the build is trying to start on an agent and runBuild() command has not finished yet
        Specified by:
        isStarting in interface RunningBuildEx
        Returns:
      • getCurrentPath

        public String getCurrentPath()
        Description copied from interface: SRunningBuild
        Returns short description of current running step.
        Specified by:
        getCurrentPath in interface SRunningBuild
        Returns:
        short description of current running step.
      • getAgentId

        public int getAgentId()
        Specified by:
        getAgentId in interface SRunningBuild
        Returns:
        id of the agent where this build is running; returns -1 for agent less builds
      • setStartTimes

        public void setStartTimes​(@NotNull
                                  Date agentStartTime,
                                  @NotNull
                                  Date serverStartTime,
                                  @NotNull
                                  TimeZone agentTimeZone)
        Description copied from interface: RunningBuildEx
        Sets timestamps when command to run build was sent to an agent.
        Specified by:
        setStartTimes in interface RunningBuildEx
        Parameters:
        agentStartTime - agent timestamp
        serverStartTime - server timestamp
      • updateBuildInfo

        public boolean updateBuildInfo()
        Description copied from interface: RunningBuildEx
        Loads build interruption and build finish timestamps from database into the build. Returns true if running build exists in DB and false otherwise.
        Specified by:
        updateBuildInfo in interface RunningBuildEx
      • getQueuedAgentId

        public Integer getQueuedAgentId()
        Specified by:
        getQueuedAgentId in interface SRunningBuild
        Returns:
        agent this build was queued on or null if build was not queued on a specific agent
      • getUserDataStorage

        @NotNull
        public UserDataStorage getUserDataStorage()
        Description copied from interface: RunningBuildEx
        Use this object to associate some data with the current instance. Stored data is not persisted and is not copied to another instance of the given object.
        Specified by:
        getUserDataStorage in interface RunningBuildEx
        Returns:
        user data holder
      • isFinishReceived

        public boolean isFinishReceived()
        Specified by:
        isFinishReceived in interface RunningBuildEx
        Returns:
        true if build finished was received by the server.
      • getCompletedPercent

        public int getCompletedPercent()
        Specified by:
        getCompletedPercent in interface SRunningBuild
        Returns:
        completed percentage for the build according to build duration estimated time. or -1 if there is no estimate
      • start

        public void start​(boolean async)
        Description copied from interface: RunningBuildEx
        Must be invoked only once when build starts.
        Specified by:
        start in interface RunningBuildEx
      • isStartedOnAgent

        public boolean isStartedOnAgent()
        Description copied from interface: SBuild
        Returns true if this build was started on agent.
        Specified by:
        isStartedOnAgent in interface SBuild
        Overrides:
        isStartedOnAgent in class BaseBuild
        Returns:
        see above
      • isFinishing

        public boolean isFinishing()
      • runUnlessFinished

        public boolean runUnlessFinished​(@NotNull
                                         Runnable action)
        Description copied from interface: RunningBuildEx
        Executes specified runnable if build is not finished. Build won't finish until runnable completes.
        Specified by:
        runUnlessFinished in interface RunningBuildEx
        Parameters:
        action - runnable
        Returns:
        true if runnable was executed
      • publishArtifact

        public void publishArtifact​(@NotNull
                                    String path,
                                    @NotNull
                                    InputStream is,
                                    @Nullable
                                    PublishArtifactProgressListener progressListener)
        Description copied from interface: RunningBuildEx
        Adds artifact to the build from the specified stream allowing to trace progress
        Specified by:
        publishArtifact in interface RunningBuildEx
        Parameters:
        path - path where to store artifact
        progressListener - PublishArtifactProgressListener to track progress
      • publishArtifact

        public void publishArtifact​(@NotNull
                                    String path,
                                    @NotNull
                                    File srcFile,
                                    @Nullable
                                    PublishArtifactProgressListener progressListener)
        Description copied from interface: RunningBuildEx
        Adds artifact to the build from the specified file allowing to trace progress
        Specified by:
        publishArtifact in interface RunningBuildEx
        Parameters:
        path - path where to store artifact
        srcFile - file containing artifact content; note that after the publishing srcFile can be removed
        progressListener - PublishArtifactProgressListener to track progress
      • createAgentBuild

        @NotNull
        public AgentBuild createAgentBuild()
        Description copied from interface: RunningBuildEx
        Creates structure containing all of the parameters which should be sent to an agent
        Specified by:
        createAgentBuild in interface RunningBuildEx
        Returns:
      • getTestRunMuter

        public TestRunMuter getTestRunMuter()
        Description copied from interface: RunningBuildEx
        Returns a special service that allows to mute test run if neccessary.
        Specified by:
        getTestRunMuter in interface RunningBuildEx
        Returns:
        an instance of the test run muter.
      • setBuildNumber

        public void setBuildNumber​(@NotNull
                                   String newBuildNumber)
        Description copied from interface: SRunningBuild
        Set new value for this build build number instead of current one. If newBuildNumber has pattern {build.number}, it is replaced with the current build number
        Specified by:
        setBuildNumber in interface SRunningBuild
        Parameters:
        newBuildNumber - new value for this build build number
      • setBuildStatus

        public void setBuildStatus​(Status status)
        Description copied from interface: SRunningBuild
        Set current status of the running build. Useful before build finish to update build status.
        Specified by:
        setBuildStatus in interface SRunningBuild
        Parameters:
        status - new status of the build
      • getAgentAccessCode

        public String getAgentAccessCode()
        Description copied from interface: SRunningBuild
        Returns access code which can be used by agent to access server resources by HTTP.
        Specified by:
        getAgentAccessCode in interface SRunningBuild
        Returns:
        access code
      • isProbablyHanging

        public boolean isProbablyHanging()
        Description copied from interface: SRunningBuild
        Returns true if server thinks this build has hung. The build is considered hung if its estimate is exceeded and there were no messages from this build for some time.
        Specified by:
        isProbablyHanging in interface SRunningBuild
        Returns:
        true if build is probably hanging
      • stop

        public void stop​(@NotNull
                         RunningBuildState interruptedState,
                         @Nullable
                         User user,
                         @NotNull
                         String comment,
                         boolean reAdd2Queue)
        Specified by:
        stop in interface RunningBuildEx
        Parameters:
        interruptedState - how to interrupt the build, should have interrupted status
        user - optional user who stops the build
        comment - comment for build interruption
        reAdd2Queue - if true, the build will be re-added to queue with the same build promotion (to the end of the queue)
      • finish

        public void finish​(@NotNull
                           Date finishDate)
        Description copied from interface: SRunningBuild
        Finalizes all build related activities and finishes the build. Build must be finished on agent. Takes no effect for already finished or interrupted builds.
        Specified by:
        finish in interface SRunningBuild
        Parameters:
        finishDate - finish date
      • stopDependentBuilds

        public void stopDependentBuilds​(@Nullable
                                        User user,
                                        @NotNull
                                        String comment,
                                        boolean skipAlreadyInterrupted)
      • occupiesAgent

        public boolean occupiesAgent()
        Specified by:
        occupiesAgent in interface RunningBuildInfo
        Returns:
        true if the build executes on the agent.
      • getDurationEstimate

        public long getDurationEstimate()
        Description copied from interface: RunningBuild
        Returns server estimation for this build duration in seconds.
        Specified by:
        getDurationEstimate in interface RunningBuild
        Returns:
        build duration estimation in seconds or -1 if estimate is not available.
      • getDurationOvertime

        public long getDurationOvertime()
        Description copied from interface: RunningBuild
        Returns how much in seconds this build duration exceeded estimated duration.
        Specified by:
        getDurationOvertime in interface RunningBuild
        Returns:
        how much in seconds this build duration exceeded estimated duration or -1 if estimate is not available.
      • getElapsedTime

        public long getElapsedTime()
        Description copied from interface: RunningBuild
        Returns elapsed time for this build.
        Specified by:
        getElapsedTime in interface RunningBuild
        Returns:
        elapsed time for this build in seconds.
      • getCachedShortStatistics

        @Nullable
        public ShortStatistics getCachedShortStatistics​(boolean calculateIfAbsent)
        Description copied from interface: BuildEx
        Return cached short statistics for this build.
        Specified by:
        getCachedShortStatistics in interface BuildEx
        Parameters:
        calculateIfAbsent - if true, then statistics is calculated if it is not cached yet, if false and there is no statistics in cache, then null is returned
        Returns:
        see above
      • getServerStartDate

        @NotNull
        public Date getServerStartDate()
        Description copied from interface: SBuild
        Returns the timestamp when the build was removed from the queue.
        Specified by:
        getServerStartDate in interface SBuild
        Overrides:
        getServerStartDate in class BaseBuild
        Returns:
        the timestamp when the build was removed from the queue.
      • getRawBuildNumber

        public String getRawBuildNumber()
        Description copied from interface: SBuild
        Returns raw build number (i.e. build number with unresolved parameters if they exist) in contradistinction to Build.getBuildNumber() method which will return build number with all unresolved parameters replaced with ???.
        Specified by:
        getRawBuildNumber in interface SBuild
        Specified by:
        getRawBuildNumber in class BaseBuild
        Returns:
        raw build number which can contain unresolved parameters
      • getProgressText

        @NotNull
        public String getProgressText()
        Specified by:
        getProgressText in interface RunningBuildEx
        Returns:
        current progress text calculated for the build; this text is used in build status line
      • isCompositeBuild

        public boolean isCompositeBuild()
        Description copied from interface: SBuild
        Returns true if this build is a composite build.
        Specified by:
        isCompositeBuild in interface SBuild
        Returns:
        see above
      • closeBuildLog

        public void closeBuildLog()
        Description copied from interface: RunningBuildEx
        Closes the build log's root block, flushes messages and closes the build log
        Specified by:
        closeBuildLog in interface RunningBuildEx
      • detachedFromAgent

        public void detachedFromAgent()
        Description copied from interface: RunningBuildEx
        Should be called when the build has been detached from the agent and agent can start some other build
        Specified by:
        detachedFromAgent in interface RunningBuildEx
      • isDetachedFromAgent

        public boolean isDetachedFromAgent()
        Description copied from interface: SBuild
        Returns true if this build was detached from agent at some point.
        Specified by:
        isDetachedFromAgent in interface SBuild
        Overrides:
        isDetachedFromAgent in class BaseBuild
        Returns:
        see above
      • prepareArtifactDependencies

        public void prepareArtifactDependencies()
        Description copied from interface: RunningBuildEx
        Resolves artifact dependencies by replacing "latest" rules with actual build ids.
        Specified by:
        prepareArtifactDependencies in interface RunningBuildEx
      • getStartDate

        @NotNull
        public Date getStartDate()
        Description copied from interface: Build
        Returns timestamp when the build start command has been sent to an agent (server-time) or remove from queue time if start command has not been sent
        Specified by:
        getStartDate in interface Build
        Overrides:
        getStartDate in class BaseBuild
        Returns:
        see above
      • getAgentName

        public String getAgentName()
        Description copied from interface: Build
        Returns agent name where build is running or happened to run if finished.
        Specified by:
        getAgentName in interface Build
        Returns:
        Agent name where build has been started on
      • getStatusDescriptor

        public StatusDescriptor getStatusDescriptor()
        Description copied from interface: Build
        Returns status descriptor of the build
        Specified by:
        getStatusDescriptor in interface Build
        Returns:
        Descriptor of the current status of the build
      • getProjectId

        @Nullable
        public String getProjectId()
        Description copied from interface: Build
        Returns internal id of the project this build belongs to. Same as getBuildType().getProjectId().
        Specified by:
        getProjectId in interface Build
        Returns:
        internal id of the project this build belongs to. Same as getBuildType().getProjectId().
      • getProjectExternalId

        @Nullable
        public String getProjectExternalId()
        Description copied from interface: Build
        Returns external id of the project this build belongs to. Same as getBuildType().getProjectId().
        Specified by:
        getProjectExternalId in interface Build
        Returns:
        external id of the project this build belongs to. Same as getBuildType().getProjectId().
      • isFinished

        public boolean isFinished()
        Specified by:
        isFinished in interface Build
        Returns:
        true if the build was finished and was saved to the history
      • getBuildNumber

        @NotNull
        public String getBuildNumber()
        Description copied from interface: Build
        Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').
        Specified by:
        getBuildNumber in interface Build
        Returns:
        presentable build number
      • getFinishDate

        @Nullable
        public Date getFinishDate()
        Description copied from interface: Build
        Returns finish timestamp for the build (server time) or null if it hasn't been finished yet.
        Specified by:
        getFinishDate in interface Build
        Returns:
        Date/time when the build has been finished, null if still running.
      • getFinishOnAgentDate

        @Nullable
        public Date getFinishOnAgentDate()
        Description copied from interface: SBuild
        Returns timestamp when the build finished on agent (server time) or null if it is still running on agent.
        Specified by:
        getFinishOnAgentDate in interface SBuild
        Overrides:
        getFinishOnAgentDate in class BaseBuild
        Returns:
        see above
      • isStopping

        public boolean isStopping()
      • markStopping

        public boolean markStopping()
      • notifyOnDependencyUpdate

        public void notifyOnDependencyUpdate()
      • resetShortStatistics

        public void resetShortStatistics()