use of com.thoughtworks.go.remote.BuildRepositoryRemote in project gocd by gocd.
the class AgentHTTPClientController method retrieveWork.
void retrieveWork() {
final BuildRepositoryRemote client = remote();
AgentIdentifier agentIdentifier = agentIdentifier();
LOG.debug("[Agent Loop] {} is checking for work from Go", agentIdentifier);
Work work;
try {
getAgentRuntimeInfo().idle();
work = client.getWork(getAgentRuntimeInfo());
if (!(work instanceof NoWork)) {
LOG.debug("[Agent Loop] Got work from server: [{}]", work.description());
}
runner = new JobRunner();
final AgentWorkContext agentWorkContext = new AgentWorkContext(agentIdentifier, client, manipulator, getAgentRuntimeInfo(), packageRepositoryExtension, scmExtension, taskExtension, artifactExtension, pluginRequestProcessorRegistry);
runner.run(work, agentWorkContext);
} catch (UnregisteredAgentException e) {
LOG.warn("[Agent Loop] Invalid agent certificate with fingerprint {}. Registering with server on next iteration.", e.getUuid());
sslInfrastructureService.invalidateAgentCertificate();
} finally {
getAgentRuntimeInfo().idle();
}
}
use of com.thoughtworks.go.remote.BuildRepositoryRemote in project gocd by gocd.
the class AgentHTTPClientController method ping.
@Override
public void ping() {
final BuildRepositoryRemote client = remote();
try {
if (sslInfrastructureService.isRegistered()) {
AgentIdentifier agent = agentIdentifier();
LOG.trace("{} is pinging server [{}]", agent, client);
getAgentRuntimeInfo().refreshUsableSpace();
agentInstruction = client.ping(getAgentRuntimeInfo());
pingSuccess();
LOG.trace("{} pinged server [{}]", agent, client);
}
} catch (Throwable e) {
LOG.error("Error occurred when agent tried to ping server: ", e);
}
}
Aggregations