gocd-contrib / docker-elastic-agents-plugin

Docker-based elastic agents for GoCD
https://www.gocd.org
Apache License 2.0
31 stars 39 forks source link

Unable to update go server url #91

Closed arun-var closed 1 year ago

arun-var commented 5 years ago

I tried to update my go server url, but getting the following error - Someone has modified the configuration for Plugin Settings 'cd.go.contrib.elastic-agent.docker'. Please update your copy of the config with the changes.

From the gocd server logs I am getting the following error.

java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while requesting for 'cd.go.elastic-agent.server-ping'. Reason: [The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: 'Failed to handle request cd.go.elastic-agent.server-ping due to:cd.go.contrib.elasticagents.dockerswarm.elasticagent.PluginSettingsNotConfiguredException: Plugin settings is not configured.']
    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:57)
    at com.thoughtworks.go.plugin.access.elastic.v4.ElasticAgentExtensionV4.serverPing(ElasticAgentExtensionV4.java:111)
    at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.serverPing(ElasticAgentExtension.java:61)
    at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.serverPing(ElasticAgentPluginRegistry.java:50)
    at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:32)
    at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:22)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: 'Failed to handle request cd.go.elastic-agent.server-ping due to:cd.go.contrib.elasticagents.dockerswarm.elasticagent.PluginSettingsNotConfiguredException: Plugin settings is not configured.'
    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:55)
    ... 8 common frames omitted
arvindsv commented 5 years ago

If you refresh the page and save again, does it work?

arun-var commented 5 years ago

@arvindsv No, it does not. I actually removed the plugin, restarted the gocd server and added it back again, restarted the server again. The older config persisted, and modifying which gave the same error. Is there any other way, to remove/edit this config?

arvindsv commented 5 years ago

@mushycode You could see if the APIs help: https://api.gocd.org/current/#get-plugin-settings

arun-var commented 5 years ago

While trying to use the API on my existing gocd server, the following request https://<gocd_url>/go/api/admin/plugin_settings/cd.go.contrib.elastic-agent.docker gives

{
    "message": "The resource you requested was not found!"
}

The logs are

java.lang.RuntimeException: Interaction with plugin with id 'cd.go.contrib.elastic-agent.docker-swarm' implementing 'elastic-agent' extension failed while requesting for 'cd.go.elastic-agent.server-ping'. Reason: [The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: 'Failed to handle request cd.go.elastic-agent.server-ping due to:cd.go.contrib.elasticagents.dockerswarm.elasticagent.PluginSettingsNotConfiguredException: Plugin settings is not configured.']
    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:57)
    at com.thoughtworks.go.plugin.access.elastic.v4.ElasticAgentExtensionV4.serverPing(ElasticAgentExtensionV4.java:111)
    at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.serverPing(ElasticAgentExtension.java:61)
    at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.serverPing(ElasticAgentPluginRegistry.java:50)
    at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:32)
    at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:22)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: The plugin sent a response that could not be understood by Go. Plugin returned with code '500' and the following response: 'Failed to handle request cd.go.elastic-agent.server-ping due to:cd.go.contrib.elasticagents.dockerswarm.elasticagent.PluginSettingsNotConfiguredException: Plugin settings is not configured.'

I tried to add the plugin to a new instance of fresh gocd server(v19.1.0) running in docker. After adding the plugin and restarting, I got the following error


    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:57)
    at com.thoughtworks.go.plugin.access.elastic.v4.ElasticAgentExtensionV4.serverPing(ElasticAgentExtensionV4.java:111)
    at com.thoughtworks.go.plugin.access.elastic.ElasticAgentExtension.serverPing(ElasticAgentExtension.java:61)
    at com.thoughtworks.go.plugin.access.elastic.ElasticAgentPluginRegistry.serverPing(ElasticAgentPluginRegistry.java:50)
    at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:32)
    at com.thoughtworks.go.server.messaging.elasticagents.ServerPingListener.onMessage(ServerPingListener.java:22)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.runImpl(JMSMessageListenerAdapter.java:73)
    at com.thoughtworks.go.server.messaging.activemq.JMSMessageListenerAdapter.run(JMSMessageListenerAdapter.java:53)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:231)
    at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.doOn(FelixGoPluginOSGiFramework.java:202)
    at com.thoughtworks.go.plugin.infra.DefaultPluginManager.submitTo(DefaultPluginManager.java:140)
    at com.thoughtworks.go.plugin.access.PluginRequestHelper.submitRequest(PluginRequestHelper.java:48)
    ... 8 common frames omitted
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
    at cd.go.contrib.elasticagents.docker.DockerPlugin.handle(DockerPlugin.java:89)
    at com.thoughtworks.go.plugin.infra.DefaultPluginManager.lambda$submitTo$0(DefaultPluginManager.java:143)
    at com.thoughtworks.go.plugin.infra.FelixGoPluginOSGiFramework.executeActionOnTheService(FelixGoPluginOSGiFramework.java:225)
    ... 11 common frames omitted
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
    at cd.go.contrib.elasticagents.docker.DockerPlugin.refreshInstances(DockerPlugin.java:97)
    at cd.go.contrib.elasticagents.docker.DockerPlugin.handle(DockerPlugin.java:58)
    ... 13 common frames omitted
Caused by: java.lang.NullPointerException: null
    at cd.go.contrib.elasticagents.docker.DockerClientFactory.docker(DockerClientFactory.java:41)
    at cd.go.contrib.elasticagents.docker.DockerContainers.docker(DockerContainers.java:172)
    at cd.go.contrib.elasticagents.docker.DockerContainers.refreshAll(DockerContainers.java:138)
    at cd.go.contrib.elasticagents.docker.DockerPlugin.refreshInstances(DockerPlugin.java:95)
    ... 14 common frames omitted```
varshavaradarajan commented 5 years ago

@mushycode - if the plugin settings is not configured, then the get plugin settings API returns 404. Can be a little confusing as 404 can mean the plugin is not installed or that the plugin settings hasn't been configured. You said the old config persisted after you reinstalled the plugin and restarted the server. But, if you're getting 404 when trying to get the plugin settings, it means it hasn't been configured. You may want to try doing https://api.gocd.org/current/#create-plugin-settings

Also, the request you posted says cd.go.contrib.elastic-agent.docker but all the logs around PluginSettingsNotConfigured is for docker swarm. Are you sure you are trying the API request with the right plugin id?