Interface SBuildAgent

    • Method Detail

      • getAgentTypeId

        int getAgentTypeId()
        Returns id of this agent type. All non cloud agents have own agent type. Cloud agents can share the same agent type. For cloud agents, agent type is the same as image.
        Returns:
        agent type id.
        Since:
        5.1
      • getVersion

        @NotNull
        java.lang.String getVersion()
        Returns agent version.
        Returns:
        agent version
      • getPluginsSignature

        @NotNull
        java.lang.String getPluginsSignature()
        Returns signature of plugins installed on the agent. The agent version and plugins signature are used to determine whether upgrade of this agent is required or not.
        Returns:
        signature of plugins installed on the agent.
      • isOutdated

        boolean isOutdated()
        Returns true if version of this agent does not match version of the server.
        Returns:
        see above
      • isPluginsOutdated

        boolean isPluginsOutdated()
        Returns true if some of the agent plugins are outdated.
        Returns:
        see above
      • getRunningBuild

        @Nullable
        SRunningBuild getRunningBuild()
        Returns the build which is currently running on the agent; null if no such build available
        Returns:
        the build which is currently running on the agent; null if no such build available
      • getAuthorizationToken

        @NotNull
        java.lang.String getAuthorizationToken()
        Returns agent token which should be used to authorize build agent
        Returns:
        agent token which should be used to authorize build agent
      • getHostName

        java.lang.String getHostName()
        Returns hostname of the computer where build agent is running. If server is unable to resolve agent address to host name the address is returned.
        Returns:
        Returns hostname of the computer where build agent is running
      • getHostAddress

        java.lang.String getHostAddress()
        Returns IP address or fully qualified domain name (depending on the ownAddress property in the buildAgent.properties) of the computer where build agent is running
        Returns:
        see above
      • getPort

        int getPort()
        Port where agent is listening for server commands.
        Returns:
        see above
      • getCommunicationProtocolDescription

        @NotNull
        java.lang.String getCommunicationProtocolDescription()
        Returns short description of the protocol that is used to communicate with this agent.
        Examples: "unidirectional", "local".
        Since:
        9.1
      • getCommunicationProtocolType

        @NotNull
        java.lang.String getCommunicationProtocolType()
        Returns type (identifier) of the protocol that is used to communicate with this agent. Opposite to getCommunicationProtocolDescription() this type is constant and will not change for the particular protocol in future.
        Since:
        9.1.2
      • ping

        boolean ping()
        Try to ping agent over networks
        Returns:
        true if agent is reachable
      • getStatusComment

        @NotNull
        Comment getStatusComment()
        Returns information about changing agent enabled/disabled status, including timestamp, user, comment text
        Returns:
        see above
        See Also:
        Comment, isEnabled()
      • getAuthorizeComment

        @NotNull
        Comment getAuthorizeComment()
        Returns information about changing agent authorized status, including timestamp, user, comment text
        Returns:
        see above
        See Also:
        Comment, isAuthorized()
      • isRegistered

        boolean isRegistered()
        Returns true or false depending on whether this agent is currently registered on server or not.
        Returns:
        see above
      • getUnregistrationComment

        @Nullable
        java.lang.String getUnregistrationComment()
        If agent is not registered returns reason of its' unregistration.
        Returns:
        agent is not registered returns reason of its' unregistration.
      • getRegistrationTimestamp

        @NotNull
        java.util.Date getRegistrationTimestamp()
        Returns timestamp of this agent registration. If agent is not registered the returned timestamp is timestamp of last agent registration.
        Returns:
        see above
      • getLastCommunicationTimestamp

        java.util.Date getLastCommunicationTimestamp()
        Returns timestamp of the last agent - server (or server - agent) successful communication.
        Returns:
        see above
      • setEnabled

        void setEnabled​(boolean enabled,
                        @Nullable
                        SUser user,
                        @NotNull
                        java.lang.String reason)
        Changes this agent enabled status.
        Parameters:
        enabled - true if agent is enabled, and false otherwise
        user - user who changes the status or null
        reason - reason why the status is changed
      • setEnabled

        void setEnabled​(boolean enabled,
                        @Nullable
                        SUser user,
                        @NotNull
                        java.lang.String reason,
                        long statusRestoringTimestamp)
        Changes this agent enabled status and restores it in the specified time.
        Parameters:
        enabled - true if agent is enabled, and false otherwise
        user - user who changes the status or null
        reason - reason why the status is changed
        statusRestoringTimestamp - timestamp at which agent status will be restored
        Since:
        4.0.2
      • setAuthorized

        void setAuthorized​(boolean authorized,
                           @Nullable
                           SUser user,
                           @NotNull
                           java.lang.String reason)
                    throws LicenseNotGrantedException
        Changes this agent authorization status.
        Parameters:
        authorized - true if agent should become authorized and false otherwise
        user - user who changes the status or null
        reason - reason why the status changed
        Throws:
        LicenseNotGrantedException - if agent cannot be authorized because there is not enough license tokens
      • releaseSources

        void releaseSources()
        Releases sources of all of the build configurations ever built on this agent, after that a full checkout will be performed for all of these configurations on this agent.
      • releaseSources

        void releaseSources​(@NotNull
                            SBuildType buildType)
        Releases sources of the specified build configuration on this agent. A full checkout will be performed when a build of this build configuration is started on this agent.
        Parameters:
        buildType - build configuration
      • getBuildConfigurationsBuilt

        @NotNull
        java.util.List<SBuildType> getBuildConfigurationsBuilt()
        Returns build configurations ever built on this agent.
        Returns:
        see above
      • getAgentStatusToRestore

        @Nullable
        java.lang.Boolean getAgentStatusToRestore()
        Returns null if agent status will not be restored, otherwise returns status to restore
        Returns:
        null if agent status will not be restored, otherwise returns status to restore
      • getAgentStatusRestoringTimestamp

        @Nullable
        java.util.Date getAgentStatusRestoringTimestamp()
        Returns null if agent status will not be restored, otherwise returns status restoring timestamp
        Returns:
        null if agent status will not be restored, otherwise returns status restoring timestamp
      • getIdleTime

        long getIdleTime()
        Returns:
        number of milliseconds build agent was idle. If there was no build started time since registration is returned. If agent is running a build, 0 is returned.
      • describe

        @NotNull
        java.lang.String describe​(boolean verbose)
        Specified by:
        describe in interface jetbrains.buildServer.log.Loggable
        Parameters:
        verbose - verbosity of object description
        Returns:
        description of this object. If verbose is true, description should have mode details.
        Since:
        8.0.2
      • getAgentPool

        @NotNull
        AgentPool getAgentPool()
        Returns:
        agent pool agent belongs to
      • isCloudAgent

        boolean isCloudAgent()
        Returns:
        true if this agent is started by TeamCity cloud integration
        Since:
        2017.2
      • canStartBuildIfAgentOutdated

        boolean canStartBuildIfAgentOutdated()
        Returns:
        true if agent can start builds even if the agent is outdated
        Since:
        2020.1