Interface RunningBuildEx

    • Method Detail

      • setStartTimes

        void setStartTimes​(@NotNull
                           Date agentStartTime,
                           @NotNull
                           Date serverStartTime,
                           @NotNull
                           TimeZone agentTimeZone)
        Sets timestamps when command to run build was sent to an agent.
        Parameters:
        agentStartTime - agent timestamp
        serverStartTime - server timestamp
      • updateBuild

        void updateBuild()
      • updateBuildIfLastUpdateExpired

        void updateBuildIfLastUpdateExpired​(int expirationTimeSeconds)
        Performs update of the build data but only if some time has passed since the last update.
        Parameters:
        expirationTimeSeconds - time threshold since the last update in seconds
      • updateBuildInfo

        boolean updateBuildInfo()
        Loads build interruption and build finish timestamps from database into the build. Returns true if running build exists in DB and false otherwise.
      • updateBuildStatisticValues

        void updateBuildStatisticValues()
        Loads statistic values reported for the build from database and sends events on every new loaded value
      • updateExternalArtifactsInfoOnAccess

        void updateExternalArtifactsInfoOnAccess()
      • setCustomStatusText

        void setCustomStatusText​(@NotNull
                                 String text)
        Sets the custom build status text.
        Parameters:
        text - new build status text. Supports "{build.status.text}" placeholder to be substituted with the default text
        Since:
        2018.1
      • start

        void start​(boolean async)
        Must be invoked only once when build starts.
      • finish

        boolean finish()
        The method completes the build finishing procedure and should not be called directly in the majority of cases. Instead SRunningBuild.finish(Date) method should be used to finish the build.
      • finishImmediately

        void finishImmediately​(@NotNull
                               Date finishDate,
                               boolean failed)
        For tests only!
      • finishedOnOtherNode

        void finishedOnOtherNode()
      • runUnlessFinished

        boolean runUnlessFinished​(Runnable runnable)
        Executes specified runnable if build is not finished. Build won't finish until runnable completes.
        Parameters:
        runnable - runnable
        Returns:
        true if runnable was executed
      • createAgentBuild

        @NotNull
        AgentBuild createAgentBuild()
        Creates structure containing all of the parameters which should be sent to an agent
        Returns:
      • getTestRunMuter

        TestRunMuter getTestRunMuter()
        Returns a special service that allows to mute test run if neccessary.
        Returns:
        an instance of the test run muter.
      • getQueuedAgentRestrictor

        @Nullable
        SAgentRestrictor getQueuedAgentRestrictor()
        Returns an agent restrictor this build was queued with (when build configuration was added to queue). Returns null if build was not queued on a specific agent / agent set.
        Specified by:
        getQueuedAgentRestrictor in interface SRunningBuild
        Returns:
        see above
        Since:
        7.0
      • getUserDataStorage

        @NotNull
        UserDataStorage getUserDataStorage()
        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.
        Returns:
        user data holder
        Since:
        7.0
      • getCompletedStages

        @NotNull
        Map<String,​Long> getCompletedStages()
        Reports target build-type's stages (this build being instance of) that have been already completed by this particular build
        Returns:
        mapping from stage-names to respective durations
      • isFinishReceived

        boolean isFinishReceived()
        Returns:
        true if build finished was received by the server.
      • markAsFinished

        void markAsFinished​(@NotNull
                            Date finishDate,
                            boolean failed)
      • markAsFinishedUnexpectedly

        void markAsFinishedUnexpectedly​(@NotNull
                                        String reason)
      • publishArtifact

        void publishArtifact​(@NotNull
                             String path,
                             @NotNull
                             byte[] content)
                      throws IOException
        Adds artifact to the build by the specified path
        Parameters:
        path - path where to store artifact
        content - artifact content
        Throws:
        IOException
        Since:
        10.0
      • publishArtifact

        void publishArtifact​(@NotNull
                             String path,
                             @NotNull
                             File srcFile)
                      throws IOException
        Adds artifact to the build by the specified path
        Parameters:
        path - path where to store artifact
        srcFile - file containing artifact content; note that after the publishing srcFile can be removed
        Throws:
        IOException
        Since:
        10.0
      • publishArtifact

        void publishArtifact​(@NotNull
                             String path,
                             @NotNull
                             InputStream is,
                             @Nullable
                             PublishArtifactProgressListener progressListener)
                      throws IOException
        Adds artifact to the build from the specified stream allowing to trace progress
        Parameters:
        path - path where to store artifact
        InputStream - input stream with artifact content; note that this method does not close input stream
        progressListener - PublishArtifactProgressListener to track progress
        Throws:
        IOException
      • publishArtifact

        void publishArtifact​(@NotNull
                             String path,
                             @NotNull
                             File srcFile,
                             @Nullable
                             PublishArtifactProgressListener progressListener)
                      throws IOException
        Adds artifact to the build from the specified file allowing to trace progress
        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
        Throws:
        IOException
      • publishArtifact

        void publishArtifact​(@NotNull
                             String path,
                             @NotNull
                             InputStream is)
                      throws IOException
        Adds artifact to the build by the specified path
        Parameters:
        path - path where to store artifact
        InputStream - input stream with artifact content; note that this method does not close input stream
        Throws:
        IOException
        Since:
        10.0
      • getBuildCounter

        long getBuildCounter()
        Returns:
        value of build counter when this build started
      • getProgressText

        @NotNull
        String getProgressText()
        Returns:
        current progress text calculated for the build; this text is used in build status line
        Since:
        10.0
      • stopNoInterrupt

        void stopNoInterrupt()
        Stops build on server and on agent without making it interrupted
      • stop

        void stop​(@NotNull
                  RunningBuildState interruptedState,
                  @Nullable
                  User user,
                  @NotNull
                  String comment,
                  boolean reAdd2Queue)
           throws AccessDeniedException
        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)
        Throws:
        AccessDeniedException
        Since:
        2019.1
      • resetAgentCache

        void resetAgentCache()
        Resets internal cache of agent instance
      • serverStartup

        void serverStartup()
      • serverShutdown

        void serverShutdown()
      • startBuildFailureChecker

        void startBuildFailureChecker()
        Initialize periodical build failue checker process
        Since:
        2019.1.2
      • stopBuildFailureChecker

        void stopBuildFailureChecker()
        Stop periodical failure checker process
        Since:
        2020.1
      • getHangingDependency

        @Nullable
        RunningBuildEx getHangingDependency()
        Returns:
        Traverses through running snapshot dependencies of this build and returns the first found one which is probably hanging.
        Since:
        2017.2
      • closeBuildLog

        void closeBuildLog()
        Closes the build log's root block, flushes messages and closes the build log
        Since:
        2018.2
      • detachedFromAgent

        void detachedFromAgent()
        Should be called when the build has been detached from the agent and agent can start some other build
        Since:
        2020.2
      • getDetachFromAgentReceivedTimestamp

        @Nullable
        Long getDetachFromAgentReceivedTimestamp()
        Returns:
        timestamp when this build was attempted to detach from agent
        Since:
        2020.2
      • prepareArtifactDependencies

        void prepareArtifactDependencies()
        Resolves artifact dependencies by replacing "latest" rules with actual build ids.
      • isStarting

        boolean isStarting()
        Returns true if the build is trying to start on an agent and runBuild() command has not finished yet
        Returns:
      • getTemporaryCustomDataStorage

        @NotNull
        CustomDataStorage getTemporaryCustomDataStorage()
        Returns:
        a temporary custom data storage which exists only while the build is running and is disposed once the build is finished
        Since:
        2022.04
      • getBuildLog

        @NotNull
        BuildLogEx getBuildLog()
        Description copied from interface: SBuild
        Returns build log.
        Specified by:
        getBuildLog in interface SBuild
        Returns:
        build log.
      • getBuildLogIfInitialized

        @Nullable
        BuildLogEx getBuildLogIfInitialized()
      • skipBuildChainBuilds

        void skipBuildChainBuilds​(@NotNull
                                  List<String> externalIdsOrTags,
                                  @NotNull
                                  String comment)
        This call looks for builds tagged with 'tags' in all build chains this running build belongs to, and cancels/removes such builds from the queue.
        Parameters:
        externalIdsOrTags - array of tags for builds which should be skipped in the build chain. A tag could be either a build configuration external ID, or a tag specified via a special tag parameter on a build configuration.
        comment - comment to use when canceling queued builds
        Since:
        2024.12