Shaked
Shaked

Reputation: 21

SEVERE: https://jenkins.domainname.com/tcpSlaveAgentListener/ appears to be publishing an invalid X-Instance-Identity

We're trying to connect a previously connected agent to a Jenkins server.

We get the following error:

SEVERE: https://jenkins.domainname.com/tcpSlaveAgentListener/ appears to be publishing an invalid X-Instance-Identity.
java.io.IOException: https://jenkins.domainname.com/tcpSlaveAgentListener/ appears to be publishing an invalid X-Instance-Identity.
    at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:287)
    at hudson.remoting.Engine.innerRun(Engine.java:694)
    at hudson.remoting.Engine.run(Engine.java:519)

The command to run the agent is:

java -jar agent.jar -jnlpUrl http://${private_ip}:8080/computer/mac/slave-agent.jnlp -secret ${secret} -workDir "/var/jenkins-sign"

Does anyone have an idea?

Upvotes: 2

Views: 1915

Answers (4)

Jason
Jason

Reputation: 46

I fixed the issue with generate SSH key on agent host and create SSH credential on Jenkins controller. Following instructions of this official manual: https://www.jenkins.io/doc/book/using/using-agents/

Upvotes: 0

MatoM
MatoM

Reputation: 11

Set global environment variable jenkins.agent.inboundUrl to your private adderess (with http/https) + port + suffix (if set).

This value will be used as url in JNLP file. This enables using a private address for inbound tcp agents, separate from Jenkins root URL.

see: https://issues.jenkins.io/browse/JENKINS-63222

Upvotes: 0

Bill Dinger
Bill Dinger

Reputation: 179

In case anyone else runs into the issue, in my case it was because I was passing the entire URL, i.e.

http://someurl/jenkins/computer/test/slave-agent.jnlp

and what it really wanted was

http://someurl/jenkins/

Upvotes: 1

Shaked
Shaked

Reputation: 21

Unfortunately, I think it's related to Jenkins upgrade that caused this, and I'm not sure there's a better solution than what I found.

Putting here my solution, but if anyone knows something better, I'd be happy to hear about it :)

  • Download the agent.jar
  • Download the slave-agent.jnlp and modify it:
    • Change all occurrences of https://jenkins.mydomain.com to http://[private_ip]:[port].
  • Start the process: java -jar agent.jar -jnlpUrl "file:/path/to/dir/slave-agent.jnlp" -workDir "/path/to/dir"
    • Do not add the secret to this command.
    • If you're using Jenkins agent as a service, remove the -secret argument from the file.

Upvotes: 0

Related Questions