Interface SRunningBuild

    • Method Detail

      • getCurrentPath

        String getCurrentPath()
        Returns short description of current running step.
        Returns:
        short description of current running step.
      • getAgent

        @NotNull
        SBuildAgent getAgent()
        Get build agent this running build is running on. May be unregistered or even dead agent, but never null.
        Specified by:
        getAgent in interface SBuild
        Returns:
        see above
      • getAgentId

        int getAgentId()
        Returns:
        id of the agent where this build is running; returns -1 for agent less builds
        Since:
        2017.2.3
      • getQueuedAgentId

        @Deprecated
        @Nullable
        Integer getQueuedAgentId()
        Deprecated.
        use getQueuedAgentRestrictor(). Returns id of an agent this build was queued on (when build configuration was added to queue). Returns null if build was not queued on a specific agent.
        Returns:
        agent this build was queued on or null if build was not queued on a specific agent
      • getQueuedAgentRestrictor

        @Nullable
        AgentRestrictor 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.
        Returns:
        see above
        Since:
        7.0
      • isInterrupted

        boolean isInterrupted()
        When processing buildFinished event, returns true if build was finished unexpectedly (for instance, killed)
        Returns:
        true or false
      • getCompletedPercent

        int getCompletedPercent()
        Returns:
        completed percentage for the build according to build duration estimated time. or -1 if there is no estimate
      • addBuildMessages

        void addBuildMessages​(@NotNull
                              List<BuildMessage1> messages)
        Deprecated.
        since 10.0 messages in build log should be logged via BuildLog, see SBuild.getBuildLog() method.
        Adds new server messages to the build.
        Parameters:
        messages - new build messages.
      • addBuildMessage

        void addBuildMessage​(@NotNull
                             BuildMessage1 message)
        Deprecated.
        since 10.0 messages in build log should be logged via BuildLog, see SBuild.getBuildLog() method.
        Adds new message from server to the build.
      • setBuildNumber

        void setBuildNumber​(@NotNull
                            String newBuildNumber)
        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
        Parameters:
        newBuildNumber - new value for this build build number
      • setBuildStatus

        void setBuildStatus​(Status status)
        Deprecated.
        use jetbrains.buildServer.serverSide.SBuild#addBuildProblem to fail build and jetbrains.buildServer.serverSide.SBuild#muteBuildProblems to mark build as successful
        Set current status of the running build. Useful before build finish to update build status.
        Parameters:
        status - new status of the build
      • setInterrupted

        void setInterrupted​(@NotNull
                            RunningBuildState state,
                            @Nullable
                            User user,
                            @Nullable
                            String reason)
        Mark this build as interrupted.
        Parameters:
        state - running build state
        user - user who initiated interruption or null
        reason - reason why interruption initiated or null
      • getAgentAccessCode

        String getAgentAccessCode()
        Returns access code which can be used by agent to access server resources by HTTP.
        Returns:
        access code
      • isProbablyHanging

        boolean isProbablyHanging()
        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.
        Returns:
        true if build is probably hanging
      • getLastBuildActivityTimestamp

        Date getLastBuildActivityTimestamp()
        Returns:
        timestamp of last message received from a build.
      • getTimeSpentSinceLastBuildActivity

        long getTimeSpentSinceLastBuildActivity()
        Returns time in seconds spent since last build activity.
        Returns:
        time in seconds
      • stop

        void stop​(@Nullable
                  User user,
                  @Nullable
                  String comment)
        Stops the build. If this is a user action, user who performs this action must be specified. If build is stopped without user it will be considered crashed and can be re-added into the queue.
        Parameters:
        user - user who stopped build or null
        comment - comment for the action or null
      • finish

        void finish​(@NotNull
                    Date finishDate)
        Finalizes all build related activities and finishes the build. Build must be finished on agent. Takes no effect for already finished or interrupted builds.
        Parameters:
        finishDate - finish date
        Since:
        2021.1