use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class ElasticAgentPluginService method heartbeat.
public void heartbeat() {
LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService.allElasticAgents();
// pingMessage TTL is set lesser than elasticPluginHeartBeatInterval to ensure there aren't multiple ping request for the same plugin
long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L;
for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) {
elasticAgentsOfMissingPlugins.remove(descriptor.id());
List<ClusterProfile> clusterProfiles = clusterProfilesService.getPluginProfiles().findByPluginId(descriptor.id());
boolean secretsResolved = resolveSecrets(descriptor.id(), clusterProfiles);
if (!secretsResolved)
continue;
serverPingQueue.post(new ServerPingMessage(descriptor.id(), clusterProfiles), pingMessageTimeToLive);
serverHealthService.removeByScope(scope(descriptor.id()));
}
if (!elasticAgentsOfMissingPlugins.isEmpty()) {
for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) {
Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream().map(ElasticAgentMetadata::uuid).collect(toList());
String description = format("Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.", pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids);
serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins", description, general(scope(pluginId))));
LOGGER.warn(description);
}
}
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class RoleConfigCommandTest method setAuthorizationPluginInfo.
private void setAuthorizationPluginInfo() {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
PluggableInstanceSettings authConfigSettins = new PluggableInstanceSettings(asList(k1, k2, k3));
PluggableInstanceSettings roleConfigSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
com.thoughtworks.go.plugin.domain.authorization.Capabilities capabilities = new com.thoughtworks.go.plugin.domain.authorization.Capabilities(SupportedAuthType.Web, true, true, true);
AuthorizationPluginInfo artifactPluginInfo = new AuthorizationPluginInfo(pluginDescriptor, authConfigSettins, roleConfigSettings, null, capabilities);
when(pluginDescriptor.id()).thenReturn("cd.go.github");
AuthorizationMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class BasicCruiseConfigTest method setArtifactPluginInfo.
private void setArtifactPluginInfo() {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
PluggableInstanceSettings storeConfigSettings = new PluggableInstanceSettings(asList());
PluginConfiguration k1 = new PluginConfiguration("k1", new Metadata(false, true));
PluginConfiguration k2 = new PluginConfiguration("k2", new Metadata(false, false));
PluginConfiguration k3 = new PluginConfiguration("k3", new Metadata(false, true));
PluggableInstanceSettings publishArtifactSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
PluggableInstanceSettings fetchArtifactSettings = new PluggableInstanceSettings(asList(k1, k2, k3));
ArtifactPluginInfo artifactPluginInfo = new ArtifactPluginInfo(pluginDescriptor, storeConfigSettings, publishArtifactSettings, fetchArtifactSettings, null, new Capabilities());
when(pluginDescriptor.id()).thenReturn("cd.go.s3");
ArtifactMetadataStore.instance().setPluginInfo(artifactPluginInfo);
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class AuthorizationMetadataStoreTest method pluginInfo.
private AuthorizationPluginInfo pluginInfo(String pluginId, SupportedAuthType supportedAuthType) {
AuthorizationPluginInfo pluginInfo = mock(AuthorizationPluginInfo.class);
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
when(pluginDescriptor.id()).thenReturn(pluginId);
when(pluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
Capabilities capabilities = mock(Capabilities.class);
when(capabilities.getSupportedAuthType()).thenReturn(supportedAuthType);
when(pluginInfo.getCapabilities()).thenReturn(capabilities);
return pluginInfo;
}
use of com.thoughtworks.go.plugin.api.info.PluginDescriptor in project gocd by gocd.
the class AnalyticsMetadataStoreTest method shouldHandleUpdateAssetsPath.
@Test
public void shouldHandleUpdateAssetsPath() throws Exception {
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
AnalyticsPluginInfo pluginInfo = new AnalyticsPluginInfo(pluginDescriptor, null, null, null);
when(pluginDescriptor.id()).thenReturn("plugin_id");
store.setPluginInfo(pluginInfo);
store.updateAssetsPath("plugin_id", "static_assets_path");
assertThat(pluginInfo.getStaticAssetsPath(), is("static_assets_path"));
}
Aggregations