jenkinsci / nomad-plugin

Nomad cloud plugin for Jenkins
https://plugins.jenkins.io/nomad/
MIT License
56 stars 41 forks source link

Nomad cloud agent is lost after Jenkins controller restart #211

Open cotjoey opened 4 months ago

cotjoey commented 4 months ago

Jenkins and plugins versions report

Environment ```text Nomad plug-in 0.10.0 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

I am using the jenkins/inbound-agent docker image in my Nomad cloud. The agent starts correctly, and connects to the Jenkins controller.

Reproduction steps

  1. Configure a Nomad cloud in Jenkins controller;
  2. Submit a job to the Jenkins controller;
  3. The Nomad cloud spins up an agent in Nomad with the jenkins/inbound-agent image;
  4. The agent connects successfully to the Jenkins controller via websocket;
  5. The Jenkins UI shows the new agent online via the Nodes screen;
  6. Restart the Jenkins controller - the Nomad agent disappears from the UI;
  7. The agent in the Nomad cloud is unable to connect back to the controller with HandshakeException - probably because the JENKINS_SECRET value disappeared from the Jenkins controller because the agent config didn’t persist?

Expected Results

I expect the agent configuration to persist on the Jenkins controller so that the Nomad cloud agent can reconnect back when the Jenkins controller is restarted.

Actual Results

The Nomad cloud agent fails to reconnect to the Jenkins controller when the controller is restarted.

Anything else?

I have no problems when I restart the agent by itself, it reconnects to the Jenkins controller without problems.

Are you interested in contributing a fix?

I don’t have much knowledge of the inner workings of this plugin. I can’t contribute.